aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2006-06-21 16:43:50 -0400
committerAuke-jan Kok <ahkok@gitlost.site>2006-06-21 16:43:50 -0400
commit0d204094d15dac2e8a439b993f71eda385b4dccd (patch)
tree647f0ddec94d0fb4aaf74fa55bcad75946030f8a
parenta487a8f7b6947f6445e5a1aa876522916785d5ec (diff)
parent612eff0e3715a6faff5ba1b74873b99e036c59fe (diff)
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
-rw-r--r--Documentation/feature-removal-schedule.txt9
-rw-r--r--Documentation/infiniband/ipoib.txt12
-rw-r--r--Documentation/kernel-parameters.txt9
-rw-r--r--Documentation/memory-barriers.txt348
-rw-r--r--Documentation/networking/ip-sysctl.txt7
-rw-r--r--Documentation/networking/netdevices.txt8
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/Kconfig2
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c8
-rw-r--r--arch/arm/mach-imx/irq.c2
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c5
-rw-r--r--arch/arm/mach-pxa/spitz.c1
-rw-r--r--arch/arm/mach-sa1100/neponset.c8
-rw-r--r--arch/arm/mach-versatile/core.c5
-rw-r--r--arch/i386/kernel/acpi/earlyquirk.c23
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c20
-rw-r--r--arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c11
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c20
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longrun.c1
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k7.c13
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c344
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h40
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c12
-rw-r--r--arch/i386/kernel/setup.c11
-rw-r--r--arch/mips/Kconfig244
-rw-r--r--arch/mips/Makefile37
-rw-r--r--arch/mips/au1000/common/au1xxx_irqmap.c4
-rw-r--r--arch/mips/au1000/common/pci.c16
-rw-r--r--arch/mips/au1000/common/setup.c6
-rw-r--r--arch/mips/au1000/common/time.c9
-rw-r--r--arch/mips/au1000/csb250/irqmap.c4
-rw-r--r--arch/mips/au1000/db1x00/irqmap.c4
-rw-r--r--arch/mips/au1000/hydrogen3/irqmap.c4
-rw-r--r--arch/mips/au1000/mtx-1/irqmap.c4
-rw-r--r--arch/mips/au1000/pb1000/irqmap.c4
-rw-r--r--arch/mips/au1000/pb1100/irqmap.c4
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c4
-rw-r--r--arch/mips/au1000/pb1500/irqmap.c4
-rw-r--r--arch/mips/au1000/pb1550/irqmap.c4
-rw-r--r--arch/mips/au1000/xxs1500/irqmap.c4
-rw-r--r--arch/mips/basler/excite/Makefile9
-rw-r--r--arch/mips/basler/excite/excite_dbg_io.c122
-rw-r--r--arch/mips/basler/excite/excite_device.c404
-rw-r--r--arch/mips/basler/excite/excite_flashtest.c294
-rw-r--r--arch/mips/basler/excite/excite_fpga.h80
-rw-r--r--arch/mips/basler/excite/excite_iodev.c183
-rw-r--r--arch/mips/basler/excite/excite_iodev.h10
-rw-r--r--arch/mips/basler/excite/excite_irq.c129
-rw-r--r--arch/mips/basler/excite/excite_procfs.c81
-rw-r--r--arch/mips/basler/excite/excite_prom.c148
-rw-r--r--arch/mips/basler/excite/excite_setup.c307
-rw-r--r--arch/mips/cobalt/console.c5
-rw-r--r--arch/mips/cobalt/setup.c43
-rw-r--r--arch/mips/configs/atlas_defconfig11
-rw-r--r--arch/mips/configs/bigsur_defconfig11
-rw-r--r--arch/mips/configs/capcella_defconfig11
-rw-r--r--arch/mips/configs/cobalt_defconfig11
-rw-r--r--arch/mips/configs/db1000_defconfig11
-rw-r--r--arch/mips/configs/db1100_defconfig11
-rw-r--r--arch/mips/configs/db1200_defconfig11
-rw-r--r--arch/mips/configs/db1500_defconfig11
-rw-r--r--arch/mips/configs/db1550_defconfig11
-rw-r--r--arch/mips/configs/ddb5477_defconfig11
-rw-r--r--arch/mips/configs/decstation_defconfig13
-rw-r--r--arch/mips/configs/e55_defconfig11
-rw-r--r--arch/mips/configs/emma2rh_defconfig1207
-rw-r--r--arch/mips/configs/ev64120_defconfig11
-rw-r--r--arch/mips/configs/ev96100_defconfig11
-rw-r--r--arch/mips/configs/excite_defconfig1220
-rw-r--r--arch/mips/configs/ip22_defconfig11
-rw-r--r--arch/mips/configs/ip27_defconfig13
-rw-r--r--arch/mips/configs/ip32_defconfig11
-rw-r--r--arch/mips/configs/it8172_defconfig11
-rw-r--r--arch/mips/configs/ivr_defconfig11
-rw-r--r--arch/mips/configs/jaguar-atx_defconfig11
-rw-r--r--arch/mips/configs/jmr3927_defconfig11
-rw-r--r--arch/mips/configs/lasat200_defconfig11
-rw-r--r--arch/mips/configs/malta_defconfig11
-rw-r--r--arch/mips/configs/mipssim_defconfig11
-rw-r--r--arch/mips/configs/mpc30x_defconfig11
-rw-r--r--arch/mips/configs/ocelot_3_defconfig11
-rw-r--r--arch/mips/configs/ocelot_c_defconfig11
-rw-r--r--arch/mips/configs/ocelot_defconfig11
-rw-r--r--arch/mips/configs/ocelot_g_defconfig11
-rw-r--r--arch/mips/configs/pb1100_defconfig11
-rw-r--r--arch/mips/configs/pb1500_defconfig11
-rw-r--r--arch/mips/configs/pb1550_defconfig11
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig11
-rw-r--r--arch/mips/configs/pnx8550-v2pci_defconfig11
-rw-r--r--arch/mips/configs/qemu_defconfig11
-rw-r--r--arch/mips/configs/rbhma4500_defconfig11
-rw-r--r--arch/mips/configs/rm200_defconfig11
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig11
-rw-r--r--arch/mips/configs/sead_defconfig11
-rw-r--r--arch/mips/configs/tb0226_defconfig11
-rw-r--r--arch/mips/configs/tb0229_defconfig11
-rw-r--r--arch/mips/configs/tb0287_defconfig11
-rw-r--r--arch/mips/configs/workpad_defconfig11
-rw-r--r--arch/mips/configs/wrppmc_defconfig (renamed from arch/mips/configs/ddb5476_defconfig)359
-rw-r--r--arch/mips/configs/yosemite_defconfig11
-rw-r--r--arch/mips/ddb5xxx/common/prom.c8
-rw-r--r--arch/mips/ddb5xxx/ddb5074/Makefile8
-rw-r--r--arch/mips/ddb5xxx/ddb5074/irq.c169
-rw-r--r--arch/mips/ddb5xxx/ddb5074/nile4_pic.c286
-rw-r--r--arch/mips/ddb5xxx/ddb5074/setup.c234
-rw-r--r--arch/mips/ddb5xxx/ddb5476/Makefile9
-rw-r--r--arch/mips/ddb5xxx/ddb5476/dbg_io.c136
-rw-r--r--arch/mips/ddb5xxx/ddb5476/irq.c165
-rw-r--r--arch/mips/ddb5xxx/ddb5476/nile4_pic.c190
-rw-r--r--arch/mips/ddb5xxx/ddb5476/setup.c296
-rw-r--r--arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c109
-rw-r--r--arch/mips/ddb5xxx/ddb5477/setup.c2
-rw-r--r--arch/mips/dec/setup.c2
-rw-r--r--arch/mips/dec/time.c2
-rw-r--r--arch/mips/defconfig11
-rw-r--r--arch/mips/emma2rh/common/Makefile13
-rw-r--r--arch/mips/emma2rh/common/irq.c108
-rw-r--r--arch/mips/emma2rh/common/irq_emma2rh.c134
-rw-r--r--arch/mips/emma2rh/common/prom.c77
-rw-r--r--arch/mips/emma2rh/markeins/Makefile13
-rw-r--r--arch/mips/emma2rh/markeins/irq.c134
-rw-r--r--arch/mips/emma2rh/markeins/irq_markeins.c197
-rw-r--r--arch/mips/emma2rh/markeins/led.c60
-rw-r--r--arch/mips/emma2rh/markeins/platform.c170
-rw-r--r--arch/mips/emma2rh/markeins/setup.c182
-rw-r--r--arch/mips/galileo-boards/ev96100/setup.c2
-rw-r--r--arch/mips/gt64120/ev64120/setup.c2
-rw-r--r--arch/mips/gt64120/momenco_ocelot/setup.c2
-rw-r--r--arch/mips/gt64120/wrppmc/Makefile14
-rw-r--r--arch/mips/gt64120/wrppmc/int-handler.S59
-rw-r--r--arch/mips/gt64120/wrppmc/irq.c63
-rw-r--r--arch/mips/gt64120/wrppmc/pci.c53
-rw-r--r--arch/mips/gt64120/wrppmc/reset.c50
-rw-r--r--arch/mips/gt64120/wrppmc/setup.c173
-rw-r--r--arch/mips/gt64120/wrppmc/time.c57
-rw-r--r--arch/mips/ite-boards/generic/it8172_setup.c76
-rw-r--r--arch/mips/jazz/setup.c2
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c61
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/apm.c605
-rw-r--r--arch/mips/kernel/asm-offsets.c66
-rw-r--r--arch/mips/kernel/branch.c2
-rw-r--r--arch/mips/kernel/i8259.c4
-rw-r--r--arch/mips/kernel/irixsig.c2
-rw-r--r--arch/mips/kernel/ptrace.c26
-rw-r--r--arch/mips/kernel/ptrace32.c16
-rw-r--r--arch/mips/kernel/r4k_switch.S13
-rw-r--r--arch/mips/kernel/setup.c56
-rw-r--r--arch/mips/kernel/traps.c9
-rw-r--r--arch/mips/lasat/setup.c2
-rw-r--r--arch/mips/lib/Makefile3
-rw-r--r--arch/mips/lib/ashldi3.c29
-rw-r--r--arch/mips/lib/ashrdi3.c31
-rw-r--r--arch/mips/lib/libgcc.h26
-rw-r--r--arch/mips/lib/lshrdi3.c29
-rw-r--r--arch/mips/math-emu/cp1emu.c15
-rw-r--r--arch/mips/math-emu/ieee754.h2
-rw-r--r--arch/mips/math-emu/kernel_linkage.c24
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c2
-rw-r--r--arch/mips/mips-boards/generic/memory.c9
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c12
-rw-r--r--arch/mips/mips-boards/malta/malta_smp.c19
-rw-r--r--arch/mips/mips-boards/sead/sead_setup.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_setup.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_smp.c21
-rw-r--r--arch/mips/mm/tlb-r4k.c1
-rw-r--r--arch/mips/momentum/jaguar_atx/setup.c2
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c2
-rw-r--r--arch/mips/momentum/ocelot_c/setup.c2
-rw-r--r--arch/mips/momentum/ocelot_g/setup.c2
-rw-r--r--arch/mips/pci/Makefile7
-rw-r--r--arch/mips/pci/fixup-ddb5074.c21
-rw-r--r--arch/mips/pci/fixup-emma2rh.c102
-rw-r--r--arch/mips/pci/fixup-excite.c36
-rw-r--r--arch/mips/pci/fixup-wrppmc.c37
-rw-r--r--arch/mips/pci/ops-bridge.c306
-rw-r--r--arch/mips/pci/ops-ddb5074.c271
-rw-r--r--arch/mips/pci/ops-ddb5476.c286
-rw-r--r--arch/mips/pci/ops-emma2rh.c186
-rw-r--r--arch/mips/pci/ops-it8172.c34
-rw-r--r--arch/mips/pci/ops-sni.c12
-rw-r--r--arch/mips/pci/ops-titan.c25
-rw-r--r--arch/mips/pci/pci-ddb5074.c79
-rw-r--r--arch/mips/pci/pci-ddb5476.c93
-rw-r--r--arch/mips/pci/pci-ddb5477.c32
-rw-r--r--arch/mips/pci/pci-emma2rh.c90
-rw-r--r--arch/mips/pci/pci-excite.c149
-rw-r--r--arch/mips/pci/pci-ip27.c295
-rw-r--r--arch/mips/pci/pci-jmr3927.c16
-rw-r--r--arch/mips/pci/pci-ocelot.c8
-rw-r--r--arch/mips/pci/pci-yosemite.c10
-rw-r--r--arch/mips/pci/pci.c5
-rw-r--r--arch/mips/philips/pnx8550/common/pci.c16
-rw-r--r--arch/mips/philips/pnx8550/common/setup.c27
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c2
-rw-r--r--arch/mips/qemu/Makefile2
-rw-r--r--arch/mips/qemu/q-reset.c34
-rw-r--r--arch/mips/qemu/q-setup.c6
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c2
-rw-r--r--arch/mips/sgi-ip27/Kconfig38
-rw-r--r--arch/mips/sgi-ip27/ip27-init.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c61
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c2
-rw-r--r--arch/mips/sibyte/bcm1480/time.c17
-rw-r--r--arch/mips/sibyte/sb1250/irq.c8
-rw-r--r--arch/mips/sibyte/swarm/setup.c4
-rw-r--r--arch/mips/sni/Makefile1
-rw-r--r--arch/mips/sni/setup.c135
-rw-r--r--arch/mips/sni/sniprom.c158
-rw-r--r--arch/mips/tx4927/common/tx4927_setup.c2
-rw-r--r--arch/mips/tx4938/common/setup.c2
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/setup.c5
-rw-r--r--arch/mips/vr41xx/Kconfig7
-rw-r--r--arch/mips/vr41xx/common/init.c2
-rw-r--r--arch/powerpc/kernel/prom_init.c10
-rw-r--r--arch/powerpc/kernel/signal_32.c11
-rw-r--r--arch/powerpc/kernel/signal_64.c2
-rw-r--r--arch/powerpc/mm/hash_native_64.c4
-rw-r--r--arch/powerpc/platforms/cell/setup.c11
-rw-r--r--arch/powerpc/platforms/pseries/setup.c8
-rw-r--r--arch/sparc/kernel/smp.c11
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c124
-rw-r--r--arch/sparc64/kernel/smp.c35
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c1
-rw-r--r--arch/sparc64/kernel/traps.c11
-rw-r--r--arch/x86_64/kernel/io_apic.c30
-rw-r--r--block/as-iosched.c13
-rw-r--r--block/cfq-iosched.c21
-rw-r--r--block/deadline-iosched.c13
-rw-r--r--block/elevator.c55
-rw-r--r--block/noop-iosched.c7
-rw-r--r--drivers/Kconfig2
-rw-r--r--drivers/Makefile1
-rw-r--r--drivers/acpi/pci_link.c3
-rw-r--r--drivers/acpi/processor_perflib.c5
-rw-r--r--drivers/block/aoe/aoenet.c3
-rw-r--r--drivers/cdrom/cdrom.c6
-rw-r--r--drivers/char/Makefile2
-rw-r--r--drivers/char/agp/alpha-agp.c15
-rw-r--r--drivers/char/agp/generic.c4
-rw-r--r--drivers/char/agp/intel-agp.c2
-rw-r--r--drivers/char/agp/uninorth-agp.c4
-rw-r--r--drivers/char/n_tty.c4
-rw-r--r--drivers/connector/cn_queue.c2
-rw-r--r--drivers/cpufreq/cpufreq.c8
-rw-r--r--drivers/cpufreq/cpufreq_stats.c6
-rw-r--r--drivers/cpufreq/freq_table.c16
-rw-r--r--drivers/dma/Kconfig34
-rw-r--r--drivers/dma/Makefile3
-rw-r--r--drivers/dma/dmaengine.c408
-rw-r--r--drivers/dma/ioatdma.c840
-rw-r--r--drivers/dma/ioatdma.h125
-rw-r--r--drivers/dma/ioatdma_hw.h52
-rw-r--r--drivers/dma/ioatdma_io.h118
-rw-r--r--drivers/dma/ioatdma_registers.h126
-rw-r--r--drivers/dma/iovlock.c301
-rw-r--r--drivers/infiniband/Kconfig5
-rw-r--r--drivers/infiniband/core/Makefile11
-rw-r--r--drivers/infiniband/core/addr.c367
-rw-r--r--drivers/infiniband/core/cache.c30
-rw-r--r--drivers/infiniband/core/cm.c119
-rw-r--r--drivers/infiniband/core/cma.c1927
-rw-r--r--drivers/infiniband/core/fmr_pool.c30
-rw-r--r--drivers/infiniband/core/mad.c97
-rw-r--r--drivers/infiniband/core/mad_priv.h2
-rw-r--r--drivers/infiniband/core/sa_query.c31
-rw-r--r--drivers/infiniband/core/ucm.c183
-rw-r--r--drivers/infiniband/core/uverbs.h4
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c971
-rw-r--r--drivers/infiniband/core/uverbs_main.c35
-rw-r--r--drivers/infiniband/core/uverbs_marshall.c138
-rw-r--r--drivers/infiniband/core/verbs.c44
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mad.c42
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cmd.c23
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c12
-rw-r--r--drivers/infiniband/hw/mthca/mthca_eq.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mad.c14
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c33
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.h3
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c40
-rw-r--r--drivers/infiniband/hw/mthca/mthca_reset.c59
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c5
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h34
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c27
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c28
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c17
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c3
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c482
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.h33
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c4
-rw-r--r--drivers/message/fusion/mptspi.c2
-rw-r--r--drivers/message/i2o/exec-osm.c72
-rw-r--r--drivers/message/i2o/iop.c4
-rw-r--r--drivers/net/3c501.c2
-rw-r--r--drivers/net/3c503.c2
-rw-r--r--drivers/net/3c505.c2
-rw-r--r--drivers/net/3c507.c2
-rw-r--r--drivers/net/3c523.c2
-rw-r--r--drivers/net/3c527.c2
-rw-r--r--drivers/net/Kconfig5
-rw-r--r--drivers/net/au1000_eth.c1602
-rw-r--r--drivers/net/au1000_eth.h134
-rw-r--r--drivers/net/bnx2.c190
-rw-r--r--drivers/net/bnx2.h15
-rw-r--r--drivers/net/bnx2_fw.h5256
-rw-r--r--drivers/net/bonding/bond_main.c9
-rw-r--r--drivers/net/forcedeth.c1722
-rw-r--r--drivers/net/hamradio/6pack.c8
-rw-r--r--drivers/net/hamradio/mkiss.c8
-rw-r--r--drivers/net/hp-plus.c2
-rw-r--r--drivers/net/hp.c4
-rw-r--r--drivers/net/ifb.c10
-rw-r--r--drivers/net/irda/Kconfig15
-rw-r--r--drivers/net/irda/Makefile1
-rw-r--r--drivers/net/irda/ali-ircc.c106
-rw-r--r--drivers/net/irda/irda-usb.c327
-rw-r--r--drivers/net/irda/irda-usb.h10
-rw-r--r--drivers/net/irda/mcs7780.c1009
-rw-r--r--drivers/net/irda/mcs7780.h167
-rw-r--r--drivers/net/irda/stir4200.c38
-rw-r--r--drivers/net/irda/vlsi_ir.c2
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/natsemi.c4
-rw-r--r--drivers/net/ne.c2
-rw-r--r--drivers/net/ne2.c2
-rw-r--r--drivers/net/ppp_generic.c2
-rw-r--r--drivers/net/s2io.c48
-rw-r--r--drivers/net/sky2.c53
-rw-r--r--drivers/net/smc-ultra.c2
-rw-r--r--drivers/net/smc-ultra32.c2
-rw-r--r--drivers/net/smc9194.c7
-rw-r--r--drivers/net/sundance.c8
-rw-r--r--drivers/net/tg3.c226
-rw-r--r--drivers/net/tg3.h24
-rw-r--r--drivers/net/tulip/tulip_core.c8
-rw-r--r--drivers/net/tulip/winbond-840.c11
-rw-r--r--drivers/net/via-velocity.c10
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h100
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c33
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_leds.c4
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c221
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c9
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_pio.c44
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_pio.h13
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c38
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c107
-rw-r--r--drivers/net/wireless/ipw2200.c41
-rw-r--r--drivers/net/wireless/ipw2200.h1
-rw-r--r--drivers/net/wireless/orinoco.c4
-rw-r--r--drivers/pci/pci-driver.c13
-rw-r--r--drivers/pci/pci.c18
-rw-r--r--drivers/scsi/libata-core.c1
-rw-r--r--drivers/scsi/sata_mv.c3
-rw-r--r--drivers/usb/host/ohci-pxa27x.c3
-rw-r--r--drivers/video/Kconfig2
-rw-r--r--drivers/video/console/fbcon.c2
-rw-r--r--drivers/video/intelfb/intelfb.h16
-rw-r--r--drivers/video/intelfb/intelfbdrv.c85
-rw-r--r--drivers/video/intelfb/intelfbhw.c494
-rw-r--r--drivers/video/intelfb/intelfbhw.h25
-rw-r--r--fs/bio.c5
-rw-r--r--fs/debugfs/inode.c3
-rw-r--r--fs/locks.c2
-rw-r--r--include/asm-arm/arch-pxa/ohci.h2
-rw-r--r--include/asm-mips/addrspace.h35
-rw-r--r--include/asm-mips/apm.h65
-rw-r--r--include/asm-mips/asmmacro-32.h4
-rw-r--r--include/asm-mips/asmmacro-64.h19
-rw-r--r--include/asm-mips/bootinfo.h13
-rw-r--r--include/asm-mips/ddb5074.h11
-rw-r--r--include/asm-mips/ddb5xxx/ddb5074.h38
-rw-r--r--include/asm-mips/ddb5xxx/ddb5476.h157
-rw-r--r--include/asm-mips/ddb5xxx/ddb5xxx.h11
-rw-r--r--include/asm-mips/emma2rh/emma2rh.h330
-rw-r--r--include/asm-mips/emma2rh/markeins.h76
-rw-r--r--include/asm-mips/fpu.h3
-rw-r--r--include/asm-mips/fpu_emulator.h4
-rw-r--r--include/asm-mips/futex.h32
-rw-r--r--include/asm-mips/mach-ddb5074/mc146818rtc.h31
-rw-r--r--include/asm-mips/mach-dec/param.h18
-rw-r--r--include/asm-mips/mach-emma2rh/irq.h (renamed from include/asm-mips/mach-mips/param.h)8
-rw-r--r--include/asm-mips/mach-excite/cpu-feature-overrides.h40
-rw-r--r--include/asm-mips/mach-excite/excite.h155
-rw-r--r--include/asm-mips/mach-excite/excite_nandflash.h7
-rw-r--r--include/asm-mips/mach-excite/rm9k_eth.h23
-rw-r--r--include/asm-mips/mach-excite/rm9k_wdt.h12
-rw-r--r--include/asm-mips/mach-excite/rm9k_xicap.h16
-rw-r--r--include/asm-mips/mach-generic/param.h13
-rw-r--r--include/asm-mips/mach-ip22/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-ip27/cpu-feature-overrides.h3
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-jazz/param.h16
-rw-r--r--include/asm-mips/mach-mips/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-qemu/param.h13
-rw-r--r--include/asm-mips/mach-rm200/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-sim/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-wrppmc/mach-gt64120.h84
-rw-r--r--include/asm-mips/mipsregs.h4
-rw-r--r--include/asm-mips/mmzone.h11
-rw-r--r--include/asm-mips/page.h19
-rw-r--r--include/asm-mips/param.h2
-rw-r--r--include/asm-mips/pci/bridge.h3
-rw-r--r--include/asm-mips/pgtable.h2
-rw-r--r--include/asm-mips/processor.h16
-rw-r--r--include/asm-mips/qemu.h6
-rw-r--r--include/asm-mips/rm9k-ocd.h56
-rw-r--r--include/asm-mips/sn/addrs.h27
-rw-r--r--include/asm-mips/sn/fru.h (renamed from include/asm-mips/sn/sn0/sn0_fru.h)8
-rw-r--r--include/asm-mips/sn/klconfig.h89
-rw-r--r--include/asm-mips/sn/kldir.h34
-rw-r--r--include/asm-mips/sn/sn0/addrs.h87
-rw-r--r--include/asm-mips/sn/sn0/arch.h17
-rw-r--r--include/asm-mips/sn/sn0/hub.h4
-rw-r--r--include/asm-mips/sn/sn0/hubio.h16
-rw-r--r--include/asm-mips/sn/sn0/hubmd.h2
-rw-r--r--include/asm-mips/sn/sn0/hubpi.h18
-rw-r--r--include/asm-mips/sn/sn0/ip27.h9
-rw-r--r--include/asm-mips/sni.h7
-rw-r--r--include/asm-mips/war.h5
-rw-r--r--include/asm-powerpc/cputable.h2
-rw-r--r--include/asm-s390/futex.h15
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/dmaengine.h359
-rw-r--r--include/linux/elevator.h2
-rw-r--r--include/linux/i2o.h5
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/mempolicy.h1
-rw-r--r--include/linux/netdevice.h45
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h4
-rw-r--r--include/linux/netfilter/xt_CONNSECMARK.h13
-rw-r--r--include/linux/netfilter/xt_SECMARK.h26
-rw-r--r--include/linux/netfilter/xt_quota.h16
-rw-r--r--include/linux/netfilter/xt_statistic.h32
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h7
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sip.h44
-rw-r--r--include/linux/pci-acpi.h2
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/pfkeyv2.h2
-rw-r--r--include/linux/security.h40
-rw-r--r--include/linux/selinux.h32
-rw-r--r--include/linux/skbuff.h74
-rw-r--r--include/linux/sysctl.h4
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/xfrm.h4
-rw-r--r--include/net/ieee80211.h5
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/llc_if.h17
-rw-r--r--include/net/netdma.h44
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_conntrack_compat.h26
-rw-r--r--include/net/raw.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/structs.h3
-rw-r--r--include/net/sock.h20
-rw-r--r--include/net/tcp.h15
-rw-r--r--include/net/xfrm.h26
-rw-r--r--include/rdma/ib_addr.h114
-rw-r--r--include/rdma/ib_cache.h13
-rw-r--r--include/rdma/ib_cm.h26
-rw-r--r--include/rdma/ib_marshall.h50
-rw-r--r--include/rdma/ib_sa.h7
-rw-r--r--include/rdma/ib_smi.h36
-rw-r--r--include/rdma/ib_user_cm.h86
-rw-r--r--include/rdma/ib_user_sa.h60
-rw-r--r--include/rdma/ib_user_verbs.h80
-rw-r--r--include/rdma/ib_verbs.h22
-rw-r--r--include/rdma/rdma_cm.h256
-rw-r--r--include/rdma/rdma_cm_ib.h47
-rw-r--r--include/scsi/srp.h5
-rw-r--r--kernel/exit.c8
-rw-r--r--kernel/posix-cpu-timers.c48
-rw-r--r--kernel/power/main.c2
-rw-r--r--kernel/printk.c28
-rw-r--r--mm/shmem.c2
-rw-r--r--mm/vmscan.c2
-rw-r--r--net/Kconfig22
-rw-r--r--net/atm/clip.c4
-rw-r--r--net/bridge/Makefile2
-rw-r--r--net/bridge/br.c28
-rw-r--r--net/bridge/br_device.c6
-rw-r--r--net/bridge/br_forward.c12
-rw-r--r--net/bridge/br_if.c13
-rw-r--r--net/bridge/br_netfilter.c14
-rw-r--r--net/bridge/br_netlink.c199
-rw-r--r--net/bridge/br_notify.c2
-rw-r--r--net/bridge/br_private.h12
-rw-r--r--net/bridge/br_stp_if.c4
-rw-r--r--net/core/Makefile1
-rw-r--r--net/core/dev.c185
-rw-r--r--net/core/dev_mcast.c28
-rw-r--r--net/core/ethtool.c9
-rw-r--r--net/core/netpoll.c9
-rw-r--r--net/core/pktgen.c4
-rw-r--r--net/core/skbuff.c10
-rw-r--r--net/core/sock.c6
-rw-r--r--net/core/user_dma.c131
-rw-r--r--net/dccp/ackvec.c1
-rw-r--r--net/dccp/proto.c4
-rw-r--r--net/decnet/dn_nsp_in.c3
-rw-r--r--net/decnet/dn_route.c3
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_wx.c2
-rw-r--r--net/ipv4/Kconfig50
-rw-r--r--net/ipv4/Makefile6
-rw-r--r--net/ipv4/ah4.c15
-rw-r--r--net/ipv4/esp4.c18
-rw-r--r--net/ipv4/fib_frontend.c1
-rw-r--r--net/ipv4/icmp.c5
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/ip_forward.c1
-rw-r--r--net/ipv4/ip_output.c3
-rw-r--r--net/ipv4/ipcomp.c34
-rw-r--r--net/ipv4/netfilter/Kconfig40
-rw-r--r--net/ipv4/netfilter/Makefile2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_amanda.c143
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c9
-rw-r--r--net/ipv4/netfilter/ip_conntrack_ftp.c77
-rw-r--r--net/ipv4/netfilter/ip_conntrack_helper_h323.c111
-rw-r--r--net/ipv4/netfilter/ip_conntrack_helper_h323_types.c6
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netlink.c85
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_gre.c6
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_icmp.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_tcp.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_udp.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_sip.c471
-rw-r--r--net/ipv4/netfilter/ip_conntrack_standalone.c18
-rw-r--r--net/ipv4/netfilter/ip_nat_helper_h323.c77
-rw-r--r--net/ipv4/netfilter/ip_nat_sip.c249
-rw-r--r--net/ipv4/netfilter/ip_nat_snmp_basic.c2
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c20
-rw-r--r--net/ipv4/netfilter/ipt_REJECT.c1
-rw-r--r--net/ipv4/netfilter/ipt_hashlimit.c73
-rw-r--r--net/ipv4/netfilter/ipt_recent.c1276
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c2
-rw-r--r--net/ipv4/netfilter/nf_conntrack_proto_icmp.c2
-rw-r--r--net/ipv4/raw.c2
-rw-r--r--net/ipv4/sysctl_net_ipv4.c26
-rw-r--r--net/ipv4/tcp.c127
-rw-r--r--net/ipv4/tcp_bic.c7
-rw-r--r--net/ipv4/tcp_compound.c448
-rw-r--r--net/ipv4/tcp_cong.c6
-rw-r--r--net/ipv4/tcp_cubic.c6
-rw-r--r--net/ipv4/tcp_highspeed.c24
-rw-r--r--net/ipv4/tcp_htcp.c9
-rw-r--r--net/ipv4/tcp_input.c93
-rw-r--r--net/ipv4/tcp_ipv4.c18
-rw-r--r--net/ipv4/tcp_lp.c338
-rw-r--r--net/ipv4/tcp_output.c6
-rw-r--r--net/ipv4/tcp_probe.c181
-rw-r--r--net/ipv4/tcp_veno.c231
-rw-r--r--net/ipv4/tcp_westwood.c80
-rw-r--r--net/ipv4/xfrm4_input.c28
-rw-r--r--net/ipv4/xfrm4_mode_transport.c83
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c125
-rw-r--r--net/ipv4/xfrm4_output.c61
-rw-r--r--net/ipv4/xfrm4_policy.c6
-rw-r--r--net/ipv4/xfrm4_state.c1
-rw-r--r--net/ipv6/Kconfig20
-rw-r--r--net/ipv6/Makefile2
-rw-r--r--net/ipv6/addrconf.c28
-rw-r--r--net/ipv6/ah6.c10
-rw-r--r--net/ipv6/esp6.c20
-rw-r--r--net/ipv6/ip6_output.c3
-rw-r--r--net/ipv6/ipcomp6.c38
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c10
-rw-r--r--net/ipv6/tcp_ipv6.c12
-rw-r--r--net/ipv6/xfrm6_input.c29
-rw-r--r--net/ipv6/xfrm6_mode_transport.c88
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c121
-rw-r--r--net/ipv6/xfrm6_output.c63
-rw-r--r--net/ipv6/xfrm6_policy.c6
-rw-r--r--net/ipv6/xfrm6_state.c1
-rw-r--r--net/ipx/ipx_route.c2
-rw-r--r--net/irda/irlmp.c6
-rw-r--r--net/key/af_key.c17
-rw-r--r--net/llc/af_llc.c6
-rw-r--r--net/llc/llc_if.c2
-rw-r--r--net/llc/llc_input.c10
-rw-r--r--net/llc/llc_sap.c59
-rw-r--r--net/netfilter/Kconfig48
-rw-r--r--net/netfilter/Makefile4
-rw-r--r--net/netfilter/nf_conntrack_core.c9
-rw-r--r--net/netfilter/nf_conntrack_ftp.c77
-rw-r--r--net/netfilter/nf_conntrack_netlink.c85
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c5
-rw-r--r--net/netfilter/nf_conntrack_proto_udp.c3
-rw-r--r--net/netfilter/nf_conntrack_standalone.c16
-rw-r--r--net/netfilter/xt_CONNSECMARK.c155
-rw-r--r--net/netfilter/xt_SECMARK.c156
-rw-r--r--net/netfilter/xt_connmark.c2
-rw-r--r--net/netfilter/xt_dccp.c3
-rw-r--r--net/netfilter/xt_mark.c2
-rw-r--r--net/netfilter/xt_multiport.c7
-rw-r--r--net/netfilter/xt_quota.c96
-rw-r--r--net/netfilter/xt_sctp.c4
-rw-r--r--net/netfilter/xt_statistic.c112
-rw-r--r--net/netfilter/xt_string.c2
-rw-r--r--net/sched/sch_generic.c28
-rw-r--r--net/sched/sch_teql.c9
-rw-r--r--net/sctp/input.c6
-rw-r--r--net/sctp/ipv6.c6
-rw-r--r--net/sctp/output.c48
-rw-r--r--net/sctp/outqueue.c1
-rw-r--r--net/sctp/protocol.c8
-rw-r--r--net/sctp/sm_statefuns.c10
-rw-r--r--net/sctp/socket.c28
-rw-r--r--net/sctp/ulpevent.c30
-rw-r--r--net/xfrm/xfrm_policy.c141
-rw-r--r--net/xfrm/xfrm_state.c15
-rw-r--r--net/xfrm/xfrm_user.c19
-rw-r--r--security/dummy.c12
-rw-r--r--security/selinux/Kconfig29
-rw-r--r--security/selinux/exports.c22
-rw-r--r--security/selinux/hooks.c246
-rw-r--r--security/selinux/include/av_inherit.h1
-rw-r--r--security/selinux/include/av_perm_to_string.h3
-rw-r--r--security/selinux/include/av_permissions.h26
-rw-r--r--security/selinux/include/class_to_string.h2
-rw-r--r--security/selinux/include/flask.h2
-rw-r--r--security/selinux/include/xfrm.h4
-rw-r--r--security/selinux/selinuxfs.c66
-rw-r--r--security/selinux/xfrm.c51
-rw-r--r--sound/oss/Kconfig4
628 files changed, 30492 insertions, 13724 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 43ab119963d5..f50cf8fac3f0 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -212,15 +212,6 @@ Who: Greg Kroah-Hartman <gregkh@suse.de>
212 212
213--------------------------- 213---------------------------
214 214
215What: Support for NEC DDB5074 and DDB5476 evaluation boards.
216When: June 2006
217Why: Board specific code doesn't build anymore since ~2.6.0 and no
218 users have complained indicating there is no more need for these
219 boards. This should really be considered a last call.
220Who: Ralf Baechle <ralf@linux-mips.org>
221
222---------------------------
223
224What: USB driver API moves to EXPORT_SYMBOL_GPL 215What: USB driver API moves to EXPORT_SYMBOL_GPL
225When: Febuary 2008 216When: Febuary 2008
226Files: include/linux/usb.h, drivers/usb/core/driver.c 217Files: include/linux/usb.h, drivers/usb/core/driver.c
diff --git a/Documentation/infiniband/ipoib.txt b/Documentation/infiniband/ipoib.txt
index 5c5a4ccce76a..187035560d7f 100644
--- a/Documentation/infiniband/ipoib.txt
+++ b/Documentation/infiniband/ipoib.txt
@@ -1,10 +1,10 @@
1IP OVER INFINIBAND 1IP OVER INFINIBAND
2 2
3 The ib_ipoib driver is an implementation of the IP over InfiniBand 3 The ib_ipoib driver is an implementation of the IP over InfiniBand
4 protocol as specified by the latest Internet-Drafts issued by the 4 protocol as specified by RFC 4391 and 4392, issued by the IETF ipoib
5 IETF ipoib working group. It is a "native" implementation in the 5 working group. It is a "native" implementation in the sense of
6 sense of setting the interface type to ARPHRD_INFINIBAND and the 6 setting the interface type to ARPHRD_INFINIBAND and the hardware
7 hardware address length to 20 (earlier proprietary implementations 7 address length to 20 (earlier proprietary implementations
8 masqueraded to the kernel as ethernet interfaces). 8 masqueraded to the kernel as ethernet interfaces).
9 9
10Partitions and P_Keys 10Partitions and P_Keys
@@ -53,3 +53,7 @@ References
53 53
54 IETF IP over InfiniBand (ipoib) Working Group 54 IETF IP over InfiniBand (ipoib) Working Group
55 http://ietf.org/html.charters/ipoib-charter.html 55 http://ietf.org/html.charters/ipoib-charter.html
56 Transmission of IP over InfiniBand (IPoIB) (RFC 4391)
57 http://ietf.org/rfc/rfc4391.txt
58 IP over InfiniBand (IPoIB) Architecture (RFC 4392)
59 http://ietf.org/rfc/rfc4392.txt
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index b3a6187e5305..a9d3a1794b23 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1402,6 +1402,15 @@ running once the system is up.
1402 If enabled at boot time, /selinux/disable can be used 1402 If enabled at boot time, /selinux/disable can be used
1403 later to disable prior to initial policy load. 1403 later to disable prior to initial policy load.
1404 1404
1405 selinux_compat_net =
1406 [SELINUX] Set initial selinux_compat_net flag value.
1407 Format: { "0" | "1" }
1408 0 -- use new secmark-based packet controls
1409 1 -- use legacy packet controls
1410 Default value is 0 (preferred).
1411 Value can be changed at runtime via
1412 /selinux/compat_net.
1413
1405 serialnumber [BUGS=IA-32] 1414 serialnumber [BUGS=IA-32]
1406 1415
1407 sg_def_reserved_size= [SCSI] 1416 sg_def_reserved_size= [SCSI]
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index c61d8b876fdb..4710845dbac4 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -19,6 +19,7 @@ Contents:
19 - Control dependencies. 19 - Control dependencies.
20 - SMP barrier pairing. 20 - SMP barrier pairing.
21 - Examples of memory barrier sequences. 21 - Examples of memory barrier sequences.
22 - Read memory barriers vs load speculation.
22 23
23 (*) Explicit kernel barriers. 24 (*) Explicit kernel barriers.
24 25
@@ -248,7 +249,7 @@ And there are a number of things that _must_ or _must_not_ be assumed:
248 we may get either of: 249 we may get either of:
249 250
250 STORE *A = X; Y = LOAD *A; 251 STORE *A = X; Y = LOAD *A;
251 STORE *A = Y; 252 STORE *A = Y = X;
252 253
253 254
254========================= 255=========================
@@ -344,9 +345,12 @@ Memory barriers come in four basic varieties:
344 345
345 (4) General memory barriers. 346 (4) General memory barriers.
346 347
347 A general memory barrier is a combination of both a read memory barrier 348 A general memory barrier gives a guarantee that all the LOAD and STORE
348 and a write memory barrier. It is a partial ordering over both loads and 349 operations specified before the barrier will appear to happen before all
349 stores. 350 the LOAD and STORE operations specified after the barrier with respect to
351 the other components of the system.
352
353 A general memory barrier is a partial ordering over both loads and stores.
350 354
351 General memory barriers imply both read and write memory barriers, and so 355 General memory barriers imply both read and write memory barriers, and so
352 can substitute for either. 356 can substitute for either.
@@ -546,9 +550,9 @@ write barrier, though, again, a general barrier is viable:
546 =============== =============== 550 =============== ===============
547 a = 1; 551 a = 1;
548 <write barrier> 552 <write barrier>
549 b = 2; x = a; 553 b = 2; x = b;
550 <read barrier> 554 <read barrier>
551 y = b; 555 y = a;
552 556
553Or: 557Or:
554 558
@@ -563,6 +567,18 @@ Or:
563Basically, the read barrier always has to be there, even though it can be of 567Basically, the read barrier always has to be there, even though it can be of
564the "weaker" type. 568the "weaker" type.
565 569
570[!] Note that the stores before the write barrier would normally be expected to
571match the loads after the read barrier or data dependency barrier, and vice
572versa:
573
574 CPU 1 CPU 2
575 =============== ===============
576 a = 1; }---- --->{ v = c
577 b = 2; } \ / { w = d
578 <write barrier> \ <read barrier>
579 c = 3; } / \ { x = a;
580 d = 4; }---- --->{ y = b;
581
566 582
567EXAMPLES OF MEMORY BARRIER SEQUENCES 583EXAMPLES OF MEMORY BARRIER SEQUENCES
568------------------------------------ 584------------------------------------
@@ -600,8 +616,8 @@ STORE B, STORE C } all occuring before the unordered set of { STORE D, STORE E
600 | | +------+ 616 | | +------+
601 +-------+ : : 617 +-------+ : :
602 | 618 |
603 | Sequence in which stores committed to memory system 619 | Sequence in which stores are committed to the
604 | by CPU 1 620 | memory system by CPU 1
605 V 621 V
606 622
607 623
@@ -683,14 +699,12 @@ then the following will occur:
683 | : : | | 699 | : : | |
684 | : : | CPU 2 | 700 | : : | CPU 2 |
685 | +-------+ | | 701 | +-------+ | |
686 \ | X->9 |------>| | 702 | | X->9 |------>| |
687 \ +-------+ | | 703 | +-------+ | |
688 ----->| B->2 | | | 704 Makes sure all effects ---> \ ddddddddddddddddd | |
689 +-------+ | | 705 prior to the store of C \ +-------+ | |
690 Makes sure all effects ---> ddddddddddddddddd | | 706 are perceptible to ----->| B->2 |------>| |
691 prior to the store of C +-------+ | | 707 subsequent loads +-------+ | |
692 are perceptible to | B->2 |------>| |
693 successive loads +-------+ | |
694 : : +-------+ 708 : : +-------+
695 709
696 710
@@ -699,73 +713,239 @@ following sequence of events:
699 713
700 CPU 1 CPU 2 714 CPU 1 CPU 2
701 ======================= ======================= 715 ======================= =======================
716 { A = 0, B = 9 }
702 STORE A=1 717 STORE A=1
703 STORE B=2
704 STORE C=3
705 <write barrier> 718 <write barrier>
706 STORE D=4 719 STORE B=2
707 STORE E=5
708 LOAD A
709 LOAD B 720 LOAD B
710 LOAD C 721 LOAD A
711 LOAD D
712 LOAD E
713 722
714Without intervention, CPU 2 may then choose to perceive the events on CPU 1 in 723Without intervention, CPU 2 may then choose to perceive the events on CPU 1 in
715some effectively random order, despite the write barrier issued by CPU 1: 724some effectively random order, despite the write barrier issued by CPU 1:
716 725
717 +-------+ : : 726 +-------+ : : : :
718 | | +------+ 727 | | +------+ +-------+
719 | |------>| C=3 | } 728 | |------>| A=1 |------ --->| A->0 |
720 | | : +------+ } 729 | | +------+ \ +-------+
721 | | : | A=1 | } 730 | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 |
722 | | : +------+ } 731 | | +------+ | +-------+
723 | CPU 1 | : | B=2 | }--- 732 | |------>| B=2 |--- | : :
724 | | +------+ } \ 733 | | +------+ \ | : : +-------+
725 | | wwwwwwwwwwwww} \ 734 +-------+ : : \ | +-------+ | |
726 | | +------+ } \ : : +-------+ 735 ---------->| B->2 |------>| |
727 | | : | E=5 | } \ +-------+ | | 736 | +-------+ | CPU 2 |
728 | | : +------+ } \ { | C->3 |------>| | 737 | | A->0 |------>| |
729 | |------>| D=4 | } \ { +-------+ : | | 738 | +-------+ | |
730 | | +------+ \ { | E->5 | : | | 739 | : : +-------+
731 +-------+ : : \ { +-------+ : | | 740 \ : :
732 Transfer -->{ | A->1 | : | CPU 2 | 741 \ +-------+
733 from CPU 1 { +-------+ : | | 742 ---->| A->1 |
734 to CPU 2 { | D->4 | : | | 743 +-------+
735 { +-------+ : | | 744 : :
736 { | B->2 |------>| |
737 +-------+ | |
738 : : +-------+
739
740
741If, however, a read barrier were to be placed between the load of C and the
742load of D on CPU 2, then the partial ordering imposed by CPU 1 will be
743perceived correctly by CPU 2.
744 745
745 +-------+ : : 746
746 | | +------+ 747If, however, a read barrier were to be placed between the load of E and the
747 | |------>| C=3 | } 748load of A on CPU 2:
748 | | : +------+ } 749
749 | | : | A=1 | }--- 750 CPU 1 CPU 2
750 | | : +------+ } \ 751 ======================= =======================
751 | CPU 1 | : | B=2 | } \ 752 { A = 0, B = 9 }
752 | | +------+ \ 753 STORE A=1
753 | | wwwwwwwwwwwwwwww \ 754 <write barrier>
754 | | +------+ \ : : +-------+ 755 STORE B=2
755 | | : | E=5 | } \ +-------+ | | 756 LOAD B
756 | | : +------+ }--- \ { | C->3 |------>| | 757 <read barrier>
757 | |------>| D=4 | } \ \ { +-------+ : | | 758 LOAD A
758 | | +------+ \ -->{ | B->2 | : | | 759
759 +-------+ : : \ { +-------+ : | | 760then the partial ordering imposed by CPU 1 will be perceived correctly by CPU
760 \ { | A->1 | : | CPU 2 | 7612:
761 \ +-------+ | | 762
762 At this point the read ----> \ rrrrrrrrrrrrrrrrr | | 763 +-------+ : : : :
763 barrier causes all effects \ +-------+ | | 764 | | +------+ +-------+
764 prior to the storage of C \ { | E->5 | : | | 765 | |------>| A=1 |------ --->| A->0 |
765 to be perceptible to CPU 2 -->{ +-------+ : | | 766 | | +------+ \ +-------+
766 { | D->4 |------>| | 767 | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 |
767 +-------+ | | 768 | | +------+ | +-------+
768 : : +-------+ 769 | |------>| B=2 |--- | : :
770 | | +------+ \ | : : +-------+
771 +-------+ : : \ | +-------+ | |
772 ---------->| B->2 |------>| |
773 | +-------+ | CPU 2 |
774 | : : | |
775 | : : | |
776 At this point the read ----> \ rrrrrrrrrrrrrrrrr | |
777 barrier causes all effects \ +-------+ | |
778 prior to the storage of B ---->| A->1 |------>| |
779 to be perceptible to CPU 2 +-------+ | |
780 : : +-------+
781
782
783To illustrate this more completely, consider what could happen if the code
784contained a load of A either side of the read barrier:
785
786 CPU 1 CPU 2
787 ======================= =======================
788 { A = 0, B = 9 }
789 STORE A=1
790 <write barrier>
791 STORE B=2
792 LOAD B
793 LOAD A [first load of A]
794 <read barrier>
795 LOAD A [second load of A]
796
797Even though the two loads of A both occur after the load of B, they may both
798come up with different values:
799
800 +-------+ : : : :
801 | | +------+ +-------+
802 | |------>| A=1 |------ --->| A->0 |
803 | | +------+ \ +-------+
804 | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 |
805 | | +------+ | +-------+
806 | |------>| B=2 |--- | : :
807 | | +------+ \ | : : +-------+
808 +-------+ : : \ | +-------+ | |
809 ---------->| B->2 |------>| |
810 | +-------+ | CPU 2 |
811 | : : | |
812 | : : | |
813 | +-------+ | |
814 | | A->0 |------>| 1st |
815 | +-------+ | |
816 At this point the read ----> \ rrrrrrrrrrrrrrrrr | |
817 barrier causes all effects \ +-------+ | |
818 prior to the storage of B ---->| A->1 |------>| 2nd |
819 to be perceptible to CPU 2 +-------+ | |
820 : : +-------+
821
822
823But it may be that the update to A from CPU 1 becomes perceptible to CPU 2
824before the read barrier completes anyway:
825
826 +-------+ : : : :
827 | | +------+ +-------+
828 | |------>| A=1 |------ --->| A->0 |
829 | | +------+ \ +-------+
830 | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 |
831 | | +------+ | +-------+
832 | |------>| B=2 |--- | : :
833 | | +------+ \ | : : +-------+
834 +-------+ : : \ | +-------+ | |
835 ---------->| B->2 |------>| |
836 | +-------+ | CPU 2 |
837 | : : | |
838 \ : : | |
839 \ +-------+ | |
840 ---->| A->1 |------>| 1st |
841 +-------+ | |
842 rrrrrrrrrrrrrrrrr | |
843 +-------+ | |
844 | A->1 |------>| 2nd |
845 +-------+ | |
846 : : +-------+
847
848
849The guarantee is that the second load will always come up with A == 1 if the
850load of B came up with B == 2. No such guarantee exists for the first load of
851A; that may come up with either A == 0 or A == 1.
852
853
854READ MEMORY BARRIERS VS LOAD SPECULATION
855----------------------------------------
856
857Many CPUs speculate with loads: that is they see that they will need to load an
858item from memory, and they find a time where they're not using the bus for any
859other loads, and so do the load in advance - even though they haven't actually
860got to that point in the instruction execution flow yet. This permits the
861actual load instruction to potentially complete immediately because the CPU
862already has the value to hand.
863
864It may turn out that the CPU didn't actually need the value - perhaps because a
865branch circumvented the load - in which case it can discard the value or just
866cache it for later use.
867
868Consider:
869
870 CPU 1 CPU 2
871 ======================= =======================
872 LOAD B
873 DIVIDE } Divide instructions generally
874 DIVIDE } take a long time to perform
875 LOAD A
876
877Which might appear as this:
878
879 : : +-------+
880 +-------+ | |
881 --->| B->2 |------>| |
882 +-------+ | CPU 2 |
883 : :DIVIDE | |
884 +-------+ | |
885 The CPU being busy doing a ---> --->| A->0 |~~~~ | |
886 division speculates on the +-------+ ~ | |
887 LOAD of A : : ~ | |
888 : :DIVIDE | |
889 : : ~ | |
890 Once the divisions are complete --> : : ~-->| |
891 the CPU can then perform the : : | |
892 LOAD with immediate effect : : +-------+
893
894
895Placing a read barrier or a data dependency barrier just before the second
896load:
897
898 CPU 1 CPU 2
899 ======================= =======================
900 LOAD B
901 DIVIDE
902 DIVIDE
903 <read barrier>
904 LOAD A
905
906will force any value speculatively obtained to be reconsidered to an extent
907dependent on the type of barrier used. If there was no change made to the
908speculated memory location, then the speculated value will just be used:
909
910 : : +-------+
911 +-------+ | |
912 --->| B->2 |------>| |
913 +-------+ | CPU 2 |
914 : :DIVIDE | |
915 +-------+ | |
916 The CPU being busy doing a ---> --->| A->0 |~~~~ | |
917 division speculates on the +-------+ ~ | |
918 LOAD of A : : ~ | |
919 : :DIVIDE | |
920 : : ~ | |
921 : : ~ | |
922 rrrrrrrrrrrrrrrr~ | |
923 : : ~ | |
924 : : ~-->| |
925 : : | |
926 : : +-------+
927
928
929but if there was an update or an invalidation from another CPU pending, then
930the speculation will be cancelled and the value reloaded:
931
932 : : +-------+
933 +-------+ | |
934 --->| B->2 |------>| |
935 +-------+ | CPU 2 |
936 : :DIVIDE | |
937 +-------+ | |
938 The CPU being busy doing a ---> --->| A->0 |~~~~ | |
939 division speculates on the +-------+ ~ | |
940 LOAD of A : : ~ | |
941 : :DIVIDE | |
942 : : ~ | |
943 : : ~ | |
944 rrrrrrrrrrrrrrrrr | |
945 +-------+ | |
946 The speculation is discarded ---> --->| A->1 |------>| |
947 and an updated value is +-------+ | |
948 retrieved : : +-------+
769 949
770 950
771======================== 951========================
@@ -901,7 +1081,7 @@ IMPLICIT KERNEL MEMORY BARRIERS
901=============================== 1081===============================
902 1082
903Some of the other functions in the linux kernel imply memory barriers, amongst 1083Some of the other functions in the linux kernel imply memory barriers, amongst
904which are locking, scheduling and memory allocation functions. 1084which are locking and scheduling functions.
905 1085
906This specification is a _minimum_ guarantee; any particular architecture may 1086This specification is a _minimum_ guarantee; any particular architecture may
907provide more substantial guarantees, but these may not be relied upon outside 1087provide more substantial guarantees, but these may not be relied upon outside
@@ -966,6 +1146,20 @@ equivalent to a full barrier, but a LOCK followed by an UNLOCK is not.
966 barriers is that the effects instructions outside of a critical section may 1146 barriers is that the effects instructions outside of a critical section may
967 seep into the inside of the critical section. 1147 seep into the inside of the critical section.
968 1148
1149A LOCK followed by an UNLOCK may not be assumed to be full memory barrier
1150because it is possible for an access preceding the LOCK to happen after the
1151LOCK, and an access following the UNLOCK to happen before the UNLOCK, and the
1152two accesses can themselves then cross:
1153
1154 *A = a;
1155 LOCK
1156 UNLOCK
1157 *B = b;
1158
1159may occur as:
1160
1161 LOCK, STORE *B, STORE *A, UNLOCK
1162
969Locks and semaphores may not provide any guarantee of ordering on UP compiled 1163Locks and semaphores may not provide any guarantee of ordering on UP compiled
970systems, and so cannot be counted on in such a situation to actually achieve 1164systems, and so cannot be counted on in such a situation to actually achieve
971anything at all - especially with respect to I/O accesses - unless combined 1165anything at all - especially with respect to I/O accesses - unless combined
@@ -1016,8 +1210,6 @@ Other functions that imply barriers:
1016 1210
1017 (*) schedule() and similar imply full memory barriers. 1211 (*) schedule() and similar imply full memory barriers.
1018 1212
1019 (*) Memory allocation and release functions imply full memory barriers.
1020
1021 1213
1022================================= 1214=================================
1023INTER-CPU LOCKING BARRIER EFFECTS 1215INTER-CPU LOCKING BARRIER EFFECTS
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index f12007b80a46..d46338af6002 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -362,6 +362,13 @@ tcp_workaround_signed_windows - BOOLEAN
362 not receive a window scaling option from them. 362 not receive a window scaling option from them.
363 Default: 0 363 Default: 0
364 364
365tcp_slow_start_after_idle - BOOLEAN
366 If set, provide RFC2861 behavior and time out the congestion
367 window after an idle period. An idle period is defined at
368 the current RTO. If unset, the congestion window will not
369 be timed out after an idle period.
370 Default: 1
371
365IP Variables: 372IP Variables:
366 373
367ip_local_port_range - 2 INTEGERS 374ip_local_port_range - 2 INTEGERS
diff --git a/Documentation/networking/netdevices.txt b/Documentation/networking/netdevices.txt
index 3c0a5ba614d7..847cedb238f6 100644
--- a/Documentation/networking/netdevices.txt
+++ b/Documentation/networking/netdevices.txt
@@ -42,9 +42,9 @@ dev->get_stats:
42 Context: nominally process, but don't sleep inside an rwlock 42 Context: nominally process, but don't sleep inside an rwlock
43 43
44dev->hard_start_xmit: 44dev->hard_start_xmit:
45 Synchronization: dev->xmit_lock spinlock. 45 Synchronization: netif_tx_lock spinlock.
46 When the driver sets NETIF_F_LLTX in dev->features this will be 46 When the driver sets NETIF_F_LLTX in dev->features this will be
47 called without holding xmit_lock. In this case the driver 47 called without holding netif_tx_lock. In this case the driver
48 has to lock by itself when needed. It is recommended to use a try lock 48 has to lock by itself when needed. It is recommended to use a try lock
49 for this and return -1 when the spin lock fails. 49 for this and return -1 when the spin lock fails.
50 The locking there should also properly protect against 50 The locking there should also properly protect against
@@ -62,12 +62,12 @@ dev->hard_start_xmit:
62 Only valid when NETIF_F_LLTX is set. 62 Only valid when NETIF_F_LLTX is set.
63 63
64dev->tx_timeout: 64dev->tx_timeout:
65 Synchronization: dev->xmit_lock spinlock. 65 Synchronization: netif_tx_lock spinlock.
66 Context: BHs disabled 66 Context: BHs disabled
67 Notes: netif_queue_stopped() is guaranteed true 67 Notes: netif_queue_stopped() is guaranteed true
68 68
69dev->set_multicast_list: 69dev->set_multicast_list:
70 Synchronization: dev->xmit_lock spinlock. 70 Synchronization: netif_tx_lock spinlock.
71 Context: BHs disabled 71 Context: BHs disabled
72 72
73dev->poll: 73dev->poll:
diff --git a/Makefile b/Makefile
index a3a7baad8555..1700d3f6ea22 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 17 3SUBLEVEL = 17
4EXTRAVERSION =-rc6 4EXTRAVERSION =
5NAME=Crazed Snow-Weasel 5NAME=Crazed Snow-Weasel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 8290b69da202..213c7850d5fb 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -453,7 +453,7 @@ config ALPHA_IRONGATE
453 453
454config GENERIC_HWEIGHT 454config GENERIC_HWEIGHT
455 bool 455 bool
456 default y if !ALPHA_EV6 && !ALPHA_EV67 456 default y if !ALPHA_EV67
457 457
458config ALPHA_AVANTI 458config ALPHA_AVANTI
459 bool 459 bool
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 9be01b0c3f48..e24566b88a78 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -111,21 +111,21 @@ static void __init ts72xx_map_io(void)
111 } 111 }
112} 112}
113 113
114static unsigned char ts72xx_rtc_readb(unsigned long addr) 114static unsigned char ts72xx_rtc_readbyte(unsigned long addr)
115{ 115{
116 __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); 116 __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE);
117 return __raw_readb(TS72XX_RTC_DATA_VIRT_BASE); 117 return __raw_readb(TS72XX_RTC_DATA_VIRT_BASE);
118} 118}
119 119
120static void ts72xx_rtc_writeb(unsigned char value, unsigned long addr) 120static void ts72xx_rtc_writebyte(unsigned char value, unsigned long addr)
121{ 121{
122 __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); 122 __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE);
123 __raw_writeb(value, TS72XX_RTC_DATA_VIRT_BASE); 123 __raw_writeb(value, TS72XX_RTC_DATA_VIRT_BASE);
124} 124}
125 125
126static struct m48t86_ops ts72xx_rtc_ops = { 126static struct m48t86_ops ts72xx_rtc_ops = {
127 .readb = ts72xx_rtc_readb, 127 .readbyte = ts72xx_rtc_readbyte,
128 .writeb = ts72xx_rtc_writeb, 128 .writebyte = ts72xx_rtc_writebyte,
129}; 129};
130 130
131static struct platform_device ts72xx_rtc_device = { 131static struct platform_device ts72xx_rtc_device = {
diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c
index eeb8a6d4a399..a5de5f1da9f2 100644
--- a/arch/arm/mach-imx/irq.c
+++ b/arch/arm/mach-imx/irq.c
@@ -127,7 +127,7 @@ static void
127imx_gpio_ack_irq(unsigned int irq) 127imx_gpio_ack_irq(unsigned int irq)
128{ 128{
129 DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, irq); 129 DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, irq);
130 ISR(IRQ_TO_REG(irq)) |= 1 << ((irq - IRQ_GPIOA(0)) % 32); 130 ISR(IRQ_TO_REG(irq)) = 1 << ((irq - IRQ_GPIOA(0)) % 32);
131} 131}
132 132
133static void 133static void
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index a0724f2b24ce..9f55f5ae1044 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -232,8 +232,6 @@ static void __init intcp_init_irq(void)
232 for (i = IRQ_PIC_START; i <= IRQ_PIC_END; i++) { 232 for (i = IRQ_PIC_START; i <= IRQ_PIC_END; i++) {
233 if (i == 11) 233 if (i == 11)
234 i = 22; 234 i = 22;
235 if (i == IRQ_CP_CPPLDINT)
236 i++;
237 if (i == 29) 235 if (i == 29)
238 break; 236 break;
239 set_irq_chip(i, &pic_chip); 237 set_irq_chip(i, &pic_chip);
@@ -259,8 +257,7 @@ static void __init intcp_init_irq(void)
259 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 257 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
260 } 258 }
261 259
262 set_irq_handler(IRQ_CP_CPPLDINT, sic_handle_irq); 260 set_irq_chained_handler(IRQ_CP_CPPLDINT, sic_handle_irq);
263 pic_unmask_irq(IRQ_CP_CPPLDINT);
264} 261}
265 262
266/* 263/*
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 19b372df544a..44bcb8097c7a 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -371,6 +371,7 @@ static int spitz_ohci_init(struct device *dev)
371static struct pxaohci_platform_data spitz_ohci_platform_data = { 371static struct pxaohci_platform_data spitz_ohci_platform_data = {
372 .port_mode = PMM_NPS_MODE, 372 .port_mode = PMM_NPS_MODE,
373 .init = spitz_ohci_init, 373 .init = spitz_ohci_init,
374 .power_budget = 150,
374}; 375};
375 376
376 377
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 9e02bc3712a0..af6d2775cf82 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -59,6 +59,14 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg
59 if (irr & (IRR_ETHERNET | IRR_USAR)) { 59 if (irr & (IRR_ETHERNET | IRR_USAR)) {
60 desc->chip->mask(irq); 60 desc->chip->mask(irq);
61 61
62 /*
63 * Ack the interrupt now to prevent re-entering
64 * this neponset handler. Again, this is safe
65 * since we'll check the IRR register prior to
66 * leaving.
67 */
68 desc->chip->ack(irq);
69
62 if (irr & IRR_ETHERNET) { 70 if (irr & IRR_ETHERNET) {
63 d = irq_desc + IRQ_NEPONSET_SMC9196; 71 d = irq_desc + IRQ_NEPONSET_SMC9196;
64 desc_handle_irq(IRQ_NEPONSET_SMC9196, d, regs); 72 desc_handle_irq(IRQ_NEPONSET_SMC9196, d, regs);
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 799697d32dec..cebd48a3dae4 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -112,10 +112,9 @@ void __init versatile_init_irq(void)
112{ 112{
113 unsigned int i; 113 unsigned int i;
114 114
115 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~(1 << 31)); 115 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0);
116 116
117 set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq); 117 set_irq_chained_handler(IRQ_VICSOURCE31, sic_handle_irq);
118 enable_irq(IRQ_VICSOURCE31);
119 118
120 /* Do second interrupt controller */ 119 /* Do second interrupt controller */
121 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 120 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c
index 2e3b643a4dc4..1649a175a206 100644
--- a/arch/i386/kernel/acpi/earlyquirk.c
+++ b/arch/i386/kernel/acpi/earlyquirk.c
@@ -5,17 +5,34 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/acpi.h>
9
8#include <asm/pci-direct.h> 10#include <asm/pci-direct.h>
9#include <asm/acpi.h> 11#include <asm/acpi.h>
10#include <asm/apic.h> 12#include <asm/apic.h>
11 13
14#ifdef CONFIG_ACPI
15
16static int nvidia_hpet_detected __initdata;
17
18static int __init nvidia_hpet_check(unsigned long phys, unsigned long size)
19{
20 nvidia_hpet_detected = 1;
21 return 0;
22}
23#endif
24
12static int __init check_bridge(int vendor, int device) 25static int __init check_bridge(int vendor, int device)
13{ 26{
14#ifdef CONFIG_ACPI 27#ifdef CONFIG_ACPI
15 /* According to Nvidia all timer overrides are bogus. Just ignore 28 /* According to Nvidia all timer overrides are bogus unless HPET
16 them all. */ 29 is enabled. */
17 if (vendor == PCI_VENDOR_ID_NVIDIA) { 30 if (vendor == PCI_VENDOR_ID_NVIDIA) {
18 acpi_skip_timer_override = 1; 31 nvidia_hpet_detected = 0;
32 acpi_table_parse(ACPI_HPET, nvidia_hpet_check);
33 if (nvidia_hpet_detected == 0) {
34 acpi_skip_timer_override = 1;
35 }
19 } 36 }
20#endif 37#endif
21 if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) { 38 if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) {
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 3852d0a4c1b5..1a7bdcef1926 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -104,7 +104,7 @@ acpi_processor_set_performance (
104{ 104{
105 u16 port = 0; 105 u16 port = 0;
106 u8 bit_width = 0; 106 u8 bit_width = 0;
107 int ret = 0; 107 int ret;
108 u32 value = 0; 108 u32 value = 0;
109 int i = 0; 109 int i = 0;
110 struct cpufreq_freqs cpufreq_freqs; 110 struct cpufreq_freqs cpufreq_freqs;
@@ -195,7 +195,6 @@ acpi_processor_set_performance (
195 udelay(10); 195 udelay(10);
196 } 196 }
197 } else { 197 } else {
198 i = 0;
199 value = (u32) data->acpi_data.states[state].status; 198 value = (u32) data->acpi_data.states[state].status;
200 } 199 }
201 200
@@ -444,14 +443,15 @@ static struct freq_attr* acpi_cpufreq_attr[] = {
444}; 443};
445 444
446static struct cpufreq_driver acpi_cpufreq_driver = { 445static struct cpufreq_driver acpi_cpufreq_driver = {
447 .verify = acpi_cpufreq_verify, 446 .verify = acpi_cpufreq_verify,
448 .target = acpi_cpufreq_target, 447 .target = acpi_cpufreq_target,
449 .init = acpi_cpufreq_cpu_init, 448 .init = acpi_cpufreq_cpu_init,
450 .exit = acpi_cpufreq_cpu_exit, 449 .exit = acpi_cpufreq_cpu_exit,
451 .resume = acpi_cpufreq_resume, 450 .resume = acpi_cpufreq_resume,
452 .name = "acpi-cpufreq", 451 .name = "acpi-cpufreq",
453 .owner = THIS_MODULE, 452 .owner = THIS_MODULE,
454 .attr = acpi_cpufreq_attr, 453 .attr = acpi_cpufreq_attr,
454 .flags = CPUFREQ_STICKY,
455}; 455};
456 456
457 457
diff --git a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
index f275e0d4aee5..0d49d73d1b71 100644
--- a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
+++ b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * (C) 2004 Sebastian Witt <se.witt@gmx.net> 2 * (C) 2004-2006 Sebastian Witt <se.witt@gmx.net>
3 * 3 *
4 * Licensed under the terms of the GNU GPL License version 2. 4 * Licensed under the terms of the GNU GPL License version 2.
5 * Based upon reverse engineered information 5 * Based upon reverse engineered information
@@ -90,7 +90,7 @@ static int nforce2_calc_pll(unsigned int fsb)
90 90
91 /* Try to calculate multiplier and divider up to 4 times */ 91 /* Try to calculate multiplier and divider up to 4 times */
92 while (((mul == 0) || (div == 0)) && (tried <= 3)) { 92 while (((mul == 0) || (div == 0)) && (tried <= 3)) {
93 for (xdiv = 1; xdiv <= 0x80; xdiv++) 93 for (xdiv = 2; xdiv <= 0x80; xdiv++)
94 for (xmul = 1; xmul <= 0xfe; xmul++) 94 for (xmul = 1; xmul <= 0xfe; xmul++)
95 if (nforce2_calc_fsb(NFORCE2_PLL(xmul, xdiv)) == 95 if (nforce2_calc_fsb(NFORCE2_PLL(xmul, xdiv)) ==
96 fsb + tried) { 96 fsb + tried) {
@@ -117,8 +117,7 @@ static void nforce2_write_pll(int pll)
117 int temp; 117 int temp;
118 118
119 /* Set the pll addr. to 0x00 */ 119 /* Set the pll addr. to 0x00 */
120 temp = 0x00; 120 pci_write_config_dword(nforce2_chipset_dev, NFORCE2_PLLADR, 0);
121 pci_write_config_dword(nforce2_chipset_dev, NFORCE2_PLLADR, temp);
122 121
123 /* Now write the value in all 64 registers */ 122 /* Now write the value in all 64 registers */
124 for (temp = 0; temp <= 0x3f; temp++) 123 for (temp = 0; temp <= 0x3f; temp++)
@@ -266,7 +265,7 @@ static int nforce2_target(struct cpufreq_policy *policy,
266 if (freqs.old == freqs.new) 265 if (freqs.old == freqs.new)
267 return 0; 266 return 0;
268 267
269 dprintk(KERN_INFO "cpufreq: Old CPU frequency %d kHz, new %d kHz\n", 268 dprintk("Old CPU frequency %d kHz, new %d kHz\n",
270 freqs.old, freqs.new); 269 freqs.old, freqs.new);
271 270
272 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 271 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
@@ -278,7 +277,7 @@ static int nforce2_target(struct cpufreq_policy *policy,
278 printk(KERN_ERR "cpufreq: Changing FSB to %d failed\n", 277 printk(KERN_ERR "cpufreq: Changing FSB to %d failed\n",
279 target_fsb); 278 target_fsb);
280 else 279 else
281 dprintk(KERN_INFO "cpufreq: Changed FSB successfully to %d\n", 280 dprintk("Changed FSB successfully to %d\n",
282 target_fsb); 281 target_fsb);
283 282
284 /* Enable IRQs */ 283 /* Enable IRQs */
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 8ef38544453c..146f607e9c44 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -77,13 +77,17 @@ static char speedbuffer[8];
77 77
78static char *print_speed(int speed) 78static char *print_speed(int speed)
79{ 79{
80 if (speed > 1000) { 80 if (speed < 1000) {
81 if (speed%1000 == 0) 81 snprintf(speedbuffer, sizeof(speedbuffer),"%dMHz", speed);
82 sprintf (speedbuffer, "%dGHz", speed/1000); 82 return speedbuffer;
83 else 83 }
84 sprintf (speedbuffer, "%d.%dGHz", speed/1000, (speed%1000)/100); 84
85 } else 85 if (speed%1000 == 0)
86 sprintf (speedbuffer, "%dMHz", speed); 86 snprintf(speedbuffer, sizeof(speedbuffer),
87 "%dGHz", speed/1000);
88 else
89 snprintf(speedbuffer, sizeof(speedbuffer),
90 "%d.%dGHz", speed/1000, (speed%1000)/100);
87 91
88 return speedbuffer; 92 return speedbuffer;
89} 93}
@@ -675,7 +679,7 @@ static int __init longhaul_init(void)
675 679
676static void __exit longhaul_exit(void) 680static void __exit longhaul_exit(void)
677{ 681{
678 int i=0; 682 int i;
679 683
680 for (i=0; i < numscales; i++) { 684 for (i=0; i < numscales; i++) {
681 if (clock_ratio[i] == maxmult) { 685 if (clock_ratio[i] == maxmult) {
diff --git a/arch/i386/kernel/cpu/cpufreq/longrun.c b/arch/i386/kernel/cpu/cpufreq/longrun.c
index e3868de4dc2e..b2689514295a 100644
--- a/arch/i386/kernel/cpu/cpufreq/longrun.c
+++ b/arch/i386/kernel/cpu/cpufreq/longrun.c
@@ -223,7 +223,6 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
223 /* set to 0 to try_hi perf_pctg */ 223 /* set to 0 to try_hi perf_pctg */
224 msr_lo &= 0xFFFFFF80; 224 msr_lo &= 0xFFFFFF80;
225 msr_hi &= 0xFFFFFF80; 225 msr_hi &= 0xFFFFFF80;
226 msr_lo |= 0;
227 msr_hi |= try_hi; 226 msr_hi |= try_hi;
228 wrmsr(MSR_TMTA_LONGRUN_CTRL, msr_lo, msr_hi); 227 wrmsr(MSR_TMTA_LONGRUN_CTRL, msr_lo, msr_hi);
229 228
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
index 2bf4237cb94e..694d4793bf6a 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
@@ -452,23 +452,23 @@ static int powernow_decode_bios (int maxfid, int startvid)
452 452
453 pst = (struct pst_s *) p; 453 pst = (struct pst_s *) p;
454 454
455 for (i = 0 ; i <psb->numpst; i++) { 455 for (j=0; j<psb->numpst; j++) {
456 pst = (struct pst_s *) p; 456 pst = (struct pst_s *) p;
457 number_scales = pst->numpstates; 457 number_scales = pst->numpstates;
458 458
459 if ((etuple == pst->cpuid) && check_fsb(pst->fsbspeed) && 459 if ((etuple == pst->cpuid) && check_fsb(pst->fsbspeed) &&
460 (maxfid==pst->maxfid) && (startvid==pst->startvid)) 460 (maxfid==pst->maxfid) && (startvid==pst->startvid))
461 { 461 {
462 dprintk ("PST:%d (@%p)\n", i, pst); 462 dprintk ("PST:%d (@%p)\n", j, pst);
463 dprintk (" cpuid: 0x%x fsb: %d maxFID: 0x%x startvid: 0x%x\n", 463 dprintk (" cpuid: 0x%x fsb: %d maxFID: 0x%x startvid: 0x%x\n",
464 pst->cpuid, pst->fsbspeed, pst->maxfid, pst->startvid); 464 pst->cpuid, pst->fsbspeed, pst->maxfid, pst->startvid);
465 465
466 ret = get_ranges ((char *) pst + sizeof (struct pst_s)); 466 ret = get_ranges ((char *) pst + sizeof (struct pst_s));
467 return ret; 467 return ret;
468
469 } else { 468 } else {
469 unsigned int k;
470 p = (char *) pst + sizeof (struct pst_s); 470 p = (char *) pst + sizeof (struct pst_s);
471 for (j=0 ; j < number_scales; j++) 471 for (k=0; k<number_scales; k++)
472 p+=2; 472 p+=2;
473 } 473 }
474 } 474 }
@@ -581,10 +581,7 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy)
581 581
582 rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val); 582 rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);
583 583
584 /* recalibrate cpu_khz */ 584 recalibrate_cpu_khz();
585 result = recalibrate_cpu_khz();
586 if (result)
587 return result;
588 585
589 fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.CFID]; 586 fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.CFID];
590 if (!fsb) { 587 if (!fsb) {
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 71fffa174425..b4277f58f40c 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * (c) 2003, 2004, 2005 Advanced Micro Devices, Inc. 2 * (c) 2003-2006 Advanced Micro Devices, Inc.
3 * Your use of this code is subject to the terms and conditions of the 3 * Your use of this code is subject to the terms and conditions of the
4 * GNU general public license version 2. See "COPYING" or 4 * GNU general public license version 2. See "COPYING" or
5 * http://www.gnu.org/licenses/gpl.html 5 * http://www.gnu.org/licenses/gpl.html
@@ -14,13 +14,13 @@
14 * Based upon datasheets & sample CPUs kindly provided by AMD. 14 * Based upon datasheets & sample CPUs kindly provided by AMD.
15 * 15 *
16 * Valuable input gratefully received from Dave Jones, Pavel Machek, 16 * Valuable input gratefully received from Dave Jones, Pavel Machek,
17 * Dominik Brodowski, and others. 17 * Dominik Brodowski, Jacob Shin, and others.
18 * Originally developed by Paul Devriendt. 18 * Originally developed by Paul Devriendt.
19 * Processor information obtained from Chapter 9 (Power and Thermal Management) 19 * Processor information obtained from Chapter 9 (Power and Thermal Management)
20 * of the "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD 20 * of the "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD
21 * Opteron Processors" available for download from www.amd.com 21 * Opteron Processors" available for download from www.amd.com
22 * 22 *
23 * Tables for specific CPUs can be infrerred from 23 * Tables for specific CPUs can be inferred from
24 * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/30430.pdf 24 * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/30430.pdf
25 */ 25 */
26 26
@@ -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.2" 49#define VERSION "version 2.00.00"
50#include "powernow-k8.h" 50#include "powernow-k8.h"
51 51
52/* serialize freq changes */ 52/* serialize freq changes */
@@ -54,6 +54,8 @@ static DEFINE_MUTEX(fidvid_mutex);
54 54
55static struct powernow_k8_data *powernow_data[NR_CPUS]; 55static struct powernow_k8_data *powernow_data[NR_CPUS];
56 56
57static int cpu_family = CPU_OPTERON;
58
57#ifndef CONFIG_SMP 59#ifndef CONFIG_SMP
58static cpumask_t cpu_core_map[1]; 60static cpumask_t cpu_core_map[1];
59#endif 61#endif
@@ -64,16 +66,36 @@ static u32 find_freq_from_fid(u32 fid)
64 return 800 + (fid * 100); 66 return 800 + (fid * 100);
65} 67}
66 68
69
67/* Return a frequency in KHz, given an input fid */ 70/* Return a frequency in KHz, given an input fid */
68static u32 find_khz_freq_from_fid(u32 fid) 71static u32 find_khz_freq_from_fid(u32 fid)
69{ 72{
70 return 1000 * find_freq_from_fid(fid); 73 return 1000 * find_freq_from_fid(fid);
71} 74}
72 75
73/* Return a voltage in miliVolts, given an input vid */ 76/* Return a frequency in MHz, given an input fid and did */
74static u32 find_millivolts_from_vid(struct powernow_k8_data *data, u32 vid) 77static u32 find_freq_from_fiddid(u32 fid, u32 did)
78{
79 return 100 * (fid + 0x10) >> did;
80}
81
82static u32 find_khz_freq_from_fiddid(u32 fid, u32 did)
75{ 83{
76 return 1550-vid*25; 84 return 1000 * find_freq_from_fiddid(fid, did);
85}
86
87static u32 find_fid_from_pstate(u32 pstate)
88{
89 u32 hi, lo;
90 rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
91 return lo & HW_PSTATE_FID_MASK;
92}
93
94static u32 find_did_from_pstate(u32 pstate)
95{
96 u32 hi, lo;
97 rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
98 return (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
77} 99}
78 100
79/* Return the vco fid for an input fid 101/* Return the vco fid for an input fid
@@ -98,6 +120,9 @@ static int pending_bit_stuck(void)
98{ 120{
99 u32 lo, hi; 121 u32 lo, hi;
100 122
123 if (cpu_family)
124 return 0;
125
101 rdmsr(MSR_FIDVID_STATUS, lo, hi); 126 rdmsr(MSR_FIDVID_STATUS, lo, hi);
102 return lo & MSR_S_LO_CHANGE_PENDING ? 1 : 0; 127 return lo & MSR_S_LO_CHANGE_PENDING ? 1 : 0;
103} 128}
@@ -111,6 +136,14 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
111 u32 lo, hi; 136 u32 lo, hi;
112 u32 i = 0; 137 u32 i = 0;
113 138
139 if (cpu_family) {
140 rdmsr(MSR_PSTATE_STATUS, lo, hi);
141 i = lo & HW_PSTATE_MASK;
142 rdmsr(MSR_PSTATE_DEF_BASE + i, lo, hi);
143 data->currfid = lo & HW_PSTATE_FID_MASK;
144 data->currdid = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
145 return 0;
146 }
114 do { 147 do {
115 if (i++ > 10000) { 148 if (i++ > 10000) {
116 dprintk("detected change pending stuck\n"); 149 dprintk("detected change pending stuck\n");
@@ -175,7 +208,7 @@ static int write_new_fid(struct powernow_k8_data *data, u32 fid)
175 do { 208 do {
176 wrmsr(MSR_FIDVID_CTL, lo, data->plllock * PLL_LOCK_CONVERSION); 209 wrmsr(MSR_FIDVID_CTL, lo, data->plllock * PLL_LOCK_CONVERSION);
177 if (i++ > 100) { 210 if (i++ > 100) {
178 printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); 211 printk(KERN_ERR PFX "Hardware error - pending bit very stuck - no further pstate changes possible\n");
179 return 1; 212 return 1;
180 } 213 }
181 } while (query_current_values_with_pending_wait(data)); 214 } while (query_current_values_with_pending_wait(data));
@@ -255,7 +288,15 @@ static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid,
255 return 0; 288 return 0;
256} 289}
257 290
258/* Change the fid and vid, by the 3 phases. */ 291/* Change hardware pstate by single MSR write */
292static int transition_pstate(struct powernow_k8_data *data, u32 pstate)
293{
294 wrmsr(MSR_PSTATE_CTRL, pstate, 0);
295 data->currfid = find_fid_from_pstate(pstate);
296 return 0;
297}
298
299/* Change Opteron/Athlon64 fid and vid, by the 3 phases. */
259static int transition_fid_vid(struct powernow_k8_data *data, u32 reqfid, u32 reqvid) 300static int transition_fid_vid(struct powernow_k8_data *data, u32 reqfid, u32 reqvid)
260{ 301{
261 if (core_voltage_pre_transition(data, reqvid)) 302 if (core_voltage_pre_transition(data, reqvid))
@@ -474,26 +515,35 @@ static int check_supported_cpu(unsigned int cpu)
474 goto out; 515 goto out;
475 516
476 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); 517 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
477 if ((eax & CPUID_XFAM) != CPUID_XFAM_K8) 518 if (((eax & CPUID_XFAM) != CPUID_XFAM_K8) &&
519 ((eax & CPUID_XFAM) < CPUID_XFAM_10H))
478 goto out; 520 goto out;
479 521
480 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || 522 if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) {
481 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) { 523 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
482 printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); 524 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) {
483 goto out; 525 printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax);
484 } 526 goto out;
527 }
485 528
486 eax = cpuid_eax(CPUID_GET_MAX_CAPABILITIES); 529 eax = cpuid_eax(CPUID_GET_MAX_CAPABILITIES);
487 if (eax < CPUID_FREQ_VOLT_CAPABILITIES) { 530 if (eax < CPUID_FREQ_VOLT_CAPABILITIES) {
488 printk(KERN_INFO PFX 531 printk(KERN_INFO PFX
489 "No frequency change capabilities detected\n"); 532 "No frequency change capabilities detected\n");
490 goto out; 533 goto out;
491 } 534 }
492 535
493 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); 536 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx);
494 if ((edx & P_STATE_TRANSITION_CAPABLE) != P_STATE_TRANSITION_CAPABLE) { 537 if ((edx & P_STATE_TRANSITION_CAPABLE) != P_STATE_TRANSITION_CAPABLE) {
495 printk(KERN_INFO PFX "Power state transitions not supported\n"); 538 printk(KERN_INFO PFX "Power state transitions not supported\n");
496 goto out; 539 goto out;
540 }
541 } else { /* must be a HW Pstate capable processor */
542 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx);
543 if ((edx & USE_HW_PSTATE) == USE_HW_PSTATE)
544 cpu_family = CPU_HW_PSTATE;
545 else
546 goto out;
497 } 547 }
498 548
499 rc = 1; 549 rc = 1;
@@ -547,12 +597,18 @@ static void print_basics(struct powernow_k8_data *data)
547{ 597{
548 int j; 598 int j;
549 for (j = 0; j < data->numps; j++) { 599 for (j = 0; j < data->numps; j++) {
550 if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) 600 if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) {
551 printk(KERN_INFO PFX " %d : fid 0x%x (%d MHz), vid 0x%x (%d mV)\n", j, 601 if (cpu_family) {
602 printk(KERN_INFO PFX " %d : fid 0x%x gid 0x%x (%d MHz)\n", j, (data->powernow_table[j].index & 0xff00) >> 8,
603 (data->powernow_table[j].index & 0xff0000) >> 16,
604 data->powernow_table[j].frequency/1000);
605 } else {
606 printk(KERN_INFO PFX " %d : fid 0x%x (%d MHz), vid 0x%x\n", j,
552 data->powernow_table[j].index & 0xff, 607 data->powernow_table[j].index & 0xff,
553 data->powernow_table[j].frequency/1000, 608 data->powernow_table[j].frequency/1000,
554 data->powernow_table[j].index >> 8, 609 data->powernow_table[j].index >> 8);
555 find_millivolts_from_vid(data, data->powernow_table[j].index >> 8)); 610 }
611 }
556 } 612 }
557 if (data->batps) 613 if (data->batps)
558 printk(KERN_INFO PFX "Only %d pstates on battery\n", data->batps); 614 printk(KERN_INFO PFX "Only %d pstates on battery\n", data->batps);
@@ -702,7 +758,7 @@ static int find_psb_table(struct powernow_k8_data *data)
702#ifdef CONFIG_X86_POWERNOW_K8_ACPI 758#ifdef CONFIG_X86_POWERNOW_K8_ACPI
703static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) 759static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index)
704{ 760{
705 if (!data->acpi_data.state_count) 761 if (!data->acpi_data.state_count || cpu_family)
706 return; 762 return;
707 763
708 data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK; 764 data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK;
@@ -715,9 +771,8 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned
715 771
716static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) 772static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
717{ 773{
718 int i;
719 int cntlofreq = 0;
720 struct cpufreq_frequency_table *powernow_table; 774 struct cpufreq_frequency_table *powernow_table;
775 int ret_val;
721 776
722 if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) { 777 if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) {
723 dprintk("register performance failed: bad ACPI data\n"); 778 dprintk("register performance failed: bad ACPI data\n");
@@ -746,6 +801,85 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
746 goto err_out; 801 goto err_out;
747 } 802 }
748 803
804 if (cpu_family)
805 ret_val = fill_powernow_table_pstate(data, powernow_table);
806 else
807 ret_val = fill_powernow_table_fidvid(data, powernow_table);
808 if (ret_val)
809 goto err_out_mem;
810
811 powernow_table[data->acpi_data.state_count].frequency = CPUFREQ_TABLE_END;
812 powernow_table[data->acpi_data.state_count].index = 0;
813 data->powernow_table = powernow_table;
814
815 /* fill in data */
816 data->numps = data->acpi_data.state_count;
817 print_basics(data);
818 powernow_k8_acpi_pst_values(data, 0);
819
820 /* notify BIOS that we exist */
821 acpi_processor_notify_smm(THIS_MODULE);
822
823 return 0;
824
825err_out_mem:
826 kfree(powernow_table);
827
828err_out:
829 acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
830
831 /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
832 data->acpi_data.state_count = 0;
833
834 return -ENODEV;
835}
836
837static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table)
838{
839 int i;
840
841 for (i = 0; i < data->acpi_data.state_count; i++) {
842 u32 index;
843 u32 hi = 0, lo = 0;
844 u32 fid;
845 u32 did;
846
847 index = data->acpi_data.states[i].control & HW_PSTATE_MASK;
848 if (index > MAX_HW_PSTATE) {
849 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index);
850 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n");
851 }
852 rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
853 if (!(hi & HW_PSTATE_VALID_MASK)) {
854 dprintk("invalid pstate %d, ignoring\n", index);
855 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
856 continue;
857 }
858
859 fid = lo & HW_PSTATE_FID_MASK;
860 did = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
861
862 dprintk(" %d : fid 0x%x, did 0x%x\n", index, fid, did);
863
864 powernow_table[i].index = index | (fid << HW_FID_INDEX_SHIFT) | (did << HW_DID_INDEX_SHIFT);
865
866 powernow_table[i].frequency = find_khz_freq_from_fiddid(fid, did);
867
868 if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) {
869 printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n",
870 powernow_table[i].frequency,
871 (unsigned int) (data->acpi_data.states[i].core_frequency * 1000));
872 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
873 continue;
874 }
875 }
876 return 0;
877}
878
879static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table)
880{
881 int i;
882 int cntlofreq = 0;
749 for (i = 0; i < data->acpi_data.state_count; i++) { 883 for (i = 0; i < data->acpi_data.state_count; i++) {
750 u32 fid; 884 u32 fid;
751 u32 vid; 885 u32 vid;
@@ -786,7 +920,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
786 if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) || 920 if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) ||
787 (powernow_table[i].index != powernow_table[cntlofreq].index)) { 921 (powernow_table[i].index != powernow_table[cntlofreq].index)) {
788 printk(KERN_ERR PFX "Too many lo freq table entries\n"); 922 printk(KERN_ERR PFX "Too many lo freq table entries\n");
789 goto err_out_mem; 923 return 1;
790 } 924 }
791 925
792 dprintk("double low frequency table entry, ignoring it.\n"); 926 dprintk("double low frequency table entry, ignoring it.\n");
@@ -804,31 +938,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
804 continue; 938 continue;
805 } 939 }
806 } 940 }
807
808 powernow_table[data->acpi_data.state_count].frequency = CPUFREQ_TABLE_END;
809 powernow_table[data->acpi_data.state_count].index = 0;
810 data->powernow_table = powernow_table;
811
812 /* fill in data */
813 data->numps = data->acpi_data.state_count;
814 print_basics(data);
815 powernow_k8_acpi_pst_values(data, 0);
816
817 /* notify BIOS that we exist */
818 acpi_processor_notify_smm(THIS_MODULE);
819
820 return 0; 941 return 0;
821
822err_out_mem:
823 kfree(powernow_table);
824
825err_out:
826 acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
827
828 /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
829 data->acpi_data.state_count = 0;
830
831 return -ENODEV;
832} 942}
833 943
834static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data) 944static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data)
@@ -844,20 +954,20 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned
844#endif /* CONFIG_X86_POWERNOW_K8_ACPI */ 954#endif /* CONFIG_X86_POWERNOW_K8_ACPI */
845 955
846/* Take a frequency, and issue the fid/vid transition command */ 956/* Take a frequency, and issue the fid/vid transition command */
847static int transition_frequency(struct powernow_k8_data *data, unsigned int index) 957static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned int index)
848{ 958{
849 u32 fid; 959 u32 fid = 0;
850 u32 vid; 960 u32 vid = 0;
851 int res, i; 961 int res, i;
852 struct cpufreq_freqs freqs; 962 struct cpufreq_freqs freqs;
853 963
854 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); 964 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index);
855 965
966 /* fid/vid correctness check for k8 */
856 /* fid are the lower 8 bits of the index we stored into 967 /* fid are the lower 8 bits of the index we stored into
857 * the cpufreq frequency table in find_psb_table, vid are 968 * the cpufreq frequency table in find_psb_table, vid
858 * the upper 8 bits. 969 * are the upper 8 bits.
859 */ 970 */
860
861 fid = data->powernow_table[index].index & 0xFF; 971 fid = data->powernow_table[index].index & 0xFF;
862 vid = (data->powernow_table[index].index & 0xFF00) >> 8; 972 vid = (data->powernow_table[index].index & 0xFF00) >> 8;
863 973
@@ -881,22 +991,58 @@ static int transition_frequency(struct powernow_k8_data *data, unsigned int inde
881 991
882 dprintk("cpu %d, changing to fid 0x%x, vid 0x%x\n", 992 dprintk("cpu %d, changing to fid 0x%x, vid 0x%x\n",
883 smp_processor_id(), fid, vid); 993 smp_processor_id(), fid, vid);
884
885 freqs.cpu = data->cpu;
886 freqs.old = find_khz_freq_from_fid(data->currfid); 994 freqs.old = find_khz_freq_from_fid(data->currfid);
887 freqs.new = find_khz_freq_from_fid(fid); 995 freqs.new = find_khz_freq_from_fid(fid);
888 for_each_cpu_mask(i, cpu_core_map[data->cpu]) { 996
997 for_each_cpu_mask(i, *(data->available_cores)) {
889 freqs.cpu = i; 998 freqs.cpu = i;
890 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 999 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
891 } 1000 }
892 1001
893 res = transition_fid_vid(data, fid, vid); 1002 res = transition_fid_vid(data, fid, vid);
894
895 freqs.new = find_khz_freq_from_fid(data->currfid); 1003 freqs.new = find_khz_freq_from_fid(data->currfid);
896 for_each_cpu_mask(i, cpu_core_map[data->cpu]) { 1004
1005 for_each_cpu_mask(i, *(data->available_cores)) {
897 freqs.cpu = i; 1006 freqs.cpu = i;
898 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 1007 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
899 } 1008 }
1009 return res;
1010}
1011
1012/* Take a frequency, and issue the hardware pstate transition command */
1013static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index)
1014{
1015 u32 fid = 0;
1016 u32 did = 0;
1017 u32 pstate = 0;
1018 int res, i;
1019 struct cpufreq_freqs freqs;
1020
1021 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index);
1022
1023 /* get fid did for hardware pstate transition */
1024 pstate = index & HW_PSTATE_MASK;
1025 if (pstate > MAX_HW_PSTATE)
1026 return 0;
1027 fid = (index & HW_FID_INDEX_MASK) >> HW_FID_INDEX_SHIFT;
1028 did = (index & HW_DID_INDEX_MASK) >> HW_DID_INDEX_SHIFT;
1029 freqs.old = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1030 freqs.new = find_khz_freq_from_fiddid(fid, did);
1031
1032 for_each_cpu_mask(i, *(data->available_cores)) {
1033 freqs.cpu = i;
1034 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
1035 }
1036
1037 res = transition_pstate(data, pstate);
1038 data->currfid = find_fid_from_pstate(pstate);
1039 data->currdid = find_did_from_pstate(pstate);
1040 freqs.new = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1041
1042 for_each_cpu_mask(i, *(data->available_cores)) {
1043 freqs.cpu = i;
1044 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
1045 }
900 return res; 1046 return res;
901} 1047}
902 1048
@@ -933,18 +1079,21 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
933 dprintk("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n", 1079 dprintk("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n",
934 pol->cpu, targfreq, pol->min, pol->max, relation); 1080 pol->cpu, targfreq, pol->min, pol->max, relation);
935 1081
936 if (query_current_values_with_pending_wait(data)) { 1082 if (query_current_values_with_pending_wait(data))
937 ret = -EIO;
938 goto err_out; 1083 goto err_out;
939 }
940 1084
941 dprintk("targ: curr fid 0x%x, vid 0x%x\n", 1085 if (cpu_family)
1086 dprintk("targ: curr fid 0x%x, did 0x%x\n",
1087 data->currfid, data->currvid);
1088 else {
1089 dprintk("targ: curr fid 0x%x, vid 0x%x\n",
942 data->currfid, data->currvid); 1090 data->currfid, data->currvid);
943 1091
944 if ((checkvid != data->currvid) || (checkfid != data->currfid)) { 1092 if ((checkvid != data->currvid) || (checkfid != data->currfid)) {
945 printk(KERN_INFO PFX 1093 printk(KERN_INFO PFX
946 "error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n", 1094 "error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n",
947 checkfid, data->currfid, checkvid, data->currvid); 1095 checkfid, data->currfid, checkvid, data->currvid);
1096 }
948 } 1097 }
949 1098
950 if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) 1099 if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate))
@@ -954,7 +1103,11 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
954 1103
955 powernow_k8_acpi_pst_values(data, newstate); 1104 powernow_k8_acpi_pst_values(data, newstate);
956 1105
957 if (transition_frequency(data, newstate)) { 1106 if (cpu_family)
1107 ret = transition_frequency_pstate(data, newstate);
1108 else
1109 ret = transition_frequency_fidvid(data, newstate);
1110 if (ret) {
958 printk(KERN_ERR PFX "transition frequency failed\n"); 1111 printk(KERN_ERR PFX "transition frequency failed\n");
959 ret = 1; 1112 ret = 1;
960 mutex_unlock(&fidvid_mutex); 1113 mutex_unlock(&fidvid_mutex);
@@ -962,7 +1115,10 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
962 } 1115 }
963 mutex_unlock(&fidvid_mutex); 1116 mutex_unlock(&fidvid_mutex);
964 1117
965 pol->cur = find_khz_freq_from_fid(data->currfid); 1118 if (cpu_family)
1119 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1120 else
1121 pol->cur = find_khz_freq_from_fid(data->currfid);
966 ret = 0; 1122 ret = 0;
967 1123
968err_out: 1124err_out:
@@ -1007,14 +1163,13 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1007 * Use the PSB BIOS structure. This is only availabe on 1163 * Use the PSB BIOS structure. This is only availabe on
1008 * an UP version, and is deprecated by AMD. 1164 * an UP version, and is deprecated by AMD.
1009 */ 1165 */
1010
1011 if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) { 1166 if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) {
1012 printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n"); 1167 printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n");
1013 kfree(data); 1168 kfree(data);
1014 return -ENODEV; 1169 return -ENODEV;
1015 } 1170 }
1016 if (pol->cpu != 0) { 1171 if (pol->cpu != 0) {
1017 printk(KERN_ERR PFX "init not cpu 0\n"); 1172 printk(KERN_ERR PFX "No _PSS objects for CPU other than CPU0\n");
1018 kfree(data); 1173 kfree(data);
1019 return -ENODEV; 1174 return -ENODEV;
1020 } 1175 }
@@ -1042,20 +1197,28 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1042 if (query_current_values_with_pending_wait(data)) 1197 if (query_current_values_with_pending_wait(data))
1043 goto err_out; 1198 goto err_out;
1044 1199
1045 fidvid_msr_init(); 1200 if (!cpu_family)
1201 fidvid_msr_init();
1046 1202
1047 /* run on any CPU again */ 1203 /* run on any CPU again */
1048 set_cpus_allowed(current, oldmask); 1204 set_cpus_allowed(current, oldmask);
1049 1205
1050 pol->governor = CPUFREQ_DEFAULT_GOVERNOR; 1206 pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
1051 pol->cpus = cpu_core_map[pol->cpu]; 1207 if (cpu_family)
1208 pol->cpus = cpumask_of_cpu(pol->cpu);
1209 else
1210 pol->cpus = cpu_core_map[pol->cpu];
1211 data->available_cores = &(pol->cpus);
1052 1212
1053 /* Take a crude guess here. 1213 /* Take a crude guess here.
1054 * That guess was in microseconds, so multiply with 1000 */ 1214 * That guess was in microseconds, so multiply with 1000 */
1055 pol->cpuinfo.transition_latency = (((data->rvo + 8) * data->vstable * VST_UNITS_20US) 1215 pol->cpuinfo.transition_latency = (((data->rvo + 8) * data->vstable * VST_UNITS_20US)
1056 + (3 * (1 << data->irt) * 10)) * 1000; 1216 + (3 * (1 << data->irt) * 10)) * 1000;
1057 1217
1058 pol->cur = find_khz_freq_from_fid(data->currfid); 1218 if (cpu_family)
1219 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1220 else
1221 pol->cur = find_khz_freq_from_fid(data->currfid);
1059 dprintk("policy current frequency %d kHz\n", pol->cur); 1222 dprintk("policy current frequency %d kHz\n", pol->cur);
1060 1223
1061 /* min/max the cpu is capable of */ 1224 /* min/max the cpu is capable of */
@@ -1069,8 +1232,12 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1069 1232
1070 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); 1233 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu);
1071 1234
1072 printk("cpu_init done, current fid 0x%x, vid 0x%x\n", 1235 if (cpu_family)
1073 data->currfid, data->currvid); 1236 dprintk("cpu_init done, current fid 0x%x, did 0x%x\n",
1237 data->currfid, data->currdid);
1238 else
1239 dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n",
1240 data->currfid, data->currvid);
1074 1241
1075 powernow_data[pol->cpu] = data; 1242 powernow_data[pol->cpu] = data;
1076 1243
@@ -1156,8 +1323,9 @@ static int __cpuinit powernowk8_init(void)
1156 } 1323 }
1157 1324
1158 if (supported_cpus == num_online_cpus()) { 1325 if (supported_cpus == num_online_cpus()) {
1159 printk(KERN_INFO PFX "Found %d AMD Athlon 64 / Opteron " 1326 printk(KERN_INFO PFX "Found %d %s "
1160 "processors (" VERSION ")\n", supported_cpus); 1327 "processors (" VERSION ")\n", supported_cpus,
1328 boot_cpu_data.x86_model_id);
1161 return cpufreq_register_driver(&cpufreq_amd64_driver); 1329 return cpufreq_register_driver(&cpufreq_amd64_driver);
1162 } 1330 }
1163 1331
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index 79a7c5c87edc..bf8ad9e43da3 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * (c) 2003, 2004, 2005 Advanced Micro Devices, Inc. 2 * (c) 2003-2006 Advanced Micro Devices, Inc.
3 * Your use of this code is subject to the terms and conditions of the 3 * Your use of this code is subject to the terms and conditions of the
4 * GNU general public license version 2. See "COPYING" or 4 * GNU general public license version 2. See "COPYING" or
5 * http://www.gnu.org/licenses/gpl.html 5 * http://www.gnu.org/licenses/gpl.html
@@ -21,8 +21,8 @@ struct powernow_k8_data {
21 u32 plllock; /* pll lock time, units 1 us */ 21 u32 plllock; /* pll lock time, units 1 us */
22 u32 exttype; /* extended interface = 1 */ 22 u32 exttype; /* extended interface = 1 */
23 23
24 /* keep track of the current fid / vid */ 24 /* keep track of the current fid / vid or did */
25 u32 currvid, currfid; 25 u32 currvid, currfid, currdid;
26 26
27 /* the powernow_table includes all frequency and vid/fid pairings: 27 /* the powernow_table includes all frequency and vid/fid pairings:
28 * fid are the lower 8 bits of the index, vid are the upper 8 bits. 28 * fid are the lower 8 bits of the index, vid are the upper 8 bits.
@@ -34,6 +34,10 @@ struct powernow_k8_data {
34 * used to determine valid frequency/vid/fid states */ 34 * used to determine valid frequency/vid/fid states */
35 struct acpi_processor_performance acpi_data; 35 struct acpi_processor_performance acpi_data;
36#endif 36#endif
37 /* we need to keep track of associated cores, but let cpufreq
38 * handle hotplug events - so just point at cpufreq pol->cpus
39 * structure */
40 cpumask_t *available_cores;
37}; 41};
38 42
39 43
@@ -43,6 +47,7 @@ struct powernow_k8_data {
43#define CPUID_XFAM_K8 0 47#define CPUID_XFAM_K8 0
44#define CPUID_XMOD 0x000f0000 /* extended model */ 48#define CPUID_XMOD 0x000f0000 /* extended model */
45#define CPUID_XMOD_REV_G 0x00060000 49#define CPUID_XMOD_REV_G 0x00060000
50#define CPUID_XFAM_10H 0x00100000 /* family 0x10 */
46#define CPUID_USE_XFAM_XMOD 0x00000f00 51#define CPUID_USE_XFAM_XMOD 0x00000f00
47#define CPUID_GET_MAX_CAPABILITIES 0x80000000 52#define CPUID_GET_MAX_CAPABILITIES 0x80000000
48#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 53#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007
@@ -79,6 +84,32 @@ struct powernow_k8_data {
79#define MSR_S_HI_CURRENT_VID 0x0000003f 84#define MSR_S_HI_CURRENT_VID 0x0000003f
80#define MSR_C_HI_STP_GNT_BENIGN 0x00000001 85#define MSR_C_HI_STP_GNT_BENIGN 0x00000001
81 86
87
88/* Hardware Pstate _PSS and MSR definitions */
89#define USE_HW_PSTATE 0x00000080
90#define HW_PSTATE_FID_MASK 0x0000003f
91#define HW_PSTATE_DID_MASK 0x000001c0
92#define HW_PSTATE_DID_SHIFT 6
93#define HW_PSTATE_MASK 0x00000007
94#define HW_PSTATE_VALID_MASK 0x80000000
95#define HW_FID_INDEX_SHIFT 8
96#define HW_FID_INDEX_MASK 0x0000ff00
97#define HW_DID_INDEX_SHIFT 16
98#define HW_DID_INDEX_MASK 0x00ff0000
99#define HW_WATTS_MASK 0xff
100#define HW_PWR_DVR_MASK 0x300
101#define HW_PWR_DVR_SHIFT 8
102#define HW_PWR_MAX_MULT 3
103#define MAX_HW_PSTATE 8 /* hw pstate supports up to 8 */
104#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */
105#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */
106#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */
107
108/* define the two driver architectures */
109#define CPU_OPTERON 0
110#define CPU_HW_PSTATE 1
111
112
82/* 113/*
83 * There are restrictions frequencies have to follow: 114 * There are restrictions frequencies have to follow:
84 * - only 1 entry in the low fid table ( <=1.4GHz ) 115 * - only 1 entry in the low fid table ( <=1.4GHz )
@@ -182,6 +213,9 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid);
182 213
183static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); 214static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index);
184 215
216static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
217static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
218
185#ifdef CONFIG_SMP 219#ifdef CONFIG_SMP
186static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) 220static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[])
187{ 221{
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index b0ff9075708c..ce54ff12c15d 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -250,7 +250,7 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
250 250
251 if (model->cpu_id == NULL) { 251 if (model->cpu_id == NULL) {
252 /* No match at all */ 252 /* No match at all */
253 dprintk(KERN_INFO PFX "no support for CPU model \"%s\": " 253 dprintk("no support for CPU model \"%s\": "
254 "send /proc/cpuinfo to " MAINTAINER "\n", 254 "send /proc/cpuinfo to " MAINTAINER "\n",
255 cpu->x86_model_id); 255 cpu->x86_model_id);
256 return -ENOENT; 256 return -ENOENT;
@@ -258,10 +258,10 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
258 258
259 if (model->op_points == NULL) { 259 if (model->op_points == NULL) {
260 /* Matched a non-match */ 260 /* Matched a non-match */
261 dprintk(KERN_INFO PFX "no table support for CPU model \"%s\"\n", 261 dprintk("no table support for CPU model \"%s\"\n",
262 cpu->x86_model_id); 262 cpu->x86_model_id);
263#ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI 263#ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
264 dprintk(KERN_INFO PFX "try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n"); 264 dprintk("try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n");
265#endif 265#endif
266 return -ENOENT; 266 return -ENOENT;
267 } 267 }
@@ -368,7 +368,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
368 368
369 /* register with ACPI core */ 369 /* register with ACPI core */
370 if (acpi_processor_register_performance(&p, cpu)) { 370 if (acpi_processor_register_performance(&p, cpu)) {
371 dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); 371 dprintk("obtaining ACPI data failed\n");
372 return -EIO; 372 return -EIO;
373 } 373 }
374 374
@@ -465,7 +465,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
465 kfree(centrino_model[cpu]); 465 kfree(centrino_model[cpu]);
466 err_unreg: 466 err_unreg:
467 acpi_processor_unregister_performance(&p, cpu); 467 acpi_processor_unregister_performance(&p, cpu);
468 dprintk(KERN_INFO PFX "invalid ACPI data\n"); 468 dprintk("invalid ACPI data\n");
469 return (result); 469 return (result);
470} 470}
471#else 471#else
@@ -499,7 +499,7 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
499 centrino_cpu[policy->cpu] = &cpu_ids[i]; 499 centrino_cpu[policy->cpu] = &cpu_ids[i];
500 500
501 if (!centrino_cpu[policy->cpu]) { 501 if (!centrino_cpu[policy->cpu]) {
502 dprintk(KERN_INFO PFX "found unsupported CPU with " 502 dprintk("found unsupported CPU with "
503 "Enhanced SpeedStep: send /proc/cpuinfo to " 503 "Enhanced SpeedStep: send /proc/cpuinfo to "
504 MAINTAINER "\n"); 504 MAINTAINER "\n");
505 return -ENODEV; 505 return -ENODEV;
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 846e1639ef7c..dd6b0e3386ce 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -1547,15 +1547,18 @@ void __init setup_arch(char **cmdline_p)
1547 if (efi_enabled) 1547 if (efi_enabled)
1548 efi_map_memmap(); 1548 efi_map_memmap();
1549 1549
1550#ifdef CONFIG_X86_IO_APIC
1551 check_acpi_pci(); /* Checks more than just ACPI actually */
1552#endif
1553
1554#ifdef CONFIG_ACPI 1550#ifdef CONFIG_ACPI
1555 /* 1551 /*
1556 * Parse the ACPI tables for possible boot-time SMP configuration. 1552 * Parse the ACPI tables for possible boot-time SMP configuration.
1557 */ 1553 */
1558 acpi_boot_table_init(); 1554 acpi_boot_table_init();
1555#endif
1556
1557#ifdef CONFIG_X86_IO_APIC
1558 check_acpi_pci(); /* Checks more than just ACPI actually */
1559#endif
1560
1561#ifdef CONFIG_ACPI
1559 acpi_boot_init(); 1562 acpi_boot_init();
1560 1563
1561#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) 1564#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e8ff09fe73d9..35e038a974c6 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -119,6 +119,32 @@ config MIPS_MIRAGE
119 select SYS_HAS_CPU_MIPS32_R1 119 select SYS_HAS_CPU_MIPS32_R1
120 select SYS_SUPPORTS_LITTLE_ENDIAN 120 select SYS_SUPPORTS_LITTLE_ENDIAN
121 121
122config BASLER_EXCITE
123 bool "Basler eXcite smart camera support"
124 select DMA_COHERENT
125 select HW_HAS_PCI
126 select IRQ_CPU
127 select IRQ_CPU_RM7K
128 select IRQ_CPU_RM9K
129 select SERIAL_RM9000
130 select SYS_HAS_CPU_RM9000
131 select SYS_SUPPORTS_32BIT_KERNEL
132 select SYS_SUPPORTS_64BIT_KERNEL
133 select SYS_SUPPORTS_BIG_ENDIAN
134 help
135 The eXcite is a smart camera platform manufactured by
136 Basler Vision Technologies AG
137
138config BASLER_EXCITE_PROTOTYPE
139 bool "Support for pre-release units"
140 depends on BASLER_EXCITE
141 default n
142 help
143 Pre-series (prototype) units are different from later ones in
144 some ways. Select this option if you have one of these. Please
145 note that a kernel built with this option selected will not be
146 able to run on normal units.
147
122config MIPS_COBALT 148config MIPS_COBALT
123 bool "Cobalt Server" 149 bool "Cobalt Server"
124 select DMA_NONCOHERENT 150 select DMA_NONCOHERENT
@@ -142,6 +168,9 @@ config MACH_DECSTATION
142 select SYS_SUPPORTS_32BIT_KERNEL 168 select SYS_SUPPORTS_32BIT_KERNEL
143 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 169 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
144 select SYS_SUPPORTS_LITTLE_ENDIAN 170 select SYS_SUPPORTS_LITTLE_ENDIAN
171 select SYS_SUPPORTS_128HZ
172 select SYS_SUPPORTS_256HZ
173 select SYS_SUPPORTS_1024HZ
145 help 174 help
146 This enables support for DEC's MIPS based workstations. For details 175 This enables support for DEC's MIPS based workstations. For details
147 see the Linux/MIPS FAQ on <http://www.linux-mips.org/> and the 176 see the Linux/MIPS FAQ on <http://www.linux-mips.org/> and the
@@ -239,6 +268,7 @@ config MACH_JAZZ
239 select SYS_HAS_CPU_R4X00 268 select SYS_HAS_CPU_R4X00
240 select SYS_SUPPORTS_32BIT_KERNEL 269 select SYS_SUPPORTS_32BIT_KERNEL
241 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 270 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
271 select SYS_SUPPORTS_100HZ
242 help 272 help
243 This a family of machines based on the MIPS R4030 chipset which was 273 This a family of machines based on the MIPS R4030 chipset which was
244 used by several vendors to build RISC/os and Windows NT workstations. 274 used by several vendors to build RISC/os and Windows NT workstations.
@@ -327,6 +357,27 @@ config MIPS_SEAD
327 This enables support for the MIPS Technologies SEAD evaluation 357 This enables support for the MIPS Technologies SEAD evaluation
328 board. 358 board.
329 359
360config WR_PPMC
361 bool "Support for Wind River PPMC board"
362 select IRQ_CPU
363 select BOOT_ELF32
364 select DMA_NONCOHERENT
365 select HW_HAS_PCI
366 select MIPS_GT64120
367 select SWAP_IO_SPACE
368 select SYS_HAS_CPU_MIPS32_R1
369 select SYS_HAS_CPU_MIPS32_R2
370 select SYS_HAS_CPU_MIPS64_R1
371 select SYS_HAS_CPU_NEVADA
372 select SYS_HAS_CPU_RM7000
373 select SYS_SUPPORTS_32BIT_KERNEL
374 select SYS_SUPPORTS_64BIT_KERNEL
375 select SYS_SUPPORTS_BIG_ENDIAN
376 select SYS_SUPPORTS_LITTLE_ENDIAN
377 help
378 This enables support for the Wind River MIPS32 4KC PPMC evaluation
379 board, which is based on GT64120 bridge chip.
380
330config MIPS_SIM 381config MIPS_SIM
331 bool 'MIPS simulator (MIPSsim)' 382 bool 'MIPS simulator (MIPSsim)'
332 select DMA_NONCOHERENT 383 select DMA_NONCOHERENT
@@ -438,53 +489,16 @@ config MIPS_XXS1500
438 489
439config PNX8550_V2PCI 490config PNX8550_V2PCI
440 bool "Philips PNX8550 based Viper2-PCI board" 491 bool "Philips PNX8550 based Viper2-PCI board"
492 depends on BROKEN
441 select PNX8550 493 select PNX8550
442 select SYS_SUPPORTS_LITTLE_ENDIAN 494 select SYS_SUPPORTS_LITTLE_ENDIAN
443 495
444config PNX8550_JBS 496config PNX8550_JBS
445 bool "Philips PNX8550 based JBS board" 497 bool "Philips PNX8550 based JBS board"
498 depends on BROKEN
446 select PNX8550 499 select PNX8550
447 select SYS_SUPPORTS_LITTLE_ENDIAN 500 select SYS_SUPPORTS_LITTLE_ENDIAN
448 501
449config DDB5074
450 bool "NEC DDB Vrc-5074 (EXPERIMENTAL)"
451 depends on EXPERIMENTAL
452 select DDB5XXX_COMMON
453 select DMA_NONCOHERENT
454 select HAVE_STD_PC_SERIAL_PORT
455 select HW_HAS_PCI
456 select IRQ_CPU
457 select I8259
458 select ISA
459 select SYS_HAS_CPU_R5000
460 select SYS_SUPPORTS_32BIT_KERNEL
461 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
462 select SYS_SUPPORTS_LITTLE_ENDIAN
463 help
464 This enables support for the VR5000-based NEC DDB Vrc-5074
465 evaluation board.
466
467config DDB5476
468 bool "NEC DDB Vrc-5476"
469 select DDB5XXX_COMMON
470 select DMA_NONCOHERENT
471 select HAVE_STD_PC_SERIAL_PORT
472 select HW_HAS_PCI
473 select IRQ_CPU
474 select I8259
475 select ISA
476 select SYS_HAS_CPU_R5432
477 select SYS_SUPPORTS_32BIT_KERNEL
478 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
479 select SYS_SUPPORTS_LITTLE_ENDIAN
480 help
481 This enables support for the R5432-based NEC DDB Vrc-5476
482 evaluation board.
483
484 Features : kernel debugging, serial terminal, NFS root fs, on-board
485 ether port USB, AC97, PCI, PCI VGA card & framebuffer console,
486 IDE controller, PS2 keyboard, PS2 mouse, etc.
487
488config DDB5477 502config DDB5477
489 bool "NEC DDB Vrc-5477" 503 bool "NEC DDB Vrc-5477"
490 select DDB5XXX_COMMON 504 select DDB5XXX_COMMON
@@ -546,6 +560,20 @@ config QEMU
546 simulate actual MIPS hardware platforms. More information on Qemu 560 simulate actual MIPS hardware platforms. More information on Qemu
547 can be found at http://www.linux-mips.org/wiki/Qemu. 561 can be found at http://www.linux-mips.org/wiki/Qemu.
548 562
563config MARKEINS
564 bool "Support for NEC EMMA2RH Mark-eins"
565 select DMA_NONCOHERENT
566 select HW_HAS_PCI
567 select IRQ_CPU
568 select SWAP_IO_SPACE
569 select SYS_SUPPORTS_32BIT_KERNEL
570 select SYS_SUPPORTS_BIG_ENDIAN
571 select SYS_SUPPORTS_LITTLE_ENDIAN
572 select SYS_HAS_CPU_R5000
573 help
574 This enables support for the R5432-based NEC Mark-eins
575 boards with R5500 CPU.
576
549config SGI_IP22 577config SGI_IP22
550 bool "SGI IP22 (Indy/Indigo2)" 578 bool "SGI IP22 (Indy/Indigo2)"
551 select ARC 579 select ARC
@@ -555,6 +583,7 @@ config SGI_IP22
555 select HW_HAS_EISA 583 select HW_HAS_EISA
556 select IP22_CPU_SCACHE 584 select IP22_CPU_SCACHE
557 select IRQ_CPU 585 select IRQ_CPU
586 select NO_ISA if ISA
558 select SWAP_IO_SPACE 587 select SWAP_IO_SPACE
559 select SYS_HAS_CPU_R4X00 588 select SYS_HAS_CPU_R4X00
560 select SYS_HAS_CPU_R5000 589 select SYS_HAS_CPU_R5000
@@ -577,6 +606,7 @@ config SGI_IP27
577 select SYS_HAS_CPU_R10000 606 select SYS_HAS_CPU_R10000
578 select SYS_SUPPORTS_64BIT_KERNEL 607 select SYS_SUPPORTS_64BIT_KERNEL
579 select SYS_SUPPORTS_BIG_ENDIAN 608 select SYS_SUPPORTS_BIG_ENDIAN
609 select SYS_SUPPORTS_NUMA
580 help 610 help
581 This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics 611 This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics
582 workstations. To compile a Linux kernel that runs on these, say Y 612 workstations. To compile a Linux kernel that runs on these, say Y
@@ -707,8 +737,8 @@ config SIBYTE_CRHONE
707 737
708config SNI_RM200_PCI 738config SNI_RM200_PCI
709 bool "SNI RM200 PCI" 739 bool "SNI RM200 PCI"
710 select ARC 740 select ARC if CPU_LITTLE_ENDIAN
711 select ARC32 741 select ARC32 if CPU_LITTLE_ENDIAN
712 select ARCH_MAY_HAVE_PC_FDC 742 select ARCH_MAY_HAVE_PC_FDC
713 select BOOT_ELF32 743 select BOOT_ELF32
714 select DMA_NONCOHERENT 744 select DMA_NONCOHERENT
@@ -719,10 +749,13 @@ config SNI_RM200_PCI
719 select I8253 749 select I8253
720 select I8259 750 select I8259
721 select ISA 751 select ISA
752 select SWAP_IO_SPACE if CPU_BIG_ENDIAN
722 select SYS_HAS_CPU_R4X00 753 select SYS_HAS_CPU_R4X00
754 select SYS_HAS_CPU_R5000
755 select R5000_CPU_SCACHE
723 select SYS_SUPPORTS_32BIT_KERNEL 756 select SYS_SUPPORTS_32BIT_KERNEL
724 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 757 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
725 select SYS_SUPPORTS_BIG_ENDIAN if EXPERIMENTAL 758 select SYS_SUPPORTS_BIG_ENDIAN
726 select SYS_SUPPORTS_HIGHMEM 759 select SYS_SUPPORTS_HIGHMEM
727 select SYS_SUPPORTS_LITTLE_ENDIAN 760 select SYS_SUPPORTS_LITTLE_ENDIAN
728 help 761 help
@@ -979,6 +1012,11 @@ config SOC_PNX8550
979config SWAP_IO_SPACE 1012config SWAP_IO_SPACE
980 bool 1013 bool
981 1014
1015config EMMA2RH
1016 bool
1017 depends on MARKEINS
1018 default y
1019
982# 1020#
983# Unfortunately not all GT64120 systems run the chip at the same clock. 1021# Unfortunately not all GT64120 systems run the chip at the same clock.
984# As the user for the clock rate and try to minimize the available options. 1022# As the user for the clock rate and try to minimize the available options.
@@ -1607,6 +1645,28 @@ config ARCH_FLATMEM_ENABLE
1607 def_bool y 1645 def_bool y
1608 depends on !NUMA 1646 depends on !NUMA
1609 1647
1648config ARCH_DISCONTIGMEM_ENABLE
1649 bool
1650 default y if SGI_IP27
1651 help
1652 Say Y to upport efficient handling of discontiguous physical memory,
1653 for architectures which are either NUMA (Non-Uniform Memory Access)
1654 or have huge holes in the physical address space for other reasons.
1655 See <file:Documentation/vm/numa> for more.
1656
1657config NUMA
1658 bool "NUMA Support"
1659 depends on SYS_SUPPORTS_NUMA
1660 help
1661 Say Y to compile the kernel to support NUMA (Non-Uniform Memory
1662 Access). This option improves performance on systems with more
1663 than two nodes; on two node systems it is generally better to
1664 leave it disabled; on single node systems disable this option
1665 disabled.
1666
1667config SYS_SUPPORTS_NUMA
1668 bool
1669
1610config NODES_SHIFT 1670config NODES_SHIFT
1611 int 1671 int
1612 default "6" 1672 default "6"
@@ -1651,6 +1711,77 @@ config NR_CPUS
1651 This is purely to save memory - each supported CPU adds 1711 This is purely to save memory - each supported CPU adds
1652 approximately eight kilobytes to the kernel image. 1712 approximately eight kilobytes to the kernel image.
1653 1713
1714#
1715# Timer Interrupt Frequency Configuration
1716#
1717
1718choice
1719 prompt "Timer frequency"
1720 default HZ_250
1721 help
1722 Allows the configuration of the timer frequency.
1723
1724 config HZ_48
1725 bool "48 HZ" if SYS_SUPPORTS_48HZ
1726
1727 config HZ_100
1728 bool "100 HZ" if SYS_SUPPORTS_100HZ || SYS_SUPPORTS_ARBIT_HZ
1729
1730 config HZ_128
1731 bool "128 HZ" if SYS_SUPPORTS_128HZ || SYS_SUPPORTS_ARBIT_HZ
1732
1733 config HZ_250
1734 bool "250 HZ" if SYS_SUPPORTS_250HZ || SYS_SUPPORTS_ARBIT_HZ
1735
1736 config HZ_256
1737 bool "256 HZ" if SYS_SUPPORTS_256HZ || SYS_SUPPORTS_ARBIT_HZ
1738
1739 config HZ_1000
1740 bool "1000 HZ" if SYS_SUPPORTS_1000HZ || SYS_SUPPORTS_ARBIT_HZ
1741
1742 config HZ_1024
1743 bool "1024 HZ" if SYS_SUPPORTS_1024HZ || SYS_SUPPORTS_ARBIT_HZ
1744
1745endchoice
1746
1747config SYS_SUPPORTS_48HZ
1748 bool
1749
1750config SYS_SUPPORTS_100HZ
1751 bool
1752
1753config SYS_SUPPORTS_128HZ
1754 bool
1755
1756config SYS_SUPPORTS_250HZ
1757 bool
1758
1759config SYS_SUPPORTS_256HZ
1760 bool
1761
1762config SYS_SUPPORTS_1000HZ
1763 bool
1764
1765config SYS_SUPPORTS_1024HZ
1766 bool
1767
1768config SYS_SUPPORTS_ARBIT_HZ
1769 bool
1770 default y if !SYS_SUPPORTS_48HZ && !SYS_SUPPORTS_100HZ && \
1771 !SYS_SUPPORTS_128HZ && !SYS_SUPPORTS_250HZ && \
1772 !SYS_SUPPORTS_256HZ && !SYS_SUPPORTS_1000HZ && \
1773 !SYS_SUPPORTS_1024HZ
1774
1775config HZ
1776 int
1777 default 48 if HZ_48
1778 default 100 if HZ_100
1779 default 128 if HZ_128
1780 default 250 if HZ_250
1781 default 256 if HZ_256
1782 default 1000 if HZ_1000
1783 default 1024 if HZ_1024
1784
1654source "kernel/Kconfig.preempt" 1785source "kernel/Kconfig.preempt"
1655 1786
1656config RTC_DS1742 1787config RTC_DS1742
@@ -1710,6 +1841,9 @@ source "drivers/pci/Kconfig"
1710config ISA 1841config ISA
1711 bool 1842 bool
1712 1843
1844config NO_ISA
1845 bool
1846
1713config EISA 1847config EISA
1714 bool "EISA support" 1848 bool "EISA support"
1715 depends on HW_HAS_EISA 1849 depends on HW_HAS_EISA
@@ -1840,6 +1974,32 @@ config PM
1840 bool "Power Management support (EXPERIMENTAL)" 1974 bool "Power Management support (EXPERIMENTAL)"
1841 depends on EXPERIMENTAL && SOC_AU1X00 1975 depends on EXPERIMENTAL && SOC_AU1X00
1842 1976
1977config APM
1978 tristate "Advanced Power Management Emulation"
1979 depends on PM
1980 ---help---
1981 APM is a BIOS specification for saving power using several different
1982 techniques. This is mostly useful for battery powered systems with
1983 APM compliant BIOSes. If you say Y here, the system time will be
1984 reset after a RESUME operation, the /proc/apm device will provide
1985 battery status information, and user-space programs will receive
1986 notification of APM "events" (e.g. battery status change).
1987
1988 In order to use APM, you will need supporting software. For location
1989 and more information, read <file:Documentation/pm.txt> and the
1990 Battery Powered Linux mini-HOWTO, available from
1991 <http://www.tldp.org/docs.html#howto>.
1992
1993 This driver does not spin down disk drives (see the hdparm(8)
1994 manpage ("man 8 hdparm") for that), and it doesn't turn off
1995 VESA-compliant "green" monitors.
1996
1997 Generally, if you don't have a battery in your machine, there isn't
1998 much point in using this driver and you should say N. If you get
1999 random kernel OOPSes or reboots that don't seem to be related to
2000 anything, try disabling/enabling this option (or disabling/enabling
2001 APM in your BIOS).
2002
1843endmenu 2003endmenu
1844 2004
1845source "net/Kconfig" 2005source "net/Kconfig"
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 133900aca992..d5930148495a 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -83,6 +83,8 @@ cflags-y += -msoft-float
83LDFLAGS_vmlinux += -G 0 -static -n -nostdlib 83LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
84MODFLAGS += -mlong-calls 84MODFLAGS += -mlong-calls
85 85
86cflags-y += -ffreestanding
87
86# 88#
87# We explicitly add the endianness specifier if needed, this allows 89# We explicitly add the endianness specifier if needed, this allows
88# to compile kernels with a toolchain for the other endianness. We 90# to compile kernels with a toolchain for the other endianness. We
@@ -285,6 +287,13 @@ cflags-$(CONFIG_MIPS_EV96100) += -Iinclude/asm-mips/mach-ev96100
285load-$(CONFIG_MIPS_EV96100) += 0xffffffff80100000 287load-$(CONFIG_MIPS_EV96100) += 0xffffffff80100000
286 288
287# 289#
290# Wind River PPMC Board (4KC + GT64120)
291#
292core-$(CONFIG_WR_PPMC) += arch/mips/gt64120/wrppmc/
293cflags-$(CONFIG_WR_PPMC) += -Iinclude/asm-mips/mach-wrppmc
294load-$(CONFIG_WR_PPMC) += 0xffffffff80100000
295
296#
288# Globespan IVR eval board with QED 5231 CPU 297# Globespan IVR eval board with QED 5231 CPU
289# 298#
290core-$(CONFIG_ITE_BOARD_GEN) += arch/mips/ite-boards/generic/ 299core-$(CONFIG_ITE_BOARD_GEN) += arch/mips/ite-boards/generic/
@@ -379,6 +388,13 @@ cflags-$(CONFIG_MOMENCO_OCELOT_3) += -Iinclude/asm-mips/mach-ocelot3
379load-$(CONFIG_MOMENCO_OCELOT_3) += 0xffffffff80100000 388load-$(CONFIG_MOMENCO_OCELOT_3) += 0xffffffff80100000
380 389
381# 390#
391# Basler eXcite
392#
393core-$(CONFIG_BASLER_EXCITE) += arch/mips/basler/excite/
394cflags-$(CONFIG_BASLER_EXCITE) += -Iinclude/asm-mips/mach-excite
395load-$(CONFIG_BASLER_EXCITE) += 0x80100000
396
397#
382# Momentum Jaguar ATX 398# Momentum Jaguar ATX
383# 399#
384core-$(CONFIG_MOMENCO_JAGUAR_ATX) += arch/mips/momentum/jaguar_atx/ 400core-$(CONFIG_MOMENCO_JAGUAR_ATX) += arch/mips/momentum/jaguar_atx/
@@ -395,18 +411,6 @@ load-$(CONFIG_MOMENCO_JAGUAR_ATX) += 0xffffffff80100000
395core-$(CONFIG_DDB5XXX_COMMON) += arch/mips/ddb5xxx/common/ 411core-$(CONFIG_DDB5XXX_COMMON) += arch/mips/ddb5xxx/common/
396 412
397# 413#
398# NEC DDB Vrc-5074
399#
400core-$(CONFIG_DDB5074) += arch/mips/ddb5xxx/ddb5074/
401load-$(CONFIG_DDB5074) += 0xffffffff80080000
402
403#
404# NEC DDB Vrc-5476
405#
406core-$(CONFIG_DDB5476) += arch/mips/ddb5xxx/ddb5476/
407load-$(CONFIG_DDB5476) += 0xffffffff80080000
408
409#
410# NEC DDB Vrc-5477 414# NEC DDB Vrc-5477
411# 415#
412core-$(CONFIG_DDB5477) += arch/mips/ddb5xxx/ddb5477/ 416core-$(CONFIG_DDB5477) += arch/mips/ddb5xxx/ddb5477/
@@ -468,6 +472,15 @@ libs-$(CONFIG_PNX8550_JBS) += arch/mips/philips/pnx8550/jbs/
468#cflags-$(CONFIG_PNX8550_JBS) += -Iinclude/asm-mips/mach-pnx8550 472#cflags-$(CONFIG_PNX8550_JBS) += -Iinclude/asm-mips/mach-pnx8550
469load-$(CONFIG_PNX8550_JBS) += 0xffffffff80060000 473load-$(CONFIG_PNX8550_JBS) += 0xffffffff80060000
470 474
475# NEC EMMA2RH boards
476#
477core-$(CONFIG_EMMA2RH) += arch/mips/emma2rh/common/
478cflags-$(CONFIG_EMMA2RH) += -Iinclude/asm-mips/mach-emma2rh
479
480# NEC EMMA2RH Mark-eins
481core-$(CONFIG_MARKEINS) += arch/mips/emma2rh/markeins/
482load-$(CONFIG_MARKEINS) += 0xffffffff88100000
483
471# 484#
472# SGI IP22 (Indy/Indigo2) 485# SGI IP22 (Indy/Indigo2)
473# 486#
diff --git a/arch/mips/au1000/common/au1xxx_irqmap.c b/arch/mips/au1000/common/au1xxx_irqmap.c
index 0b2c03c52319..5a1e3687cafa 100644
--- a/arch/mips/au1000/common/au1xxx_irqmap.c
+++ b/arch/mips/au1000/common/au1xxx_irqmap.c
@@ -55,7 +55,7 @@
55 * Careful if you change match 2 request! 55 * Careful if you change match 2 request!
56 * The interrupt handler is called directly from the low level dispatch code. 56 * The interrupt handler is called directly from the low level dispatch code.
57 */ 57 */
58au1xxx_irq_map_t au1xxx_ic0_map[] = { 58au1xxx_irq_map_t __initdata au1xxx_ic0_map[] = {
59 59
60#if defined(CONFIG_SOC_AU1000) 60#if defined(CONFIG_SOC_AU1000)
61 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 61 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0},
@@ -220,5 +220,5 @@ au1xxx_irq_map_t au1xxx_ic0_map[] = {
220 220
221}; 221};
222 222
223int au1xxx_ic0_nr_irqs = sizeof(au1xxx_ic0_map)/sizeof(au1xxx_irq_map_t); 223int __initdata au1xxx_ic0_nr_irqs = ARRAY_SIZE(au1xxx_ic0_map);
224 224
diff --git a/arch/mips/au1000/common/pci.c b/arch/mips/au1000/common/pci.c
index 4e5a6e1a9a6e..b1392abac809 100644
--- a/arch/mips/au1000/common/pci.c
+++ b/arch/mips/au1000/common/pci.c
@@ -40,17 +40,17 @@
40 40
41/* TBD */ 41/* TBD */
42static struct resource pci_io_resource = { 42static struct resource pci_io_resource = {
43 "pci IO space", 43 .start = PCI_IO_START,
44 (u32)PCI_IO_START, 44 .end = PCI_IO_END,
45 (u32)PCI_IO_END, 45 .name = "PCI IO space",
46 IORESOURCE_IO 46 .flags = IORESOURCE_IO
47}; 47};
48 48
49static struct resource pci_mem_resource = { 49static struct resource pci_mem_resource = {
50 "pci memory space", 50 .start = PCI_MEM_START,
51 (u32)PCI_MEM_START, 51 .end = PCI_MEM_END,
52 (u32)PCI_MEM_END, 52 .name = "PCI memory space",
53 IORESOURCE_MEM 53 .flags = IORESOURCE_MEM
54}; 54};
55 55
56extern struct pci_ops au1x_pci_ops; 56extern struct pci_ops au1x_pci_ops;
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 307e98c29ddc..97165b6b3894 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -49,17 +49,13 @@ extern void __init board_setup(void);
49extern void au1000_restart(char *); 49extern void au1000_restart(char *);
50extern void au1000_halt(void); 50extern void au1000_halt(void);
51extern void au1000_power_off(void); 51extern void au1000_power_off(void);
52extern struct resource ioport_resource;
53extern struct resource iomem_resource;
54extern void (*board_time_init)(void);
55extern void au1x_time_init(void); 52extern void au1x_time_init(void);
56extern void (*board_timer_setup)(struct irqaction *irq);
57extern void au1x_timer_setup(struct irqaction *irq); 53extern void au1x_timer_setup(struct irqaction *irq);
58extern void au1xxx_time_init(void); 54extern void au1xxx_time_init(void);
59extern void au1xxx_timer_setup(struct irqaction *irq); 55extern void au1xxx_timer_setup(struct irqaction *irq);
60extern void set_cpuspec(void); 56extern void set_cpuspec(void);
61 57
62void __init plat_setup(void) 58void __init plat_mem_setup(void)
63{ 59{
64 struct cpu_spec *sp; 60 struct cpu_spec *sp;
65 char *argptr; 61 char *argptr;
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
index f74d66a58a21..842e1b5ac4a1 100644
--- a/arch/mips/au1000/common/time.c
+++ b/arch/mips/au1000/common/time.c
@@ -50,10 +50,6 @@
50#include <linux/mc146818rtc.h> 50#include <linux/mc146818rtc.h>
51#include <linux/timex.h> 51#include <linux/timex.h>
52 52
53extern void do_softirq(void);
54extern volatile unsigned long wall_jiffies;
55unsigned long missed_heart_beats = 0;
56
57static unsigned long r4k_offset; /* Amount to increment compare reg each time */ 53static unsigned long r4k_offset; /* Amount to increment compare reg each time */
58static unsigned long r4k_cur; /* What counter should be at next timer irq */ 54static unsigned long r4k_cur; /* What counter should be at next timer irq */
59int no_au1xxx_32khz; 55int no_au1xxx_32khz;
@@ -388,10 +384,9 @@ static unsigned long do_fast_pm_gettimeoffset(void)
388} 384}
389#endif 385#endif
390 386
391void au1xxx_timer_setup(struct irqaction *irq) 387void __init au1xxx_timer_setup(struct irqaction *irq)
392{ 388{
393 unsigned int est_freq; 389 unsigned int est_freq;
394 extern unsigned long (*do_gettimeoffset)(void);
395 390
396 printk("calculating r4koff... "); 391 printk("calculating r4koff... ");
397 r4k_offset = cal_r4koff(); 392 r4k_offset = cal_r4koff();
diff --git a/arch/mips/au1000/csb250/irqmap.c b/arch/mips/au1000/csb250/irqmap.c
index 5cb1166be35c..57d60401905e 100644
--- a/arch/mips/au1000/csb250/irqmap.c
+++ b/arch/mips/au1000/csb250/irqmap.c
@@ -47,7 +47,7 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/au1000.h> 48#include <asm/au1000.h>
49 49
50au1xxx_irq_map_t au1xxx_irq_map[] = { 50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
51 51
52 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 52 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
53 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 53 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
@@ -57,4 +57,4 @@ au1xxx_irq_map_t au1xxx_irq_map[] = {
57 { AU1500_GPIO_207, INTC_INT_LOW_LEVEL, 0 }, 57 { AU1500_GPIO_207, INTC_INT_LOW_LEVEL, 0 },
58}; 58};
59 59
60int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 60int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/db1x00/irqmap.c b/arch/mips/au1000/db1x00/irqmap.c
index f63024a9893a..0138c5b7c860 100644
--- a/arch/mips/au1000/db1x00/irqmap.c
+++ b/arch/mips/au1000/db1x00/irqmap.c
@@ -80,7 +80,7 @@ char irq_tab_alchemy[][5] __initdata = {
80#endif 80#endif
81 81
82 82
83au1xxx_irq_map_t au1xxx_irq_map[] = { 83au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
84 84
85#ifndef CONFIG_MIPS_MIRAGE 85#ifndef CONFIG_MIPS_MIRAGE
86#ifdef CONFIG_MIPS_DB1550 86#ifdef CONFIG_MIPS_DB1550
@@ -101,4 +101,4 @@ au1xxx_irq_map_t au1xxx_irq_map[] = {
101 101
102}; 102};
103 103
104int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 104int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/hydrogen3/irqmap.c b/arch/mips/au1000/hydrogen3/irqmap.c
index 6eacaa0daa49..14e1ed37cf6b 100644
--- a/arch/mips/au1000/hydrogen3/irqmap.c
+++ b/arch/mips/au1000/hydrogen3/irqmap.c
@@ -47,10 +47,10 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/au1000.h> 48#include <asm/au1000.h>
49 49
50au1xxx_irq_map_t au1xxx_irq_map[] = { 50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
51 51
52 /* { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 }, */ 52 /* { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 }, */
53 { AU1000_GPIO_21, INTC_INT_LOW_LEVEL, 0 }, 53 { AU1000_GPIO_21, INTC_INT_LOW_LEVEL, 0 },
54}; 54};
55 55
56int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 56int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c
index f9a0a8b9def2..4693a4eb2b82 100644
--- a/arch/mips/au1000/mtx-1/irqmap.c
+++ b/arch/mips/au1000/mtx-1/irqmap.c
@@ -58,7 +58,7 @@ char irq_tab_alchemy[][5] __initdata = {
58 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */ 58 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
59}; 59};
60 60
61au1xxx_irq_map_t au1xxx_irq_map[] = { 61au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
62 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 62 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
63 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 63 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
64 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 64 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
@@ -66,4 +66,4 @@ au1xxx_irq_map_t au1xxx_irq_map[] = {
66 { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 }, 66 { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 },
67}; 67};
68 68
69int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 69int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/pb1000/irqmap.c b/arch/mips/au1000/pb1000/irqmap.c
index a3c460e3c23e..156500ba467f 100644
--- a/arch/mips/au1000/pb1000/irqmap.c
+++ b/arch/mips/au1000/pb1000/irqmap.c
@@ -47,8 +47,8 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h> 48#include <asm/mach-au1x00/au1000.h>
49 49
50au1xxx_irq_map_t au1xxx_irq_map[] = { 50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
51 { AU1000_GPIO_15, INTC_INT_LOW_LEVEL, 0 }, 51 { AU1000_GPIO_15, INTC_INT_LOW_LEVEL, 0 },
52}; 52};
53 53
54int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 54int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/pb1100/irqmap.c b/arch/mips/au1000/pb1100/irqmap.c
index 43be7158b9ab..d986916221b7 100644
--- a/arch/mips/au1000/pb1100/irqmap.c
+++ b/arch/mips/au1000/pb1100/irqmap.c
@@ -47,11 +47,11 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h> 48#include <asm/mach-au1x00/au1000.h>
49 49
50au1xxx_irq_map_t au1xxx_irq_map[] = { 50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
51 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted# 51 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted#
52 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG# 52 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG#
53 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ# 53 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ#
54 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, // DC_IRQ# 54 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, // DC_IRQ#
55}; 55};
56 56
57int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 57int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index 59e70e5cf325..bacc0c6bfe67 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -55,11 +55,11 @@
55#define PB1200_INT_END DB1200_INT_END 55#define PB1200_INT_END DB1200_INT_END
56#endif 56#endif
57 57
58au1xxx_irq_map_t au1xxx_irq_map[] = { 58au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
59 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade 59 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade
60}; 60};
61 61
62int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 62int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
63 63
64/* 64/*
65 * Support for External interrupts on the PbAu1200 Development platform. 65 * Support for External interrupts on the PbAu1200 Development platform.
diff --git a/arch/mips/au1000/pb1500/irqmap.c b/arch/mips/au1000/pb1500/irqmap.c
index 8cb76c2edb5e..409d1612bb63 100644
--- a/arch/mips/au1000/pb1500/irqmap.c
+++ b/arch/mips/au1000/pb1500/irqmap.c
@@ -52,7 +52,7 @@ char irq_tab_alchemy[][5] __initdata = {
52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */
53}; 53};
54 54
55au1xxx_irq_map_t au1xxx_irq_map[] = { 55au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
56 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 56 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
57 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 57 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
58 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 58 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
@@ -60,4 +60,4 @@ au1xxx_irq_map_t au1xxx_irq_map[] = {
60 { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 }, 60 { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 },
61}; 61};
62 62
63int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 63int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/pb1550/irqmap.c b/arch/mips/au1000/pb1550/irqmap.c
index 47c7a1c19f4b..24a9d186cf5a 100644
--- a/arch/mips/au1000/pb1550/irqmap.c
+++ b/arch/mips/au1000/pb1550/irqmap.c
@@ -52,9 +52,9 @@ char irq_tab_alchemy[][5] __initdata = {
52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 52 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */
53}; 53};
54 54
55au1xxx_irq_map_t au1xxx_irq_map[] = { 55au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
56 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 }, 56 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 },
57 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 }, 57 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 },
58}; 58};
59 59
60int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 60int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/xxs1500/irqmap.c b/arch/mips/au1000/xxs1500/irqmap.c
index 52f2f7daeb05..3844c6429e27 100644
--- a/arch/mips/au1000/xxs1500/irqmap.c
+++ b/arch/mips/au1000/xxs1500/irqmap.c
@@ -47,7 +47,7 @@
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/au1000.h> 48#include <asm/au1000.h>
49 49
50au1xxx_irq_map_t au1xxx_irq_map[] = { 50au1xxx_irq_map_t __initdata au1xxx_irq_map[] = {
51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
@@ -63,4 +63,4 @@ au1xxx_irq_map_t au1xxx_irq_map[] = {
63 { AU1000_GPIO_5, INTC_INT_LOW_LEVEL, 0 }, 63 { AU1000_GPIO_5, INTC_INT_LOW_LEVEL, 0 },
64}; 64};
65 65
66int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); 66int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/basler/excite/Makefile b/arch/mips/basler/excite/Makefile
new file mode 100644
index 000000000000..519142c2e4ef
--- /dev/null
+++ b/arch/mips/basler/excite/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for Basler eXcite
3#
4
5obj-$(CONFIG_BASLER_EXCITE) += excite_irq.o excite_prom.o excite_setup.o \
6 excite_device.o excite_procfs.o
7
8obj-$(CONFIG_KGDB) += excite_dbg_io.o
9obj-m += excite_iodev.o
diff --git a/arch/mips/basler/excite/excite_dbg_io.c b/arch/mips/basler/excite/excite_dbg_io.c
new file mode 100644
index 000000000000..83f6bddf578b
--- /dev/null
+++ b/arch/mips/basler/excite/excite_dbg_io.c
@@ -0,0 +1,122 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/config.h>
21#include <linux/linkage.h>
22#include <linux/init.h>
23#include <linux/kernel.h>
24#include <asm/gdb-stub.h>
25#include <asm/rm9k-ocd.h>
26#include <excite.h>
27
28#if defined(CONFIG_SERIAL_8250) && CONFIG_SERIAL_8250_NR_UARTS > 1
29#error Debug port used by serial driver
30#endif
31
32#define UART_CLK 25000000
33#define BASE_BAUD (UART_CLK / 16)
34#define REGISTER_BASE_0 0x0208UL
35#define REGISTER_BASE_1 0x0238UL
36
37#define REGISTER_BASE_DBG REGISTER_BASE_1
38
39#define CPRR 0x0004
40#define UACFG 0x0200
41#define UAINTS 0x0204
42#define UARBR (REGISTER_BASE_DBG + 0x0000)
43#define UATHR (REGISTER_BASE_DBG + 0x0004)
44#define UADLL (REGISTER_BASE_DBG + 0x0008)
45#define UAIER (REGISTER_BASE_DBG + 0x000c)
46#define UADLH (REGISTER_BASE_DBG + 0x0010)
47#define UAIIR (REGISTER_BASE_DBG + 0x0014)
48#define UAFCR (REGISTER_BASE_DBG + 0x0018)
49#define UALCR (REGISTER_BASE_DBG + 0x001c)
50#define UAMCR (REGISTER_BASE_DBG + 0x0020)
51#define UALSR (REGISTER_BASE_DBG + 0x0024)
52#define UAMSR (REGISTER_BASE_DBG + 0x0028)
53#define UASCR (REGISTER_BASE_DBG + 0x002c)
54
55#define PARITY_NONE 0
56#define PARITY_ODD 0x08
57#define PARITY_EVEN 0x18
58#define PARITY_MARK 0x28
59#define PARITY_SPACE 0x38
60
61#define DATA_5BIT 0x0
62#define DATA_6BIT 0x1
63#define DATA_7BIT 0x2
64#define DATA_8BIT 0x3
65
66#define STOP_1BIT 0x0
67#define STOP_2BIT 0x4
68
69#define BAUD_DBG 57600
70#define PARITY_DBG PARITY_NONE
71#define DATA_DBG DATA_8BIT
72#define STOP_DBG STOP_1BIT
73
74/* Initialize the serial port for KGDB debugging */
75void __init excite_kgdb_init(void)
76{
77 const u32 divisor = BASE_BAUD / BAUD_DBG;
78
79 /* Take the UART out of reset */
80 titan_writel(0x00ff1cff, CPRR);
81 titan_writel(0x00000000, UACFG);
82 titan_writel(0x00000002, UACFG);
83
84 titan_writel(0x0, UALCR);
85 titan_writel(0x0, UAIER);
86
87 /* Disable FIFOs */
88 titan_writel(0x00, UAFCR);
89
90 titan_writel(0x80, UALCR);
91 titan_writel(divisor & 0xff, UADLL);
92 titan_writel((divisor & 0xff00) >> 8, UADLH);
93 titan_writel(0x0, UALCR);
94
95 titan_writel(DATA_DBG | PARITY_DBG | STOP_DBG, UALCR);
96
97 /* Enable receiver interrupt */
98 titan_readl(UARBR);
99 titan_writel(0x1, UAIER);
100}
101
102int getDebugChar(void)
103{
104 while (!(titan_readl(UALSR) & 0x1));
105 return titan_readl(UARBR);
106}
107
108int putDebugChar(int data)
109{
110 while (!(titan_readl(UALSR) & 0x20));
111 titan_writel(data, UATHR);
112 return 1;
113}
114
115/* KGDB interrupt handler */
116asmlinkage void excite_kgdb_inthdl(struct pt_regs *regs)
117{
118 if (unlikely(
119 ((titan_readl(UAIIR) & 0x7) == 4)
120 && ((titan_readl(UARBR) & 0xff) == 0x3)))
121 set_async_breakpoint(&regs->cp0_epc);
122}
diff --git a/arch/mips/basler/excite/excite_device.c b/arch/mips/basler/excite/excite_device.c
new file mode 100644
index 000000000000..34ec76716fa0
--- /dev/null
+++ b/arch/mips/basler/excite/excite_device.c
@@ -0,0 +1,404 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/config.h>
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/platform_device.h>
24#include <linux/ioport.h>
25#include <linux/err.h>
26#include <linux/jiffies.h>
27#include <linux/sched.h>
28#include <asm/types.h>
29#include <asm/rm9k-ocd.h>
30
31#include <excite.h>
32#include <rm9k_eth.h>
33#include <rm9k_wdt.h>
34#include <rm9k_xicap.h>
35#include <excite_nandflash.h>
36
37#include "excite_iodev.h"
38
39#define RM9K_GE_UNIT 0
40#define XICAP_UNIT 0
41#define NAND_UNIT 0
42
43#define DLL_TIMEOUT 3 /* seconds */
44
45
46#define RINIT(__start__, __end__, __name__, __parent__) { \
47 .name = __name__ "_0", \
48 .start = (__start__), \
49 .end = (__end__), \
50 .flags = 0, \
51 .parent = (__parent__) \
52}
53
54#define RINIT_IRQ(__irq__, __name__) { \
55 .name = __name__ "_0", \
56 .start = (__irq__), \
57 .end = (__irq__), \
58 .flags = IORESOURCE_IRQ, \
59 .parent = NULL \
60}
61
62
63
64enum {
65 slice_xicap,
66 slice_eth
67};
68
69
70
71static struct resource
72 excite_ctr_resource = {
73 .name = "GPI counters",
74 .start = 0,
75 .end = 5,
76 .flags = 0,
77 .parent = NULL,
78 .sibling = NULL,
79 .child = NULL
80 },
81 excite_gpislice_resource = {
82 .name = "GPI slices",
83 .start = 0,
84 .end = 1,
85 .flags = 0,
86 .parent = NULL,
87 .sibling = NULL,
88 .child = NULL
89 },
90 excite_mdio_channel_resource = {
91 .name = "MDIO channels",
92 .start = 0,
93 .end = 1,
94 .flags = 0,
95 .parent = NULL,
96 .sibling = NULL,
97 .child = NULL
98 },
99 excite_fifomem_resource = {
100 .name = "FIFO memory",
101 .start = 0,
102 .end = 767,
103 .flags = 0,
104 .parent = NULL,
105 .sibling = NULL,
106 .child = NULL
107 },
108 excite_scram_resource = {
109 .name = "Scratch RAM",
110 .start = EXCITE_PHYS_SCRAM,
111 .end = EXCITE_PHYS_SCRAM + EXCITE_SIZE_SCRAM - 1,
112 .flags = IORESOURCE_MEM,
113 .parent = NULL,
114 .sibling = NULL,
115 .child = NULL
116 },
117 excite_fpga_resource = {
118 .name = "System FPGA",
119 .start = EXCITE_PHYS_FPGA,
120 .end = EXCITE_PHYS_FPGA + EXCITE_SIZE_FPGA - 1,
121 .flags = IORESOURCE_MEM,
122 .parent = NULL,
123 .sibling = NULL,
124 .child = NULL
125 },
126 excite_nand_resource = {
127 .name = "NAND flash control",
128 .start = EXCITE_PHYS_NAND,
129 .end = EXCITE_PHYS_NAND + EXCITE_SIZE_NAND - 1,
130 .flags = IORESOURCE_MEM,
131 .parent = NULL,
132 .sibling = NULL,
133 .child = NULL
134 },
135 excite_titan_resource = {
136 .name = "TITAN registers",
137 .start = EXCITE_PHYS_TITAN,
138 .end = EXCITE_PHYS_TITAN + EXCITE_SIZE_TITAN - 1,
139 .flags = IORESOURCE_MEM,
140 .parent = NULL,
141 .sibling = NULL,
142 .child = NULL
143 };
144
145
146
147static void adjust_resources(struct resource *res, unsigned int n)
148{
149 struct resource *p;
150 const unsigned long mask = IORESOURCE_IO | IORESOURCE_MEM
151 | IORESOURCE_IRQ | IORESOURCE_DMA;
152
153 for (p = res; p < res + n; p++) {
154 const struct resource * const parent = p->parent;
155 if (parent) {
156 p->start += parent->start;
157 p->end += parent->start;
158 p->flags = parent->flags & mask;
159 }
160 }
161}
162
163
164
165#if defined(CONFIG_EXCITE_FCAP_GPI) || defined(CONFIG_EXCITE_FCAP_GPI_MODULE)
166static struct resource xicap_rsrc[] = {
167 RINIT(0x4840, 0x486f, XICAP_RESOURCE_FIFO_RX, &excite_titan_resource),
168 RINIT(0x4940, 0x494b, XICAP_RESOURCE_FIFO_TX, &excite_titan_resource),
169 RINIT(0x5040, 0x5127, XICAP_RESOURCE_XDMA, &excite_titan_resource),
170 RINIT(0x1000, 0x112f, XICAP_RESOURCE_PKTPROC, &excite_titan_resource),
171 RINIT(0x1100, 0x110f, XICAP_RESOURCE_PKT_STREAM, &excite_fpga_resource),
172 RINIT(0x0800, 0x0bff, XICAP_RESOURCE_DMADESC, &excite_scram_resource),
173 RINIT(slice_xicap, slice_xicap, XICAP_RESOURCE_GPI_SLICE, &excite_gpislice_resource),
174 RINIT(0x0100, 0x02ff, XICAP_RESOURCE_FIFO_BLK, &excite_fifomem_resource),
175 RINIT_IRQ(TITAN_IRQ, XICAP_RESOURCE_IRQ)
176};
177
178static struct platform_device xicap_pdev = {
179 .name = XICAP_NAME,
180 .id = XICAP_UNIT,
181 .num_resources = ARRAY_SIZE(xicap_rsrc),
182 .resource = xicap_rsrc
183};
184
185/*
186 * Create a platform device for the GPI port that receives the
187 * image data from the embedded camera.
188 */
189static int __init xicap_devinit(void)
190{
191 unsigned long tend;
192 u32 reg;
193 int retval;
194
195 adjust_resources(xicap_rsrc, ARRAY_SIZE(xicap_rsrc));
196
197 /* Power up the slice and configure it. */
198 reg = titan_readl(CPTC1R);
199 reg &= ~(0x11100 << slice_xicap);
200 titan_writel(reg, CPTC1R);
201
202 /* Enable slice & DLL. */
203 reg= titan_readl(CPRR);
204 reg &= ~(0x00030003 << (slice_xicap * 2));
205 titan_writel(reg, CPRR);
206
207 /* Wait for DLLs to lock */
208 tend = jiffies + DLL_TIMEOUT * HZ;
209 while (time_before(jiffies, tend)) {
210 if (!(~titan_readl(CPDSR) & (0x1 << (slice_xicap * 4))))
211 break;
212 yield();
213 }
214
215 if (~titan_readl(CPDSR) & (0x1 << (slice_xicap * 4))) {
216 printk(KERN_ERR "%s: DLL not locked after %u seconds\n",
217 xicap_pdev.name, DLL_TIMEOUT);
218 retval = -ETIME;
219 } else {
220 /* Register platform device */
221 retval = platform_device_register(&xicap_pdev);
222 }
223
224 return retval;
225}
226
227device_initcall(xicap_devinit);
228#endif /* defined(CONFIG_EXCITE_FCAP_GPI) || defined(CONFIG_EXCITE_FCAP_GPI_MODULE) */
229
230
231
232#if defined(CONFIG_WDT_RM9K_GPI) || defined(CONFIG_WDT_RM9K_GPI_MODULE)
233static struct resource wdt_rsrc[] = {
234 RINIT(0, 0, WDT_RESOURCE_COUNTER, &excite_ctr_resource),
235 RINIT(0x0084, 0x008f, WDT_RESOURCE_REGS, &excite_titan_resource),
236 RINIT_IRQ(TITAN_IRQ, WDT_RESOURCE_IRQ)
237};
238
239static struct platform_device wdt_pdev = {
240 .name = WDT_NAME,
241 .id = -1,
242 .num_resources = ARRAY_SIZE(wdt_rsrc),
243 .resource = wdt_rsrc
244};
245
246/*
247 * Create a platform device for the GPI port that receives the
248 * image data from the embedded camera.
249 */
250static int __init wdt_devinit(void)
251{
252 adjust_resources(wdt_rsrc, ARRAY_SIZE(wdt_rsrc));
253 return platform_device_register(&wdt_pdev);
254}
255
256device_initcall(wdt_devinit);
257#endif /* defined(CONFIG_WDT_RM9K_GPI) || defined(CONFIG_WDT_RM9K_GPI_MODULE) */
258
259
260
261static struct resource excite_nandflash_rsrc[] = {
262 RINIT(0x2000, 0x201f, EXCITE_NANDFLASH_RESOURCE_REGS, &excite_nand_resource)
263};
264
265static struct platform_device excite_nandflash_pdev = {
266 .name = "excite_nand",
267 .id = NAND_UNIT,
268 .num_resources = ARRAY_SIZE(excite_nandflash_rsrc),
269 .resource = excite_nandflash_rsrc
270};
271
272/*
273 * Create a platform device for the access to the nand-flash
274 * port
275 */
276static int __init excite_nandflash_devinit(void)
277{
278 adjust_resources(excite_nandflash_rsrc, ARRAY_SIZE(excite_nandflash_rsrc));
279
280 /* nothing to be done here */
281
282 /* Register platform device */
283 return platform_device_register(&excite_nandflash_pdev);
284}
285
286device_initcall(excite_nandflash_devinit);
287
288
289
290static struct resource iodev_rsrc[] = {
291 RINIT_IRQ(FPGA1_IRQ, IODEV_RESOURCE_IRQ)
292};
293
294static struct platform_device io_pdev = {
295 .name = IODEV_NAME,
296 .id = -1,
297 .num_resources = ARRAY_SIZE(iodev_rsrc),
298 .resource = iodev_rsrc
299};
300
301/*
302 * Create a platform device for the external I/O ports.
303 */
304static int __init io_devinit(void)
305{
306 adjust_resources(iodev_rsrc, ARRAY_SIZE(iodev_rsrc));
307 return platform_device_register(&io_pdev);
308}
309
310device_initcall(io_devinit);
311
312
313
314
315#if defined(CONFIG_RM9K_GE) || defined(CONFIG_RM9K_GE_MODULE)
316static struct resource rm9k_ge_rsrc[] = {
317 RINIT(0x2200, 0x27ff, RM9K_GE_RESOURCE_MAC, &excite_titan_resource),
318 RINIT(0x1800, 0x1fff, RM9K_GE_RESOURCE_MSTAT, &excite_titan_resource),
319 RINIT(0x2000, 0x212f, RM9K_GE_RESOURCE_PKTPROC, &excite_titan_resource),
320 RINIT(0x5140, 0x5227, RM9K_GE_RESOURCE_XDMA, &excite_titan_resource),
321 RINIT(0x4870, 0x489f, RM9K_GE_RESOURCE_FIFO_RX, &excite_titan_resource),
322 RINIT(0x494c, 0x4957, RM9K_GE_RESOURCE_FIFO_TX, &excite_titan_resource),
323 RINIT(0x0000, 0x007f, RM9K_GE_RESOURCE_FIFOMEM_RX, &excite_fifomem_resource),
324 RINIT(0x0080, 0x00ff, RM9K_GE_RESOURCE_FIFOMEM_TX, &excite_fifomem_resource),
325 RINIT(0x0180, 0x019f, RM9K_GE_RESOURCE_PHY, &excite_titan_resource),
326 RINIT(0x0000, 0x03ff, RM9K_GE_RESOURCE_DMADESC_RX, &excite_scram_resource),
327 RINIT(0x0400, 0x07ff, RM9K_GE_RESOURCE_DMADESC_TX, &excite_scram_resource),
328 RINIT(slice_eth, slice_eth, RM9K_GE_RESOURCE_GPI_SLICE, &excite_gpislice_resource),
329 RINIT(0, 0, RM9K_GE_RESOURCE_MDIO_CHANNEL, &excite_mdio_channel_resource),
330 RINIT_IRQ(TITAN_IRQ, RM9K_GE_RESOURCE_IRQ_MAIN),
331 RINIT_IRQ(PHY_IRQ, RM9K_GE_RESOURCE_IRQ_PHY)
332};
333
334static struct platform_device rm9k_ge_pdev = {
335 .name = RM9K_GE_NAME,
336 .id = RM9K_GE_UNIT,
337 .num_resources = ARRAY_SIZE(rm9k_ge_rsrc),
338 .resource = rm9k_ge_rsrc
339};
340
341
342
343/*
344 * Create a platform device for the Ethernet port.
345 */
346static int __init rm9k_ge_devinit(void)
347{
348 u32 reg;
349
350 adjust_resources(rm9k_ge_rsrc, ARRAY_SIZE(rm9k_ge_rsrc));
351
352 /* Power up the slice and configure it. */
353 reg = titan_readl(CPTC1R);
354 reg &= ~(0x11000 << slice_eth);
355 reg |= 0x100 << slice_eth;
356 titan_writel(reg, CPTC1R);
357
358 /* Take the MAC out of reset, reset the DLLs. */
359 reg = titan_readl(CPRR);
360 reg &= ~(0x00030000 << (slice_eth * 2));
361 reg |= 0x3 << (slice_eth * 2);
362 titan_writel(reg, CPRR);
363
364 return platform_device_register(&rm9k_ge_pdev);
365}
366
367device_initcall(rm9k_ge_devinit);
368#endif /* defined(CONFIG_RM9K_GE) || defined(CONFIG_RM9K_GE_MODULE) */
369
370
371
372static int __init excite_setup_devs(void)
373{
374 int res;
375 u32 reg;
376
377 /* Enable xdma and fifo interrupts */
378 reg = titan_readl(0x0050);
379 titan_writel(reg | 0x18000000, 0x0050);
380
381 res = request_resource(&iomem_resource, &excite_titan_resource);
382 if (res)
383 return res;
384 res = request_resource(&iomem_resource, &excite_scram_resource);
385 if (res)
386 return res;
387 res = request_resource(&iomem_resource, &excite_fpga_resource);
388 if (res)
389 return res;
390 res = request_resource(&iomem_resource, &excite_nand_resource);
391 if (res)
392 return res;
393 excite_fpga_resource.flags = excite_fpga_resource.parent->flags &
394 ( IORESOURCE_IO | IORESOURCE_MEM
395 | IORESOURCE_IRQ | IORESOURCE_DMA);
396 excite_nand_resource.flags = excite_nand_resource.parent->flags &
397 ( IORESOURCE_IO | IORESOURCE_MEM
398 | IORESOURCE_IRQ | IORESOURCE_DMA);
399
400 return 0;
401}
402
403arch_initcall(excite_setup_devs);
404
diff --git a/arch/mips/basler/excite/excite_flashtest.c b/arch/mips/basler/excite/excite_flashtest.c
new file mode 100644
index 000000000000..f0024a8e3294
--- /dev/null
+++ b/arch/mips/basler/excite/excite_flashtest.c
@@ -0,0 +1,294 @@
1/*
2* Copyright (C) 2005 by Basler Vision Technologies AG
3* Author: Thies Moeller <thies.moeller@baslerweb.com>
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation; either version 2 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program; if not, write to the Free Software
17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20#include <linux/module.h>
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/kernel.h>
24#include <linux/string.h>
25#include <linux/ioport.h>
26#include <linux/device.h>
27#include <linux/delay.h>
28#include <linux/err.h>
29#include <linux/kernel.h>
30
31#include <excite.h>
32
33#include <asm/io.h>
34
35#include <linux/mtd/mtd.h>
36#include <linux/mtd/nand.h>
37#include <linux/mtd/nand_ecc.h>
38#include <linux/mtd/partitions.h>
39#include <asm/rm9k-ocd.h> // for ocd_write
40#include <linux/workqueue.h> // for queue
41
42#include "excite_nandflash.h"
43#include "nandflash.h"
44
45#define PFX "excite flashtest: "
46typedef void __iomem *io_reg_t;
47
48#define io_readb(__a__) __raw_readb((__a__))
49#define io_writeb(__v__, __a__) __raw_writeb((__v__), (__a__))
50
51
52
53static inline const struct resource *excite_nandflash_get_resource(
54 struct platform_device *d, unsigned long flags, const char *basename)
55{
56 const char fmt[] = "%s_%u";
57 char buf[80];
58
59 if (unlikely(snprintf(buf, sizeof buf, fmt, basename, d->id) >= sizeof buf))
60 return NULL;
61
62 return platform_get_resource_byname(d, flags, buf);
63}
64
65static inline io_reg_t
66excite_nandflash_map_regs(struct platform_device *d, const char *basename)
67{
68 void *result = NULL;
69 const struct resource *const r =
70 excite_nandflash_get_resource(d, IORESOURCE_MEM, basename);
71 if (r)
72 result = ioremap_nocache(r->start, r->end + 1 - r->start);
73 return result;
74}
75
76/* controller and mtd information */
77
78struct excite_nandflash_drvdata {
79 struct mtd_info board_mtd;
80 struct nand_chip board_chip;
81 io_reg_t regs;
82};
83
84
85/* command and control functions */
86static void excite_nandflash_hwcontrol(struct mtd_info *mtd, int cmd)
87{
88 struct nand_chip *this = mtd->priv;
89 io_reg_t regs = container_of(mtd,struct excite_nandflash_drvdata,board_mtd)->regs;
90
91 switch (cmd) {
92 /* Select the command latch */
93 case NAND_CTL_SETCLE: this->IO_ADDR_W = regs + EXCITE_NANDFLASH_CMD;
94 break;
95 /* Deselect the command latch */
96 case NAND_CTL_CLRCLE: this->IO_ADDR_W = regs + EXCITE_NANDFLASH_DATA;
97 break;
98 /* Select the address latch */
99 case NAND_CTL_SETALE: this->IO_ADDR_W = regs + EXCITE_NANDFLASH_ADDR;
100 break;
101 /* Deselect the address latch */
102 case NAND_CTL_CLRALE: this->IO_ADDR_W = regs + EXCITE_NANDFLASH_DATA;
103 break;
104 /* Select the chip -- not used */
105 case NAND_CTL_SETNCE:
106 break;
107 /* Deselect the chip -- not used */
108 case NAND_CTL_CLRNCE:
109 break;
110 }
111
112 this->IO_ADDR_R = this->IO_ADDR_W;
113}
114
115/* excite_nandflash_devready()
116 *
117 * returns 0 if the nand is busy, 1 if it is ready
118 */
119static int excite_nandflash_devready(struct mtd_info *mtd)
120{
121 struct excite_nandflash_drvdata *drvdata =
122 container_of(mtd, struct excite_nandflash_drvdata, board_mtd);
123
124 return io_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS);
125}
126
127/* device management functions */
128
129/* excite_nandflash_remove
130 *
131 * called by device layer to remove the driver
132 * the binding to the mtd and all allocated
133 * resources are released
134 */
135static int excite_nandflash_remove(struct device *dev)
136{
137 struct excite_nandflash_drvdata *this = dev_get_drvdata(dev);
138
139 pr_info(PFX "remove");
140
141 dev_set_drvdata(dev, NULL);
142
143 if (this == NULL) {
144 pr_debug(PFX "call remove without private data!!");
145 return 0;
146 }
147
148
149 /* free the common resources */
150 if (this->regs != NULL) {
151 iounmap(this->regs);
152 this->regs = NULL;
153 }
154
155 kfree(this);
156
157 return 0;
158}
159
160static int elapsed;
161
162void my_workqueue_handler(void *arg)
163{
164 elapsed = 1;
165}
166
167DECLARE_WORK(sigElapsed, my_workqueue_handler, 0);
168
169
170/* excite_nandflash_probe
171 *
172 * called by device layer when it finds a device matching
173 * one our driver can handled. This code checks to see if
174 * it can allocate all necessary resources then calls the
175 * nand layer to look for devices
176*/
177static int excite_nandflash_probe(struct device *dev)
178{
179 struct platform_device *pdev = to_platform_device(dev);
180
181 struct excite_nandflash_drvdata *drvdata; /* private driver data */
182 struct nand_chip *board_chip; /* private flash chip data */
183 struct mtd_info *board_mtd; /* mtd info for this board */
184
185 int err = 0;
186 int count = 0;
187 struct timeval tv,endtv;
188 unsigned int dt;
189
190 pr_info(PFX "probe dev: (%p)\n", dev);
191
192 pr_info(PFX "adjust LB timing\n");
193 ocd_writel(0x00000330, LDP2);
194
195 drvdata = kmalloc(sizeof(*drvdata), GFP_KERNEL);
196 if (unlikely(!drvdata)) {
197 printk(KERN_ERR PFX "no memory for drvdata\n");
198 err = -ENOMEM;
199 goto mem_error;
200 }
201
202 /* Initialize structures */
203 memset(drvdata, 0, sizeof(*drvdata));
204
205 /* bind private data into driver */
206 dev_set_drvdata(dev, drvdata);
207
208 /* allocate and map the resource */
209 drvdata->regs =
210 excite_nandflash_map_regs(pdev, EXCITE_NANDFLASH_RESOURCE_REGS);
211
212 if (unlikely(!drvdata->regs)) {
213 printk(KERN_ERR PFX "cannot reserve register region\n");
214 err = -ENXIO;
215 goto io_error;
216 }
217
218 /* initialise our chip */
219 board_chip = &drvdata->board_chip;
220
221 board_chip->IO_ADDR_R = drvdata->regs + EXCITE_NANDFLASH_DATA;
222 board_chip->IO_ADDR_W = drvdata->regs + EXCITE_NANDFLASH_DATA;
223
224 board_chip->hwcontrol = excite_nandflash_hwcontrol;
225 board_chip->dev_ready = excite_nandflash_devready;
226
227 board_chip->chip_delay = 25;
228 #if 0
229 /* TODO: speedup the initial scan */
230 board_chip->options = NAND_USE_FLASH_BBT;
231 #endif
232 board_chip->eccmode = NAND_ECC_SOFT;
233
234 /* link chip to mtd */
235 board_mtd = &drvdata->board_mtd;
236 board_mtd->priv = board_chip;
237
238
239 pr_info(PFX "FlashTest\n");
240 elapsed = 0;
241/* schedule_delayed_work(&sigElapsed, 1*HZ);
242 while (!elapsed) {
243 io_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS);
244 count++;
245 }
246 pr_info(PFX "reads in 1 sec --> %d\n",count);
247*/
248 do_gettimeofday(&tv);
249 for (count = 0 ; count < 1000000; count ++) {
250 io_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS);
251 }
252 do_gettimeofday(&endtv);
253 dt = (endtv.tv_sec - tv.tv_sec) * 1000000 + endtv.tv_usec - tv.tv_usec;
254 pr_info(PFX "%8d us timeval\n",dt);
255 pr_info(PFX "EndFlashTest\n");
256
257/* return with error to unload everything
258*/
259io_error:
260 iounmap(drvdata->regs);
261
262mem_error:
263 kfree(drvdata);
264
265 if (err == 0)
266 err = -EINVAL;
267 return err;
268}
269
270static struct device_driver excite_nandflash_driver = {
271 .name = "excite_nand",
272 .bus = &platform_bus_type,
273 .probe = excite_nandflash_probe,
274 .remove = excite_nandflash_remove,
275};
276
277static int __init excite_nandflash_init(void)
278{
279 pr_info(PFX "register Driver (Rev: $Revision:$)\n");
280 return driver_register(&excite_nandflash_driver);
281}
282
283static void __exit excite_nandflash_exit(void)
284{
285 driver_unregister(&excite_nandflash_driver);
286 pr_info(PFX "Driver unregistered");
287}
288
289module_init(excite_nandflash_init);
290module_exit(excite_nandflash_exit);
291
292MODULE_AUTHOR("Thies Moeller <thies.moeller@baslerweb.com>");
293MODULE_DESCRIPTION("Basler eXcite NAND-Flash driver");
294MODULE_LICENSE("GPL");
diff --git a/arch/mips/basler/excite/excite_fpga.h b/arch/mips/basler/excite/excite_fpga.h
new file mode 100644
index 000000000000..38fcda703a0b
--- /dev/null
+++ b/arch/mips/basler/excite/excite_fpga.h
@@ -0,0 +1,80 @@
1#ifndef EXCITE_FPGA_H_INCLUDED
2#define EXCITE_FPGA_H_INCLUDED
3
4
5/**
6 * Adress alignment of the individual FPGA bytes.
7 * The address arrangement of the individual bytes of the FPGA is two
8 * byte aligned at the embedded MK2 platform.
9 */
10#ifdef EXCITE_CCI_FPGA_MK2
11typedef unsigned char excite_cci_fpga_align_t __attribute__ ((aligned(2)));
12#else
13typedef unsigned char excite_cci_fpga_align_t;
14#endif
15
16
17/**
18 * Size of Dual Ported RAM.
19 */
20#define EXCITE_DPR_SIZE 263
21
22
23/**
24 * Size of Reserved Status Fields in Dual Ported RAM.
25 */
26#define EXCITE_DPR_STATUS_SIZE 7
27
28
29
30/**
31 * FPGA.
32 * Hardware register layout of the FPGA interface. The FPGA must accessed
33 * byte wise solely.
34 * @see EXCITE_CCI_DPR_MK2
35 */
36typedef struct excite_fpga {
37
38 /**
39 * Dual Ported RAM.
40 */
41 excite_cci_fpga_align_t dpr[EXCITE_DPR_SIZE];
42
43 /**
44 * Status.
45 */
46 excite_cci_fpga_align_t status[EXCITE_DPR_STATUS_SIZE];
47
48#ifdef EXCITE_CCI_FPGA_MK2
49 /**
50 * RM9000 Interrupt.
51 * Write access initiates interrupt at the RM9000 (MIPS) processor of the eXcite.
52 */
53 excite_cci_fpga_align_t rm9k_int;
54#else
55 /**
56 * MK2 Interrupt.
57 * Write access initiates interrupt at the ARM processor of the MK2.
58 */
59 excite_cci_fpga_align_t mk2_int;
60
61 excite_cci_fpga_align_t gap[0x1000-0x10f];
62
63 /**
64 * IRQ Source/Acknowledge.
65 */
66 excite_cci_fpga_align_t rm9k_irq_src;
67
68 /**
69 * IRQ Mask.
70 * Set bits enable the related interrupt.
71 */
72 excite_cci_fpga_align_t rm9k_irq_mask;
73#endif
74
75
76} excite_fpga;
77
78
79
80#endif /* ndef EXCITE_FPGA_H_INCLUDED */
diff --git a/arch/mips/basler/excite/excite_iodev.c b/arch/mips/basler/excite/excite_iodev.c
new file mode 100644
index 000000000000..91121e523043
--- /dev/null
+++ b/arch/mips/basler/excite/excite_iodev.c
@@ -0,0 +1,183 @@
1/*
2 * Copyright (C) 2005 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/config.h>
21#include <linux/compiler.h>
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/sched.h>
25#include <linux/wait.h>
26#include <linux/poll.h>
27#include <linux/interrupt.h>
28#include <linux/platform_device.h>
29#include <linux/miscdevice.h>
30
31#include "excite_iodev.h"
32
33
34
35static const struct resource *iodev_get_resource(struct platform_device *, const char *, unsigned int);
36static int __init iodev_probe(struct device *);
37static int __exit iodev_remove(struct device *);
38static int iodev_open(struct inode *, struct file *);
39static int iodev_release(struct inode *, struct file *);
40static ssize_t iodev_read(struct file *, char __user *, size_t s, loff_t *);
41static unsigned int iodev_poll(struct file *, struct poll_table_struct *);
42static irqreturn_t iodev_irqhdl(int, void *, struct pt_regs *);
43
44
45
46static const char iodev_name[] = "iodev";
47static unsigned int iodev_irq;
48static DECLARE_WAIT_QUEUE_HEAD(wq);
49
50
51
52static struct file_operations fops =
53{
54 .owner = THIS_MODULE,
55 .open = iodev_open,
56 .release = iodev_release,
57 .read = iodev_read,
58 .poll = iodev_poll
59};
60
61static struct miscdevice miscdev =
62{
63 .minor = MISC_DYNAMIC_MINOR,
64 .name = iodev_name,
65 .fops = &fops
66};
67
68static struct device_driver iodev_driver =
69{
70 .name = (char *) iodev_name,
71 .bus = &platform_bus_type,
72 .owner = THIS_MODULE,
73 .probe = iodev_probe,
74 .remove = __exit_p(iodev_remove)
75};
76
77
78
79static const struct resource *
80iodev_get_resource(struct platform_device *pdv, const char *name,
81 unsigned int type)
82{
83 char buf[80];
84 if (snprintf(buf, sizeof buf, "%s_0", name) >= sizeof buf)
85 return NULL;
86 return platform_get_resource_byname(pdv, type, buf);
87}
88
89
90
91/* No hotplugging on the platform bus - use __init */
92static int __init iodev_probe(struct device *dev)
93{
94 struct platform_device * const pdv = to_platform_device(dev);
95 const struct resource * const ri =
96 iodev_get_resource(pdv, IODEV_RESOURCE_IRQ, IORESOURCE_IRQ);
97
98 if (unlikely(!ri))
99 return -ENXIO;
100
101 iodev_irq = ri->start;
102 return misc_register(&miscdev);
103}
104
105
106
107static int __exit iodev_remove(struct device *dev)
108{
109 return misc_deregister(&miscdev);
110}
111
112
113
114static int iodev_open(struct inode *i, struct file *f)
115{
116 return request_irq(iodev_irq, iodev_irqhdl, SA_INTERRUPT,
117 iodev_name, &miscdev);
118}
119
120
121
122static int iodev_release(struct inode *i, struct file *f)
123{
124 free_irq(iodev_irq, &miscdev);
125 return 0;
126}
127
128
129
130
131static ssize_t
132iodev_read(struct file *f, char __user *d, size_t s, loff_t *o)
133{
134 ssize_t ret;
135 DEFINE_WAIT(w);
136
137 prepare_to_wait(&wq, &w, TASK_INTERRUPTIBLE);
138 if (!signal_pending(current))
139 schedule();
140 ret = signal_pending(current) ? -ERESTARTSYS : 0;
141 finish_wait(&wq, &w);
142 return ret;
143}
144
145
146static unsigned int iodev_poll(struct file *f, struct poll_table_struct *p)
147{
148 poll_wait(f, &wq, p);
149 return POLLOUT | POLLWRNORM;
150}
151
152
153
154
155static irqreturn_t iodev_irqhdl(int irq, void *ctxt, struct pt_regs *regs)
156{
157 wake_up(&wq);
158 return IRQ_HANDLED;
159}
160
161
162
163static int __init iodev_init_module(void)
164{
165 return driver_register(&iodev_driver);
166}
167
168
169
170static void __exit iodev_cleanup_module(void)
171{
172 driver_unregister(&iodev_driver);
173}
174
175module_init(iodev_init_module);
176module_exit(iodev_cleanup_module);
177
178
179
180MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
181MODULE_DESCRIPTION("Basler eXcite i/o interrupt handler");
182MODULE_VERSION("0.0");
183MODULE_LICENSE("GPL");
diff --git a/arch/mips/basler/excite/excite_iodev.h b/arch/mips/basler/excite/excite_iodev.h
new file mode 100644
index 000000000000..cbfbb5d2ee62
--- /dev/null
+++ b/arch/mips/basler/excite/excite_iodev.h
@@ -0,0 +1,10 @@
1#ifndef __EXCITE_IODEV_H__
2#define __EXCITE_IODEV_H__
3
4/* Device name */
5#define IODEV_NAME "iodev"
6
7/* Resource names */
8#define IODEV_RESOURCE_IRQ "excite_iodev_irq"
9
10#endif /* __EXCITE_IODEV_H__ */
diff --git a/arch/mips/basler/excite/excite_irq.c b/arch/mips/basler/excite/excite_irq.c
new file mode 100644
index 000000000000..511ad8730f54
--- /dev/null
+++ b/arch/mips/basler/excite/excite_irq.c
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslereb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/kernel_stat.h>
23#include <linux/module.h>
24#include <linux/signal.h>
25#include <linux/sched.h>
26#include <linux/types.h>
27#include <linux/interrupt.h>
28#include <linux/ioport.h>
29#include <linux/timex.h>
30#include <linux/slab.h>
31#include <linux/random.h>
32#include <asm/bitops.h>
33#include <asm/bootinfo.h>
34#include <asm/io.h>
35#include <asm/irq.h>
36#include <asm/irq_cpu.h>
37#include <asm/mipsregs.h>
38#include <asm/system.h>
39#include <asm/rm9k-ocd.h>
40
41#include <excite.h>
42
43extern asmlinkage void excite_handle_int(void);
44
45/*
46 * Initialize the interrupt handler
47 */
48void __init arch_init_irq(void)
49{
50 mips_cpu_irq_init(0);
51 rm7k_cpu_irq_init(8);
52 rm9k_cpu_irq_init(12);
53
54#ifdef CONFIG_KGDB
55 excite_kgdb_init();
56#endif
57}
58
59asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
60{
61 const u32
62 interrupts = read_c0_cause() >> 8,
63 mask = ((read_c0_status() >> 8) & 0x000000ff) |
64 (read_c0_intcontrol() & 0x0000ff00),
65 pending = interrupts & mask;
66 u32 msgintflags, msgintmask, msgint;
67
68 /* process timer interrupt */
69 if (pending & (1 << TIMER_IRQ)) {
70 do_IRQ(TIMER_IRQ, regs);
71 return;
72 }
73
74 /* Process PCI interrupts */
75#if USB_IRQ < 10
76 msgintflags = ocd_readl(INTP0Status0 + (USB_MSGINT / 0x20 * 0x10));
77 msgintmask = ocd_readl(INTP0Mask0 + (USB_MSGINT / 0x20 * 0x10));
78 msgint = msgintflags & msgintmask & (0x1 << (USB_MSGINT % 0x20));
79 if ((pending & (1 << USB_IRQ)) && msgint) {
80#else
81 if (pending & (1 << USB_IRQ)) {
82#endif
83 do_IRQ(USB_IRQ, regs);
84 return;
85 }
86
87 /* Process TITAN interrupts */
88 msgintflags = ocd_readl(INTP0Status0 + (TITAN_MSGINT / 0x20 * 0x10));
89 msgintmask = ocd_readl(INTP0Mask0 + (TITAN_MSGINT / 0x20 * 0x10));
90 msgint = msgintflags & msgintmask & (0x1 << (TITAN_MSGINT % 0x20));
91 if ((pending & (1 << TITAN_IRQ)) && msgint) {
92 ocd_writel(msgint, INTP0Clear0 + (TITAN_MSGINT / 0x20 * 0x10));
93#if defined(CONFIG_KGDB)
94 excite_kgdb_inthdl(regs);
95#endif
96 do_IRQ(TITAN_IRQ, regs);
97 return;
98 }
99
100 /* Process FPGA line #0 interrupts */
101 msgintflags = ocd_readl(INTP0Status0 + (FPGA0_MSGINT / 0x20 * 0x10));
102 msgintmask = ocd_readl(INTP0Mask0 + (FPGA0_MSGINT / 0x20 * 0x10));
103 msgint = msgintflags & msgintmask & (0x1 << (FPGA0_MSGINT % 0x20));
104 if ((pending & (1 << FPGA0_IRQ)) && msgint) {
105 do_IRQ(FPGA0_IRQ, regs);
106 return;
107 }
108
109 /* Process FPGA line #1 interrupts */
110 msgintflags = ocd_readl(INTP0Status0 + (FPGA1_MSGINT / 0x20 * 0x10));
111 msgintmask = ocd_readl(INTP0Mask0 + (FPGA1_MSGINT / 0x20 * 0x10));
112 msgint = msgintflags & msgintmask & (0x1 << (FPGA1_MSGINT % 0x20));
113 if ((pending & (1 << FPGA1_IRQ)) && msgint) {
114 do_IRQ(FPGA1_IRQ, regs);
115 return;
116 }
117
118 /* Process PHY interrupts */
119 msgintflags = ocd_readl(INTP0Status0 + (PHY_MSGINT / 0x20 * 0x10));
120 msgintmask = ocd_readl(INTP0Mask0 + (PHY_MSGINT / 0x20 * 0x10));
121 msgint = msgintflags & msgintmask & (0x1 << (PHY_MSGINT % 0x20));
122 if ((pending & (1 << PHY_IRQ)) && msgint) {
123 do_IRQ(PHY_IRQ, regs);
124 return;
125 }
126
127 /* Process spurious interrupts */
128 spurious_interrupt(regs);
129}
diff --git a/arch/mips/basler/excite/excite_procfs.c b/arch/mips/basler/excite/excite_procfs.c
new file mode 100644
index 000000000000..c62be0341fb8
--- /dev/null
+++ b/arch/mips/basler/excite/excite_procfs.c
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) 2004, 2005 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * Procfs support for Basler eXcite
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/config.h>
23#include <linux/proc_fs.h>
24#include <linux/stat.h>
25#include <asm/page.h>
26#include <asm/io.h>
27#include <asm/system.h>
28#include <asm/rm9k-ocd.h>
29
30#include <excite.h>
31
32static int excite_get_unit_id(char *buf, char **addr, off_t offs, int size)
33{
34 const int len = snprintf(buf, PAGE_SIZE, "%06x", unit_id);
35 const int w = len - offs;
36 *addr = buf + offs;
37 return w < size ? w : size;
38}
39
40static int
41excite_bootrom_read(char *page, char **start, off_t off, int count,
42 int *eof, void *data)
43{
44 void __iomem * src;
45
46 if (off >= EXCITE_SIZE_BOOTROM) {
47 *eof = 1;
48 return 0;
49 }
50
51 if ((off + count) > EXCITE_SIZE_BOOTROM)
52 count = EXCITE_SIZE_BOOTROM - off;
53
54 src = ioremap(EXCITE_PHYS_BOOTROM + off, count);
55 if (src) {
56 memcpy_fromio(page, src, count);
57 iounmap(src);
58 *start = page;
59 } else {
60 count = -ENOMEM;
61 }
62
63 return count;
64}
65
66void excite_procfs_init(void)
67{
68 /* Create & populate /proc/excite */
69 struct proc_dir_entry * const pdir = proc_mkdir("excite", &proc_root);
70 if (pdir) {
71 struct proc_dir_entry * e;
72
73 e = create_proc_info_entry("unit_id", S_IRUGO, pdir,
74 excite_get_unit_id);
75 if (e) e->size = 6;
76
77 e = create_proc_read_entry("bootrom", S_IRUGO, pdir,
78 excite_bootrom_read, NULL);
79 if (e) e->size = EXCITE_SIZE_BOOTROM;
80 }
81}
diff --git a/arch/mips/basler/excite/excite_prom.c b/arch/mips/basler/excite/excite_prom.c
new file mode 100644
index 000000000000..84724b270753
--- /dev/null
+++ b/arch/mips/basler/excite/excite_prom.c
@@ -0,0 +1,148 @@
1/*
2 * Copyright (C) 2004, 2005 by Thomas Koeller (thomas.koeller@baslerweb.com)
3 * Based on the PMC-Sierra Yosemite board support by Ralf Baechle and
4 * Manish Lachwani.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/config.h>
22#include <linux/init.h>
23#include <linux/sched.h>
24#include <linux/mm.h>
25#include <linux/delay.h>
26#include <linux/smp.h>
27#include <linux/module.h>
28#include <asm/io.h>
29#include <asm/pgtable.h>
30#include <asm/processor.h>
31#include <asm/reboot.h>
32#include <asm/system.h>
33#include <asm/bootinfo.h>
34#include <asm/string.h>
35
36#include <excite.h>
37
38/* This struct is used by Redboot to pass arguments to the kernel */
39typedef struct
40{
41 char *name;
42 char *val;
43} t_env_var;
44
45struct parmblock {
46 t_env_var memsize;
47 t_env_var modetty0;
48 t_env_var ethaddr;
49 t_env_var env_end;
50 char *argv[2];
51 char text[0];
52};
53
54static unsigned int prom_argc;
55static const char ** prom_argv;
56static const t_env_var * prom_env;
57
58static void prom_halt(void) __attribute__((noreturn));
59static void prom_exit(void) __attribute__((noreturn));
60
61
62
63const char *get_system_type(void)
64{
65 return "Basler eXcite";
66}
67
68/*
69 * Halt the system
70 */
71static void prom_halt(void)
72{
73 printk(KERN_NOTICE "\n** System halted.\n");
74 while (1)
75 asm volatile (
76 "\t.set\tmips3\n"
77 "\twait\n"
78 "\t.set\tmips0\n"
79 );
80}
81
82/*
83 * Reset the CPU and re-enter Redboot
84 */
85static void prom_exit(void)
86{
87 unsigned int i;
88 volatile unsigned char * const flg =
89 (volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_DPR);
90
91 /* Clear the watchdog reset flag, set the reboot flag */
92 *flg &= ~0x01;
93 *flg |= 0x80;
94
95 for (i = 0; i < 10; i++) {
96 *(volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_SYSCTL) = 0x02;
97 iob();
98 mdelay(1000);
99 }
100
101 printk(KERN_NOTICE "Reset failed\n");
102 prom_halt();
103}
104
105static const char __init *prom_getenv(char *name)
106{
107 const t_env_var * p;
108 for (p = prom_env; p->name != NULL; p++)
109 if(strcmp(name, p->name) == 0)
110 break;
111 return p->val;
112}
113
114/*
115 * Init routine which accepts the variables from Redboot
116 */
117void __init prom_init(void)
118{
119 const struct parmblock * const pb = (struct parmblock *) fw_arg2;
120
121 prom_argc = fw_arg0;
122 prom_argv = (const char **) fw_arg1;
123 prom_env = &pb->memsize;
124
125 /* Callbacks for halt, restart */
126 _machine_restart = (void (*)(char *)) prom_exit;
127 _machine_halt = prom_halt;
128
129#ifdef CONFIG_32BIT
130 /* copy command line */
131 strcpy(arcs_cmdline, prom_argv[1]);
132 memsize = simple_strtol(prom_getenv("memsize"), NULL, 16);
133 strcpy(modetty, prom_getenv("modetty0"));
134#endif /* CONFIG_32BIT */
135
136#ifdef CONFIG_64BIT
137# error 64 bit support not implemented
138#endif /* CONFIG_64BIT */
139
140 mips_machgroup = MACH_GROUP_TITAN;
141 mips_machtype = MACH_TITAN_EXCITE;
142}
143
144/* This is called from free_initmem(), so we need to provide it */
145void __init prom_free_prom_memory(void)
146{
147 /* Nothing to do */
148}
diff --git a/arch/mips/basler/excite/excite_setup.c b/arch/mips/basler/excite/excite_setup.c
new file mode 100644
index 000000000000..005b025605e6
--- /dev/null
+++ b/arch/mips/basler/excite/excite_setup.c
@@ -0,0 +1,307 @@
1/*
2 * Copyright (C) 2004, 2005 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 * Based on the PMC-Sierra Yosemite board support by Ralf Baechle and
5 * Manish Lachwani.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/config.h>
23#include <linux/types.h>
24#include <linux/kernel.h>
25#include <linux/module.h>
26#include <linux/string.h>
27#include <linux/tty.h>
28#include <linux/serial_core.h>
29#include <linux/serial.h>
30#include <linux/ioport.h>
31#include <linux/spinlock.h>
32#include <asm/bootinfo.h>
33#include <asm/mipsregs.h>
34#include <asm/pgtable-32.h>
35#include <asm/io.h>
36#include <asm/time.h>
37#include <asm/rm9k-ocd.h>
38
39#include <excite.h>
40
41#define TITAN_UART_CLK 25000000
42
43#if 1
44/* normal serial port assignment */
45#define REGBASE_SER0 0x0208
46#define REGBASE_SER1 0x0238
47#define MASK_SER0 0x1
48#define MASK_SER1 0x2
49#else
50/* serial ports swapped */
51#define REGBASE_SER0 0x0238
52#define REGBASE_SER1 0x0208
53#define MASK_SER0 0x2
54#define MASK_SER1 0x1
55#endif
56
57unsigned long memsize;
58char modetty[30];
59unsigned int titan_irq = TITAN_IRQ;
60static void __iomem * ctl_regs;
61u32 unit_id;
62
63volatile void __iomem * const ocd_base = (void *) (EXCITE_ADDR_OCD);
64volatile void __iomem * const titan_base = (void *) (EXCITE_ADDR_TITAN);
65
66/* Protect access to shared GPI registers */
67spinlock_t titan_lock = SPIN_LOCK_UNLOCKED;
68int titan_irqflags;
69
70
71static void excite_timer_init(void)
72{
73 const u32 modebit5 = ocd_readl(0x00e4);
74 unsigned int
75 mult = ((modebit5 >> 11) & 0x1f) + 2,
76 div = ((modebit5 >> 16) & 0x1f) + 2;
77
78 if (div == 33) div = 1;
79 mips_hpt_frequency = EXCITE_CPU_EXT_CLOCK * mult / div / 2;
80}
81
82static void excite_timer_setup(struct irqaction *irq)
83{
84 /* The eXcite platform uses the alternate timer interrupt */
85 set_c0_intcontrol(0x80);
86 setup_irq(TIMER_IRQ, irq);
87}
88
89static int __init excite_init_console(void)
90{
91#if defined(CONFIG_SERIAL_8250)
92 static __initdata char serr[] =
93 KERN_ERR "Serial port #%u setup failed\n";
94 struct uart_port up;
95
96 /* Take the DUART out of reset */
97 titan_writel(0x00ff1cff, CPRR);
98
99#if defined(CONFIG_KGDB) || (CONFIG_SERIAL_8250_NR_UARTS > 1)
100 /* Enable both ports */
101 titan_writel(MASK_SER0 | MASK_SER1, UACFG);
102#else
103 /* Enable port #0 only */
104 titan_writel(MASK_SER0, UACFG);
105#endif /* defined(CONFIG_KGDB) */
106
107 /*
108 * Set up serial port #0. Do not use autodetection; the result is
109 * not what we want.
110 */
111 memset(&up, 0, sizeof(up));
112 up.membase = (char *) titan_addr(REGBASE_SER0);
113 up.irq = TITAN_IRQ;
114 up.uartclk = TITAN_UART_CLK;
115 up.regshift = 0;
116 up.iotype = UPIO_MEM32;
117 up.type = PORT_RM9000;
118 up.flags = UPF_SHARE_IRQ;
119 up.line = 0;
120 if (early_serial_setup(&up))
121 printk(serr, up.line);
122
123#if CONFIG_SERIAL_8250_NR_UARTS > 1
124 /* And now for port #1. */
125 up.membase = (char *) titan_addr(REGBASE_SER1);
126 up.line = 1;
127 if (early_serial_setup(&up))
128 printk(serr, up.line);
129#endif /* CONFIG_SERIAL_8250_NR_UARTS > 1 */
130#else
131 /* Leave the DUART in reset */
132 titan_writel(0x00ff3cff, CPRR);
133#endif /* defined(CONFIG_SERIAL_8250) */
134
135 return 0;
136}
137
138static int __init excite_platform_init(void)
139{
140 unsigned int i;
141 unsigned char buf[3];
142 u8 reg;
143 void __iomem * dpr;
144
145 /* BIU buffer allocations */
146 ocd_writel(8, CPURSLMT); /* CPU */
147 titan_writel(4, CPGRWL); /* GPI / Ethernet */
148
149 /* Map control registers located in FPGA */
150 ctl_regs = ioremap_nocache(EXCITE_PHYS_FPGA + EXCITE_FPGA_SYSCTL, 16);
151 if (!ctl_regs)
152 panic("eXcite: failed to map platform control registers\n");
153 memcpy_fromio(buf, ctl_regs + 2, ARRAY_SIZE(buf));
154 unit_id = buf[0] | (buf[1] << 8) | (buf[2] << 16);
155
156 /* Clear the reboot flag */
157 dpr = ioremap_nocache(EXCITE_PHYS_FPGA + EXCITE_FPGA_DPR, 1);
158 reg = __raw_readb(dpr);
159 __raw_writeb(reg & 0x7f, dpr);
160 iounmap(dpr);
161
162 /* Interrupt controller setup */
163 for (i = INTP0Status0; i < INTP0Status0 + 0x80; i += 0x10) {
164 ocd_writel(0x00000000, i + 0x04);
165 ocd_writel(0xffffffff, i + 0x0c);
166 }
167 ocd_writel(0x2, NMICONFIG);
168
169 ocd_writel(0x1 << (TITAN_MSGINT % 0x20),
170 INTP0Mask0 + (0x10 * (TITAN_MSGINT / 0x20)));
171 ocd_writel((0x1 << (FPGA0_MSGINT % 0x20))
172 | ocd_readl(INTP0Mask0 + (0x10 * (FPGA0_MSGINT / 0x20))),
173 INTP0Mask0 + (0x10 * (FPGA0_MSGINT / 0x20)));
174 ocd_writel((0x1 << (FPGA1_MSGINT % 0x20))
175 | ocd_readl(INTP0Mask0 + (0x10 * (FPGA1_MSGINT / 0x20))),
176 INTP0Mask0 + (0x10 * (FPGA1_MSGINT / 0x20)));
177 ocd_writel((0x1 << (PHY_MSGINT % 0x20))
178 | ocd_readl(INTP0Mask0 + (0x10 * (PHY_MSGINT / 0x20))),
179 INTP0Mask0 + (0x10 * (PHY_MSGINT / 0x20)));
180#if USB_IRQ < 10
181 ocd_writel((0x1 << (USB_MSGINT % 0x20))
182 | ocd_readl(INTP0Mask0 + (0x10 * (USB_MSGINT / 0x20))),
183 INTP0Mask0 + (0x10 * (USB_MSGINT / 0x20)));
184#endif
185 /* Enable the packet FIFO, XDMA and XDMA arbiter */
186 titan_writel(0x00ff18ff, CPRR);
187
188 /*
189 * Set up the PADMUX. Power down all ethernet slices,
190 * they will be powered up and configured at device startup.
191 */
192 titan_writel(0x00878206, CPTC1R);
193 titan_writel(0x00001100, CPTC0R); /* latch PADMUX, enable WCIMODE */
194
195 /* Reset and enable the FIFO block */
196 titan_writel(0x00000001, SDRXFCIE);
197 titan_writel(0x00000001, SDTXFCIE);
198 titan_writel(0x00000100, SDRXFCIE);
199 titan_writel(0x00000000, SDTXFCIE);
200
201 /*
202 * Initialize the common interrupt shared by all components of
203 * the GPI/Ethernet subsystem.
204 */
205 titan_writel((EXCITE_PHYS_OCD >> 12), CPCFG0);
206 titan_writel(TITAN_MSGINT, CPCFG1);
207
208 /*
209 * XDMA configuration.
210 * In order for the XDMA to be sharable among multiple drivers,
211 * the setup must be done here in the platform. The reason is that
212 * this setup can only be done while the XDMA is in reset. If this
213 * were done in a driver, it would interrupt all other drivers
214 * using the XDMA.
215 */
216 titan_writel(0x80021dff, GXCFG); /* XDMA reset */
217 titan_writel(0x00000000, CPXCISRA);
218 titan_writel(0x00000000, CPXCISRB); /* clear pending interrupts */
219#if defined (CONFIG_HIGHMEM)
220# error change for HIGHMEM support!
221#else
222 titan_writel(0x00000000, GXDMADRPFX); /* buffer address prefix */
223#endif
224 titan_writel(0, GXDMA_DESCADR);
225
226 for (i = 0x5040; i <= 0x5300; i += 0x0040)
227 titan_writel(0x80080000, i); /* reset channel */
228
229 titan_writel((0x1 << 29) /* no sparse tx descr. */
230 | (0x1 << 28) /* no sparse rx descr. */
231 | (0x1 << 23) | (0x1 << 24) /* descriptor coherency */
232 | (0x1 << 21) | (0x1 << 22) /* data coherency */
233 | (0x1 << 17)
234 | 0x1dff,
235 GXCFG);
236
237#if defined(CONFIG_SMP)
238# error No SMP support
239#else
240 /* All interrupts go to core #0 only. */
241 titan_writel(0x1f007fff, CPDST0A);
242 titan_writel(0x00000000, CPDST0B);
243 titan_writel(0x0000ff3f, CPDST1A);
244 titan_writel(0x00000000, CPDST1B);
245 titan_writel(0x00ffffff, CPXDSTA);
246 titan_writel(0x00000000, CPXDSTB);
247#endif
248
249 /* Enable DUART interrupts, disable everything else. */
250 titan_writel(0x04000000, CPGIG0ER);
251 titan_writel(0x000000c0, CPGIG1ER);
252
253 excite_procfs_init();
254 return 0;
255}
256
257void __init plat_setup(void)
258{
259 volatile u32 * const boot_ocd_base = (u32 *) 0xbf7fc000;
260
261 /* Announce RAM to system */
262 add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
263
264 /* Set up timer initialization hooks */
265 board_time_init = excite_timer_init;
266 board_timer_setup = excite_timer_setup;
267
268 /* Set up the peripheral address map */
269 *(boot_ocd_base + (LKB9 / sizeof (u32))) = 0;
270 *(boot_ocd_base + (LKB10 / sizeof (u32))) = 0;
271 *(boot_ocd_base + (LKB11 / sizeof (u32))) = 0;
272 *(boot_ocd_base + (LKB12 / sizeof (u32))) = 0;
273 wmb();
274 *(boot_ocd_base + (LKB0 / sizeof (u32))) = EXCITE_PHYS_OCD >> 4;
275 wmb();
276
277 ocd_writel((EXCITE_PHYS_TITAN >> 4) | 0x1UL, LKB5);
278 ocd_writel(((EXCITE_SIZE_TITAN >> 4) & 0x7fffff00) - 0x100, LKM5);
279 ocd_writel((EXCITE_PHYS_SCRAM >> 4) | 0x1UL, LKB13);
280 ocd_writel(((EXCITE_SIZE_SCRAM >> 4) & 0xffffff00) - 0x100, LKM13);
281
282 /* Local bus slot #0 */
283 ocd_writel(0x00040510, LDP0);
284 ocd_writel((EXCITE_PHYS_BOOTROM >> 4) | 0x1UL, LKB9);
285 ocd_writel(((EXCITE_SIZE_BOOTROM >> 4) & 0x03ffff00) - 0x100, LKM9);
286
287 /* Local bus slot #2 */
288 ocd_writel(0x00000330, LDP2);
289 ocd_writel((EXCITE_PHYS_FPGA >> 4) | 0x1, LKB11);
290 ocd_writel(((EXCITE_SIZE_FPGA >> 4) - 0x100) & 0x03ffff00, LKM11);
291
292 /* Local bus slot #3 */
293 ocd_writel(0x00123413, LDP3);
294 ocd_writel((EXCITE_PHYS_NAND >> 4) | 0x1, LKB12);
295 ocd_writel(((EXCITE_SIZE_NAND >> 4) - 0x100) & 0x03ffff00, LKM12);
296}
297
298
299
300console_initcall(excite_init_console);
301arch_initcall(excite_platform_init);
302
303EXPORT_SYMBOL(titan_lock);
304EXPORT_SYMBOL(titan_irqflags);
305EXPORT_SYMBOL(titan_irq);
306EXPORT_SYMBOL(ocd_base);
307EXPORT_SYMBOL(titan_base);
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c
index 45c2d27c7564..300797d5f558 100644
--- a/arch/mips/cobalt/console.c
+++ b/arch/mips/cobalt/console.c
@@ -41,3 +41,8 @@ void __init cobalt_early_console(void)
41 41
42 printk("Cobalt: early console registered\n"); 42 printk("Cobalt: early console registered\n");
43} 43}
44
45void __init disable_early_printk(void)
46{
47 unregister_console(&cons_info);
48}
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index 4f9ea1210023..ca719d6398bd 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -68,19 +68,46 @@ static void __init cobalt_timer_setup(struct irqaction *irq)
68extern struct pci_ops gt64111_pci_ops; 68extern struct pci_ops gt64111_pci_ops;
69 69
70static struct resource cobalt_mem_resource = { 70static struct resource cobalt_mem_resource = {
71 "PCI memory", GT64111_MEM_BASE, GT64111_MEM_END, IORESOURCE_MEM 71 .start = GT64111_MEM_BASE,
72 .end = GT64111_MEM_END,
73 .name = "PCI memory",
74 .flags = IORESOURCE_MEM
72}; 75};
73 76
74static struct resource cobalt_io_resource = { 77static struct resource cobalt_io_resource = {
75 "PCI I/O", 0x1000, 0xffff, IORESOURCE_IO 78 .start = 0x1000,
79 .end = 0xffff,
80 .name = "PCI I/O",
81 .flags = IORESOURCE_IO
76}; 82};
77 83
78static struct resource cobalt_io_resources[] = { 84static struct resource cobalt_io_resources[] = {
79 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY }, 85 {
80 { "timer", 0x40, 0x5f, IORESOURCE_BUSY }, 86 .start = 0x00,
81 { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY }, 87 .end = 0x1f,
82 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY }, 88 .name = "dma1",
83 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, 89 .flags = IORESOURCE_BUSY
90 }, {
91 .start = 0x40,
92 .end = 0x5f,
93 .name = "timer",
94 .flags = IORESOURCE_BUSY
95 }, {
96 .start = 0x60,
97 .end = 0x6f,
98 .name = "keyboard",
99 .flags = IORESOURCE_BUSY
100 }, {
101 .start = 0x80,
102 .end = 0x8f,
103 .name = "dma page reg",
104 .flags = IORESOURCE_BUSY
105 }, {
106 .start = 0xc0,
107 .end = 0xdf,
108 .name = "dma2",
109 .flags = IORESOURCE_BUSY
110 },
84}; 111};
85 112
86#define COBALT_IO_RESOURCES (sizeof(cobalt_io_resources)/sizeof(struct resource)) 113#define COBALT_IO_RESOURCES (sizeof(cobalt_io_resources)/sizeof(struct resource))
@@ -93,7 +120,7 @@ static struct pci_controller cobalt_pci_controller = {
93 .io_offset = 0 - GT64111_IO_BASE 120 .io_offset = 0 - GT64111_IO_BASE
94}; 121};
95 122
96void __init plat_setup(void) 123void __init plat_mem_setup(void)
97{ 124{
98 static struct uart_port uart; 125 static struct uart_port uart;
99 unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0); 126 unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0);
diff --git a/arch/mips/configs/atlas_defconfig b/arch/mips/configs/atlas_defconfig
index 4b080bcb258f..0cc1b3c51959 100644
--- a/arch/mips/configs/atlas_defconfig
+++ b/arch/mips/configs/atlas_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_ATLAS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -143,6 +141,15 @@ CONFIG_FLATMEM=y
143CONFIG_FLAT_NODE_MEM_MAP=y 141CONFIG_FLAT_NODE_MEM_MAP=y
144# CONFIG_SPARSEMEM_STATIC is not set 142# CONFIG_SPARSEMEM_STATIC is not set
145CONFIG_SPLIT_PTLOCK_CPUS=4 143CONFIG_SPLIT_PTLOCK_CPUS=4
144# CONFIG_HZ_48 is not set
145CONFIG_HZ_100=y
146# CONFIG_HZ_128 is not set
147# CONFIG_HZ_250 is not set
148# CONFIG_HZ_256 is not set
149# CONFIG_HZ_1000 is not set
150# CONFIG_HZ_1024 is not set
151CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
152CONFIG_HZ=100
146CONFIG_PREEMPT_NONE=y 153CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set 154# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig
index d85cda58d650..dabf90a94b21 100644
--- a/arch/mips/configs/bigsur_defconfig
+++ b/arch/mips/configs/bigsur_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -145,6 +143,15 @@ CONFIG_FLATMEM=y
145CONFIG_FLAT_NODE_MEM_MAP=y 143CONFIG_FLAT_NODE_MEM_MAP=y
146# CONFIG_SPARSEMEM_STATIC is not set 144# CONFIG_SPARSEMEM_STATIC is not set
147CONFIG_SPLIT_PTLOCK_CPUS=4 145CONFIG_SPLIT_PTLOCK_CPUS=4
146# CONFIG_HZ_48 is not set
147# CONFIG_HZ_100 is not set
148# CONFIG_HZ_128 is not set
149# CONFIG_HZ_250 is not set
150# CONFIG_HZ_256 is not set
151CONFIG_HZ_1000=y
152# CONFIG_HZ_1024 is not set
153CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
154CONFIG_HZ=1000
148CONFIG_SMP=y 155CONFIG_SMP=y
149CONFIG_NR_CPUS=4 156CONFIG_NR_CPUS=4
150CONFIG_PREEMPT_NONE=y 157CONFIG_PREEMPT_NONE=y
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index ca0af1683a00..aeb7be804799 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47CONFIG_MACH_VR41XX=y 45CONFIG_MACH_VR41XX=y
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -132,6 +130,15 @@ CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 130CONFIG_FLAT_NODE_MEM_MAP=y
133# CONFIG_SPARSEMEM_STATIC is not set 131# CONFIG_SPARSEMEM_STATIC is not set
134CONFIG_SPLIT_PTLOCK_CPUS=4 132CONFIG_SPLIT_PTLOCK_CPUS=4
133# CONFIG_HZ_48 is not set
134# CONFIG_HZ_100 is not set
135# CONFIG_HZ_128 is not set
136# CONFIG_HZ_250 is not set
137# CONFIG_HZ_256 is not set
138CONFIG_HZ_1000=y
139# CONFIG_HZ_1024 is not set
140CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
141CONFIG_HZ=1000
135CONFIG_PREEMPT_NONE=y 142CONFIG_PREEMPT_NONE=y
136# CONFIG_PREEMPT_VOLUNTARY is not set 143# CONFIG_PREEMPT_VOLUNTARY is not set
137# CONFIG_PREEMPT is not set 144# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index 7d269e609282..d680d3e17112 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_COBALT=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -129,6 +127,15 @@ CONFIG_FLATMEM=y
129CONFIG_FLAT_NODE_MEM_MAP=y 127CONFIG_FLAT_NODE_MEM_MAP=y
130# CONFIG_SPARSEMEM_STATIC is not set 128# CONFIG_SPARSEMEM_STATIC is not set
131CONFIG_SPLIT_PTLOCK_CPUS=4 129CONFIG_SPLIT_PTLOCK_CPUS=4
130# CONFIG_HZ_48 is not set
131# CONFIG_HZ_100 is not set
132# CONFIG_HZ_128 is not set
133# CONFIG_HZ_250 is not set
134# CONFIG_HZ_256 is not set
135CONFIG_HZ_1000=y
136# CONFIG_HZ_1024 is not set
137CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
138CONFIG_HZ=1000
132CONFIG_PREEMPT_NONE=y 139CONFIG_PREEMPT_NONE=y
133# CONFIG_PREEMPT_VOLUNTARY is not set 140# CONFIG_PREEMPT_VOLUNTARY is not set
134# CONFIG_PREEMPT is not set 141# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index 579b665e3339..6a7aa401462f 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_DB1000=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
134# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
135# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index e5eb53867422..5c2da563e528 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_DB1100=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
134# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
135# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index a43fb2329fd5..85ef90ce0944 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_DB1200=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
134# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
135# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index ad632d87c4ef..6f757d8a5a6c 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_DB1500=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -132,6 +130,15 @@ CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 130CONFIG_FLAT_NODE_MEM_MAP=y
133# CONFIG_SPARSEMEM_STATIC is not set 131# CONFIG_SPARSEMEM_STATIC is not set
134CONFIG_SPLIT_PTLOCK_CPUS=4 132CONFIG_SPLIT_PTLOCK_CPUS=4
133# CONFIG_HZ_48 is not set
134# CONFIG_HZ_100 is not set
135# CONFIG_HZ_128 is not set
136# CONFIG_HZ_250 is not set
137# CONFIG_HZ_256 is not set
138CONFIG_HZ_1000=y
139# CONFIG_HZ_1024 is not set
140CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
141CONFIG_HZ=1000
135CONFIG_PREEMPT_NONE=y 142CONFIG_PREEMPT_NONE=y
136# CONFIG_PREEMPT_VOLUNTARY is not set 143# CONFIG_PREEMPT_VOLUNTARY is not set
137# CONFIG_PREEMPT is not set 144# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index 8130e23dc255..da4c7e811bef 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_DB1550=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -131,6 +129,15 @@ CONFIG_FLATMEM=y
131CONFIG_FLAT_NODE_MEM_MAP=y 129CONFIG_FLAT_NODE_MEM_MAP=y
132# CONFIG_SPARSEMEM_STATIC is not set 130# CONFIG_SPARSEMEM_STATIC is not set
133CONFIG_SPLIT_PTLOCK_CPUS=4 131CONFIG_SPLIT_PTLOCK_CPUS=4
132# CONFIG_HZ_48 is not set
133# CONFIG_HZ_100 is not set
134# CONFIG_HZ_128 is not set
135# CONFIG_HZ_250 is not set
136# CONFIG_HZ_256 is not set
137CONFIG_HZ_1000=y
138# CONFIG_HZ_1024 is not set
139CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
140CONFIG_HZ=1000
134CONFIG_PREEMPT_NONE=y 141CONFIG_PREEMPT_NONE=y
135# CONFIG_PREEMPT_VOLUNTARY is not set 142# CONFIG_PREEMPT_VOLUNTARY is not set
136# CONFIG_PREEMPT is not set 143# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
index 8c911b671415..c1c6bfee970e 100644
--- a/arch/mips/configs/ddb5477_defconfig
+++ b/arch/mips/configs/ddb5477_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 43# CONFIG_PNX8550_JBS is not set
44# CONFIG_DDB5074 is not set
45# CONFIG_DDB5476 is not set
46CONFIG_DDB5477=y 44CONFIG_DDB5477=y
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -129,6 +127,15 @@ CONFIG_FLATMEM=y
129CONFIG_FLAT_NODE_MEM_MAP=y 127CONFIG_FLAT_NODE_MEM_MAP=y
130# CONFIG_SPARSEMEM_STATIC is not set 128# CONFIG_SPARSEMEM_STATIC is not set
131CONFIG_SPLIT_PTLOCK_CPUS=4 129CONFIG_SPLIT_PTLOCK_CPUS=4
130# CONFIG_HZ_48 is not set
131# CONFIG_HZ_100 is not set
132# CONFIG_HZ_128 is not set
133# CONFIG_HZ_250 is not set
134# CONFIG_HZ_256 is not set
135CONFIG_HZ_1000=y
136# CONFIG_HZ_1024 is not set
137CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
138CONFIG_HZ=1000
132CONFIG_PREEMPT_NONE=y 139CONFIG_PREEMPT_NONE=y
133# CONFIG_PREEMPT_VOLUNTARY is not set 140# CONFIG_PREEMPT_VOLUNTARY is not set
134# CONFIG_PREEMPT is not set 141# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index d838496e114f..d5d0d3faae94 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -41,8 +41,6 @@ CONFIG_MACH_DECSTATION=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -128,6 +126,17 @@ CONFIG_FLATMEM=y
128CONFIG_FLAT_NODE_MEM_MAP=y 126CONFIG_FLAT_NODE_MEM_MAP=y
129# CONFIG_SPARSEMEM_STATIC is not set 127# CONFIG_SPARSEMEM_STATIC is not set
130CONFIG_SPLIT_PTLOCK_CPUS=4 128CONFIG_SPLIT_PTLOCK_CPUS=4
129# CONFIG_HZ_48 is not set
130# CONFIG_HZ_100 is not set
131CONFIG_HZ_128=y
132# CONFIG_HZ_250 is not set
133# CONFIG_HZ_256 is not set
134# CONFIG_HZ_1000 is not set
135# CONFIG_HZ_1024 is not set
136CONFIG_SYS_SUPPORTS_128HZ=y
137CONFIG_SYS_SUPPORTS_256HZ=y
138CONFIG_SYS_SUPPORTS_1024HZ=y
139CONFIG_HZ=128
131CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
132# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
133# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index 0760f4318910..439677ba751c 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47CONFIG_MACH_VR41XX=y 45CONFIG_MACH_VR41XX=y
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
134# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
135# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/emma2rh_defconfig b/arch/mips/configs/emma2rh_defconfig
new file mode 100644
index 000000000000..01f29f44f3e8
--- /dev/null
+++ b/arch/mips/configs/emma2rh_defconfig
@@ -0,0 +1,1207 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17
4# Sun Jun 18 13:46:53 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_WR_PPMC is not set
36# CONFIG_MIPS_SIM is not set
37# CONFIG_MOMENCO_JAGUAR_ATX is not set
38# CONFIG_MOMENCO_OCELOT is not set
39# CONFIG_MOMENCO_OCELOT_3 is not set
40# CONFIG_MOMENCO_OCELOT_C is not set
41# CONFIG_MOMENCO_OCELOT_G is not set
42# CONFIG_MIPS_XXS1500 is not set
43# CONFIG_PNX8550_V2PCI is not set
44# CONFIG_PNX8550_JBS is not set
45# CONFIG_DDB5477 is not set
46# CONFIG_MACH_VR41XX is not set
47# CONFIG_PMC_YOSEMITE is not set
48# CONFIG_QEMU is not set
49CONFIG_MARKEINS=y
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
66CONFIG_RWSEM_GENERIC_SPINLOCK=y
67CONFIG_GENERIC_FIND_NEXT_BIT=y
68CONFIG_GENERIC_HWEIGHT=y
69CONFIG_GENERIC_CALIBRATE_DELAY=y
70CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
71CONFIG_DMA_NONCOHERENT=y
72CONFIG_DMA_NEED_PCI_MAP_STATE=y
73CONFIG_CPU_BIG_ENDIAN=y
74# CONFIG_CPU_LITTLE_ENDIAN is not set
75CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
76CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
77CONFIG_IRQ_CPU=y
78CONFIG_SWAP_IO_SPACE=y
79CONFIG_EMMA2RH=y
80CONFIG_MIPS_L1_CACHE_SHIFT=5
81
82#
83# CPU selection
84#
85# CONFIG_CPU_MIPS32_R1 is not set
86# CONFIG_CPU_MIPS32_R2 is not set
87# CONFIG_CPU_MIPS64_R1 is not set
88# CONFIG_CPU_MIPS64_R2 is not set
89# CONFIG_CPU_R3000 is not set
90# CONFIG_CPU_TX39XX is not set
91# CONFIG_CPU_VR41XX is not set
92# CONFIG_CPU_R4300 is not set
93# CONFIG_CPU_R4X00 is not set
94# CONFIG_CPU_TX49XX is not set
95CONFIG_CPU_R5000=y
96# CONFIG_CPU_R5432 is not set
97# CONFIG_CPU_R6000 is not set
98# CONFIG_CPU_NEVADA is not set
99# CONFIG_CPU_R8000 is not set
100# CONFIG_CPU_R10000 is not set
101# CONFIG_CPU_RM7000 is not set
102# CONFIG_CPU_RM9000 is not set
103# CONFIG_CPU_SB1 is not set
104CONFIG_SYS_HAS_CPU_R5000=y
105CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
106CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
107CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
108
109#
110# Kernel type
111#
112CONFIG_32BIT=y
113# CONFIG_64BIT is not set
114CONFIG_PAGE_SIZE_4KB=y
115# CONFIG_PAGE_SIZE_8KB is not set
116# CONFIG_PAGE_SIZE_16KB is not set
117# CONFIG_PAGE_SIZE_64KB is not set
118CONFIG_MIPS_MT_DISABLED=y
119# CONFIG_MIPS_MT_SMTC is not set
120# CONFIG_MIPS_MT_SMP is not set
121# CONFIG_MIPS_VPE_LOADER is not set
122# CONFIG_64BIT_PHYS_ADDR is not set
123CONFIG_CPU_HAS_LLSC=y
124CONFIG_CPU_HAS_SYNC=y
125CONFIG_GENERIC_HARDIRQS=y
126CONFIG_GENERIC_IRQ_PROBE=y
127CONFIG_ARCH_FLATMEM_ENABLE=y
128CONFIG_SELECT_MEMORY_MODEL=y
129CONFIG_FLATMEM_MANUAL=y
130# CONFIG_DISCONTIGMEM_MANUAL is not set
131# CONFIG_SPARSEMEM_MANUAL is not set
132CONFIG_FLATMEM=y
133CONFIG_FLAT_NODE_MEM_MAP=y
134# CONFIG_SPARSEMEM_STATIC is not set
135CONFIG_SPLIT_PTLOCK_CPUS=4
136# CONFIG_HZ_48 is not set
137# CONFIG_HZ_100 is not set
138# CONFIG_HZ_128 is not set
139# CONFIG_HZ_250 is not set
140# CONFIG_HZ_256 is not set
141CONFIG_HZ_1000=y
142# CONFIG_HZ_1024 is not set
143CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
144CONFIG_HZ=1000
145# CONFIG_PREEMPT_NONE is not set
146# CONFIG_PREEMPT_VOLUNTARY is not set
147CONFIG_PREEMPT=y
148CONFIG_PREEMPT_BKL=y
149
150#
151# Code maturity level options
152#
153CONFIG_EXPERIMENTAL=y
154CONFIG_BROKEN_ON_SMP=y
155CONFIG_LOCK_KERNEL=y
156CONFIG_INIT_ENV_ARG_LIMIT=32
157
158#
159# General setup
160#
161CONFIG_LOCALVERSION=""
162CONFIG_LOCALVERSION_AUTO=y
163CONFIG_SWAP=y
164CONFIG_SYSVIPC=y
165CONFIG_POSIX_MQUEUE=y
166CONFIG_BSD_PROCESS_ACCT=y
167# CONFIG_BSD_PROCESS_ACCT_V3 is not set
168CONFIG_SYSCTL=y
169# CONFIG_AUDIT is not set
170CONFIG_IKCONFIG=y
171CONFIG_IKCONFIG_PROC=y
172# CONFIG_RELAY is not set
173CONFIG_INITRAMFS_SOURCE=""
174# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
175CONFIG_EMBEDDED=y
176CONFIG_KALLSYMS=y
177# CONFIG_KALLSYMS_EXTRA_PASS is not set
178CONFIG_HOTPLUG=y
179CONFIG_PRINTK=y
180CONFIG_BUG=y
181CONFIG_ELF_CORE=y
182CONFIG_BASE_FULL=y
183CONFIG_FUTEX=y
184CONFIG_EPOLL=y
185CONFIG_SHMEM=y
186CONFIG_SLAB=y
187# CONFIG_TINY_SHMEM is not set
188CONFIG_BASE_SMALL=0
189# CONFIG_SLOB is not set
190CONFIG_OBSOLETE_INTERMODULE=y
191
192#
193# Loadable module support
194#
195CONFIG_MODULES=y
196CONFIG_MODULE_UNLOAD=y
197CONFIG_MODULE_FORCE_UNLOAD=y
198CONFIG_MODVERSIONS=y
199# CONFIG_MODULE_SRCVERSION_ALL is not set
200CONFIG_KMOD=y
201
202#
203# Block layer
204#
205CONFIG_LBD=y
206# CONFIG_BLK_DEV_IO_TRACE is not set
207# CONFIG_LSF is not set
208
209#
210# IO Schedulers
211#
212CONFIG_IOSCHED_NOOP=y
213CONFIG_IOSCHED_AS=y
214CONFIG_IOSCHED_DEADLINE=y
215CONFIG_IOSCHED_CFQ=y
216CONFIG_DEFAULT_AS=y
217# CONFIG_DEFAULT_DEADLINE is not set
218# CONFIG_DEFAULT_CFQ is not set
219# CONFIG_DEFAULT_NOOP is not set
220CONFIG_DEFAULT_IOSCHED="anticipatory"
221
222#
223# Bus options (PCI, PCMCIA, EISA, ISA, TC)
224#
225CONFIG_HW_HAS_PCI=y
226CONFIG_PCI=y
227CONFIG_MMU=y
228
229#
230# PCCARD (PCMCIA/CardBus) support
231#
232# CONFIG_PCCARD is not set
233
234#
235# PCI Hotplug Support
236#
237# CONFIG_HOTPLUG_PCI is not set
238
239#
240# Executable file formats
241#
242CONFIG_BINFMT_ELF=y
243# CONFIG_BINFMT_MISC is not set
244CONFIG_TRAD_SIGNALS=y
245
246#
247# Networking
248#
249CONFIG_NET=y
250
251#
252# Networking options
253#
254# CONFIG_NETDEBUG is not set
255CONFIG_PACKET=y
256CONFIG_PACKET_MMAP=y
257CONFIG_UNIX=y
258CONFIG_XFRM=y
259# CONFIG_XFRM_USER is not set
260CONFIG_NET_KEY=y
261CONFIG_INET=y
262CONFIG_IP_MULTICAST=y
263CONFIG_IP_ADVANCED_ROUTER=y
264CONFIG_ASK_IP_FIB_HASH=y
265# CONFIG_IP_FIB_TRIE is not set
266CONFIG_IP_FIB_HASH=y
267CONFIG_IP_MULTIPLE_TABLES=y
268# CONFIG_IP_ROUTE_FWMARK is not set
269CONFIG_IP_ROUTE_MULTIPATH=y
270# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set
271CONFIG_IP_ROUTE_VERBOSE=y
272CONFIG_IP_PNP=y
273# CONFIG_IP_PNP_DHCP is not set
274CONFIG_IP_PNP_BOOTP=y
275# CONFIG_IP_PNP_RARP is not set
276# CONFIG_NET_IPIP is not set
277# CONFIG_NET_IPGRE is not set
278# CONFIG_IP_MROUTE is not set
279# CONFIG_ARPD is not set
280CONFIG_SYN_COOKIES=y
281# CONFIG_INET_AH is not set
282# CONFIG_INET_ESP is not set
283# CONFIG_INET_IPCOMP is not set
284# CONFIG_INET_XFRM_TUNNEL is not set
285# CONFIG_INET_TUNNEL is not set
286CONFIG_INET_DIAG=y
287CONFIG_INET_TCP_DIAG=y
288# CONFIG_TCP_CONG_ADVANCED is not set
289CONFIG_TCP_CONG_BIC=y
290
291#
292# IP: Virtual Server Configuration
293#
294# CONFIG_IP_VS is not set
295CONFIG_IPV6=m
296# CONFIG_IPV6_PRIVACY is not set
297# CONFIG_IPV6_ROUTER_PREF is not set
298# CONFIG_INET6_AH is not set
299# CONFIG_INET6_ESP is not set
300# CONFIG_INET6_IPCOMP is not set
301# CONFIG_INET6_XFRM_TUNNEL is not set
302# CONFIG_INET6_TUNNEL is not set
303# CONFIG_IPV6_TUNNEL is not set
304CONFIG_NETFILTER=y
305# CONFIG_NETFILTER_DEBUG is not set
306
307#
308# Core Netfilter Configuration
309#
310# CONFIG_NETFILTER_NETLINK is not set
311# CONFIG_NF_CONNTRACK is not set
312# CONFIG_NETFILTER_XTABLES is not set
313
314#
315# IP: Netfilter Configuration
316#
317# CONFIG_IP_NF_CONNTRACK is not set
318# CONFIG_IP_NF_QUEUE is not set
319
320#
321# IPv6: Netfilter Configuration (EXPERIMENTAL)
322#
323# CONFIG_IP6_NF_QUEUE is not set
324
325#
326# DCCP Configuration (EXPERIMENTAL)
327#
328# CONFIG_IP_DCCP is not set
329
330#
331# SCTP Configuration (EXPERIMENTAL)
332#
333CONFIG_IP_SCTP=m
334# CONFIG_SCTP_DBG_MSG is not set
335# CONFIG_SCTP_DBG_OBJCNT is not set
336# CONFIG_SCTP_HMAC_NONE is not set
337# CONFIG_SCTP_HMAC_SHA1 is not set
338CONFIG_SCTP_HMAC_MD5=y
339
340#
341# TIPC Configuration (EXPERIMENTAL)
342#
343# CONFIG_TIPC is not set
344# CONFIG_ATM is not set
345# CONFIG_BRIDGE is not set
346# CONFIG_VLAN_8021Q is not set
347# CONFIG_DECNET is not set
348# CONFIG_LLC2 is not set
349# CONFIG_IPX is not set
350# CONFIG_ATALK is not set
351# CONFIG_X25 is not set
352# CONFIG_LAPB is not set
353# CONFIG_NET_DIVERT is not set
354# CONFIG_ECONET is not set
355# CONFIG_WAN_ROUTER is not set
356
357#
358# QoS and/or fair queueing
359#
360# CONFIG_NET_SCHED is not set
361
362#
363# Network testing
364#
365# CONFIG_NET_PKTGEN is not set
366# CONFIG_HAMRADIO is not set
367# CONFIG_IRDA is not set
368# CONFIG_BT is not set
369# CONFIG_IEEE80211 is not set
370
371#
372# Device Drivers
373#
374
375#
376# Generic Driver Options
377#
378CONFIG_STANDALONE=y
379CONFIG_PREVENT_FIRMWARE_BUILD=y
380# CONFIG_FW_LOADER is not set
381
382#
383# Connector - unified userspace <-> kernelspace linker
384#
385# CONFIG_CONNECTOR is not set
386
387#
388# Memory Technology Devices (MTD)
389#
390CONFIG_MTD=y
391# CONFIG_MTD_DEBUG is not set
392# CONFIG_MTD_CONCAT is not set
393CONFIG_MTD_PARTITIONS=y
394# CONFIG_MTD_REDBOOT_PARTS is not set
395CONFIG_MTD_CMDLINE_PARTS=y
396
397#
398# User Modules And Translation Layers
399#
400CONFIG_MTD_CHAR=y
401CONFIG_MTD_BLOCK=y
402# CONFIG_FTL is not set
403# CONFIG_NFTL is not set
404# CONFIG_INFTL is not set
405# CONFIG_RFD_FTL is not set
406
407#
408# RAM/ROM/Flash chip drivers
409#
410CONFIG_MTD_CFI=y
411# CONFIG_MTD_JEDECPROBE is not set
412CONFIG_MTD_GEN_PROBE=y
413# CONFIG_MTD_CFI_ADV_OPTIONS is not set
414CONFIG_MTD_MAP_BANK_WIDTH_1=y
415CONFIG_MTD_MAP_BANK_WIDTH_2=y
416CONFIG_MTD_MAP_BANK_WIDTH_4=y
417# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
418# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
419# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
420CONFIG_MTD_CFI_I1=y
421CONFIG_MTD_CFI_I2=y
422# CONFIG_MTD_CFI_I4 is not set
423# CONFIG_MTD_CFI_I8 is not set
424# CONFIG_MTD_CFI_INTELEXT is not set
425CONFIG_MTD_CFI_AMDSTD=y
426# CONFIG_MTD_CFI_STAA is not set
427CONFIG_MTD_CFI_UTIL=y
428# CONFIG_MTD_RAM is not set
429# CONFIG_MTD_ROM is not set
430# CONFIG_MTD_ABSENT is not set
431# CONFIG_MTD_OBSOLETE_CHIPS is not set
432
433#
434# Mapping drivers for chip access
435#
436# CONFIG_MTD_COMPLEX_MAPPINGS is not set
437CONFIG_MTD_PHYSMAP=y
438CONFIG_MTD_PHYSMAP_START=0x1e000000
439CONFIG_MTD_PHYSMAP_LEN=0x02000000
440CONFIG_MTD_PHYSMAP_BANKWIDTH=2
441# CONFIG_MTD_PLATRAM is not set
442
443#
444# Self-contained MTD device drivers
445#
446# CONFIG_MTD_PMC551 is not set
447# CONFIG_MTD_SLRAM is not set
448# CONFIG_MTD_PHRAM is not set
449# CONFIG_MTD_MTDRAM is not set
450# CONFIG_MTD_BLOCK2MTD is not set
451
452#
453# Disk-On-Chip Device Drivers
454#
455# CONFIG_MTD_DOC2000 is not set
456# CONFIG_MTD_DOC2001 is not set
457# CONFIG_MTD_DOC2001PLUS is not set
458
459#
460# NAND Flash Device Drivers
461#
462# CONFIG_MTD_NAND is not set
463
464#
465# OneNAND Flash Device Drivers
466#
467# CONFIG_MTD_ONENAND is not set
468
469#
470# Parallel port support
471#
472# CONFIG_PARPORT is not set
473
474#
475# Plug and Play support
476#
477
478#
479# Block devices
480#
481# CONFIG_BLK_CPQ_DA is not set
482# CONFIG_BLK_CPQ_CISS_DA is not set
483# CONFIG_BLK_DEV_DAC960 is not set
484# CONFIG_BLK_DEV_UMEM is not set
485# CONFIG_BLK_DEV_COW_COMMON is not set
486CONFIG_BLK_DEV_LOOP=m
487CONFIG_BLK_DEV_CRYPTOLOOP=m
488# CONFIG_BLK_DEV_NBD is not set
489# CONFIG_BLK_DEV_SX8 is not set
490# CONFIG_BLK_DEV_RAM is not set
491# CONFIG_BLK_DEV_INITRD is not set
492# CONFIG_CDROM_PKTCDVD is not set
493# CONFIG_ATA_OVER_ETH is not set
494
495#
496# ATA/ATAPI/MFM/RLL support
497#
498# CONFIG_IDE is not set
499
500#
501# SCSI device support
502#
503# CONFIG_RAID_ATTRS is not set
504CONFIG_SCSI=m
505# CONFIG_SCSI_PROC_FS is not set
506
507#
508# SCSI support type (disk, tape, CD-ROM)
509#
510CONFIG_BLK_DEV_SD=m
511# CONFIG_CHR_DEV_ST is not set
512# CONFIG_CHR_DEV_OSST is not set
513# CONFIG_BLK_DEV_SR is not set
514CONFIG_CHR_DEV_SG=m
515# CONFIG_CHR_DEV_SCH is not set
516
517#
518# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
519#
520# CONFIG_SCSI_MULTI_LUN is not set
521# CONFIG_SCSI_CONSTANTS is not set
522# CONFIG_SCSI_LOGGING is not set
523
524#
525# SCSI Transport Attributes
526#
527# CONFIG_SCSI_SPI_ATTRS is not set
528# CONFIG_SCSI_FC_ATTRS is not set
529# CONFIG_SCSI_ISCSI_ATTRS is not set
530# CONFIG_SCSI_SAS_ATTRS is not set
531
532#
533# SCSI low-level drivers
534#
535# CONFIG_ISCSI_TCP is not set
536# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
537# CONFIG_SCSI_3W_9XXX is not set
538# CONFIG_SCSI_ACARD is not set
539# CONFIG_SCSI_AACRAID is not set
540# CONFIG_SCSI_AIC7XXX is not set
541# CONFIG_SCSI_AIC7XXX_OLD is not set
542# CONFIG_SCSI_AIC79XX is not set
543# CONFIG_SCSI_DPT_I2O is not set
544# CONFIG_MEGARAID_NEWGEN is not set
545# CONFIG_MEGARAID_LEGACY is not set
546# CONFIG_MEGARAID_SAS is not set
547# CONFIG_SCSI_SATA is not set
548# CONFIG_SCSI_DMX3191D is not set
549# CONFIG_SCSI_FUTURE_DOMAIN is not set
550# CONFIG_SCSI_IPS is not set
551# CONFIG_SCSI_INITIO is not set
552# CONFIG_SCSI_INIA100 is not set
553# CONFIG_SCSI_SYM53C8XX_2 is not set
554# CONFIG_SCSI_IPR is not set
555# CONFIG_SCSI_QLOGIC_1280 is not set
556# CONFIG_SCSI_QLA_FC is not set
557# CONFIG_SCSI_LPFC is not set
558# CONFIG_SCSI_DC395x is not set
559# CONFIG_SCSI_DC390T is not set
560# CONFIG_SCSI_NSP32 is not set
561# CONFIG_SCSI_DEBUG is not set
562
563#
564# Multi-device support (RAID and LVM)
565#
566# CONFIG_MD is not set
567
568#
569# Fusion MPT device support
570#
571# CONFIG_FUSION is not set
572# CONFIG_FUSION_SPI is not set
573# CONFIG_FUSION_FC is not set
574# CONFIG_FUSION_SAS is not set
575
576#
577# IEEE 1394 (FireWire) support
578#
579# CONFIG_IEEE1394 is not set
580
581#
582# I2O device support
583#
584# CONFIG_I2O is not set
585
586#
587# Network device support
588#
589CONFIG_NETDEVICES=y
590# CONFIG_DUMMY is not set
591# CONFIG_BONDING is not set
592# CONFIG_EQUALIZER is not set
593CONFIG_TUN=m
594
595#
596# ARCnet devices
597#
598# CONFIG_ARCNET is not set
599
600#
601# PHY device support
602#
603# CONFIG_PHYLIB is not set
604
605#
606# Ethernet (10 or 100Mbit)
607#
608CONFIG_NET_ETHERNET=y
609CONFIG_MII=y
610# CONFIG_HAPPYMEAL is not set
611# CONFIG_SUNGEM is not set
612# CONFIG_CASSINI is not set
613# CONFIG_NET_VENDOR_3COM is not set
614# CONFIG_DM9000 is not set
615
616#
617# Tulip family network device support
618#
619# CONFIG_NET_TULIP is not set
620# CONFIG_HP100 is not set
621CONFIG_NET_PCI=y
622# CONFIG_PCNET32 is not set
623# CONFIG_AMD8111_ETH is not set
624# CONFIG_ADAPTEC_STARFIRE is not set
625# CONFIG_B44 is not set
626# CONFIG_FORCEDETH is not set
627# CONFIG_DGRS is not set
628# CONFIG_EEPRO100 is not set
629# CONFIG_E100 is not set
630# CONFIG_FEALNX is not set
631CONFIG_NATSEMI=y
632# CONFIG_NE2K_PCI is not set
633# CONFIG_8139CP is not set
634# CONFIG_8139TOO is not set
635# CONFIG_SIS900 is not set
636# CONFIG_EPIC100 is not set
637# CONFIG_SUNDANCE is not set
638# CONFIG_TLAN is not set
639# CONFIG_VIA_RHINE is not set
640# CONFIG_LAN_SAA9730 is not set
641
642#
643# Ethernet (1000 Mbit)
644#
645# CONFIG_ACENIC is not set
646# CONFIG_DL2K is not set
647# CONFIG_E1000 is not set
648# CONFIG_NS83820 is not set
649# CONFIG_HAMACHI is not set
650# CONFIG_YELLOWFIN is not set
651# CONFIG_R8169 is not set
652# CONFIG_SIS190 is not set
653# CONFIG_SKGE is not set
654# CONFIG_SKY2 is not set
655# CONFIG_SK98LIN is not set
656# CONFIG_VIA_VELOCITY is not set
657# CONFIG_TIGON3 is not set
658# CONFIG_BNX2 is not set
659
660#
661# Ethernet (10000 Mbit)
662#
663# CONFIG_CHELSIO_T1 is not set
664# CONFIG_IXGB is not set
665# CONFIG_S2IO is not set
666
667#
668# Token Ring devices
669#
670# CONFIG_TR is not set
671
672#
673# Wireless LAN (non-hamradio)
674#
675# CONFIG_NET_RADIO is not set
676
677#
678# Wan interfaces
679#
680# CONFIG_WAN is not set
681# CONFIG_FDDI is not set
682# CONFIG_HIPPI is not set
683CONFIG_PPP=m
684# CONFIG_PPP_MULTILINK is not set
685# CONFIG_PPP_FILTER is not set
686CONFIG_PPP_ASYNC=m
687CONFIG_PPP_SYNC_TTY=m
688CONFIG_PPP_DEFLATE=m
689# CONFIG_PPP_BSDCOMP is not set
690# CONFIG_PPP_MPPE is not set
691# CONFIG_PPPOE is not set
692# CONFIG_SLIP is not set
693# CONFIG_NET_FC is not set
694# CONFIG_SHAPER is not set
695# CONFIG_NETCONSOLE is not set
696# CONFIG_NETPOLL is not set
697# CONFIG_NET_POLL_CONTROLLER is not set
698
699#
700# ISDN subsystem
701#
702# CONFIG_ISDN is not set
703
704#
705# Telephony Support
706#
707# CONFIG_PHONE is not set
708
709#
710# Input device support
711#
712CONFIG_INPUT=y
713
714#
715# Userland interfaces
716#
717# CONFIG_INPUT_MOUSEDEV is not set
718# CONFIG_INPUT_JOYDEV is not set
719# CONFIG_INPUT_TSDEV is not set
720CONFIG_INPUT_EVDEV=m
721# CONFIG_INPUT_EVBUG is not set
722
723#
724# Input Device Drivers
725#
726# CONFIG_INPUT_KEYBOARD is not set
727# CONFIG_INPUT_MOUSE is not set
728# CONFIG_INPUT_JOYSTICK is not set
729# CONFIG_INPUT_TOUCHSCREEN is not set
730# CONFIG_INPUT_MISC is not set
731
732#
733# Hardware I/O ports
734#
735# CONFIG_SERIO is not set
736# CONFIG_GAMEPORT is not set
737
738#
739# Character devices
740#
741# CONFIG_VT is not set
742# CONFIG_SERIAL_NONSTANDARD is not set
743
744#
745# Serial drivers
746#
747CONFIG_SERIAL_8250=y
748CONFIG_SERIAL_8250_CONSOLE=y
749CONFIG_SERIAL_8250_PCI=y
750CONFIG_SERIAL_8250_NR_UARTS=4
751CONFIG_SERIAL_8250_RUNTIME_UARTS=4
752# CONFIG_SERIAL_8250_EXTENDED is not set
753
754#
755# Non-8250 serial port support
756#
757CONFIG_SERIAL_CORE=y
758CONFIG_SERIAL_CORE_CONSOLE=y
759# CONFIG_SERIAL_JSM is not set
760CONFIG_UNIX98_PTYS=y
761CONFIG_LEGACY_PTYS=y
762CONFIG_LEGACY_PTY_COUNT=256
763
764#
765# IPMI
766#
767# CONFIG_IPMI_HANDLER is not set
768
769#
770# Watchdog Cards
771#
772# CONFIG_WATCHDOG is not set
773CONFIG_RTC=m
774CONFIG_GEN_RTC=m
775CONFIG_GEN_RTC_X=y
776# CONFIG_DTLK is not set
777# CONFIG_R3964 is not set
778# CONFIG_APPLICOM is not set
779
780#
781# Ftape, the floppy tape device driver
782#
783# CONFIG_DRM is not set
784# CONFIG_RAW_DRIVER is not set
785
786#
787# TPM devices
788#
789# CONFIG_TCG_TPM is not set
790# CONFIG_TELCLOCK is not set
791
792#
793# I2C support
794#
795CONFIG_I2C=y
796CONFIG_I2C_CHARDEV=y
797
798#
799# I2C Algorithms
800#
801# CONFIG_I2C_ALGOBIT is not set
802# CONFIG_I2C_ALGOPCF is not set
803# CONFIG_I2C_ALGOPCA is not set
804
805#
806# I2C Hardware Bus support
807#
808# CONFIG_I2C_ALI1535 is not set
809# CONFIG_I2C_ALI1563 is not set
810# CONFIG_I2C_ALI15X3 is not set
811# CONFIG_I2C_AMD756 is not set
812# CONFIG_I2C_AMD8111 is not set
813# CONFIG_I2C_I801 is not set
814# CONFIG_I2C_I810 is not set
815# CONFIG_I2C_PIIX4 is not set
816# CONFIG_I2C_NFORCE2 is not set
817# CONFIG_I2C_PARPORT_LIGHT is not set
818# CONFIG_I2C_PROSAVAGE is not set
819# CONFIG_I2C_SAVAGE4 is not set
820# CONFIG_I2C_SIS5595 is not set
821# CONFIG_I2C_SIS630 is not set
822# CONFIG_I2C_SIS96X is not set
823# CONFIG_I2C_STUB is not set
824# CONFIG_I2C_VIA is not set
825# CONFIG_I2C_VIAPRO is not set
826# CONFIG_I2C_VOODOO3 is not set
827# CONFIG_I2C_PCA_ISA is not set
828
829#
830# Miscellaneous I2C Chip support
831#
832# CONFIG_SENSORS_DS1337 is not set
833# CONFIG_SENSORS_DS1374 is not set
834# CONFIG_SENSORS_EEPROM is not set
835# CONFIG_SENSORS_PCF8574 is not set
836# CONFIG_SENSORS_PCA9539 is not set
837# CONFIG_SENSORS_PCF8591 is not set
838# CONFIG_SENSORS_MAX6875 is not set
839CONFIG_I2C_DEBUG_CORE=y
840# CONFIG_I2C_DEBUG_ALGO is not set
841CONFIG_I2C_DEBUG_BUS=y
842# CONFIG_I2C_DEBUG_CHIP is not set
843
844#
845# SPI support
846#
847# CONFIG_SPI is not set
848# CONFIG_SPI_MASTER is not set
849
850#
851# Dallas's 1-wire bus
852#
853# CONFIG_W1 is not set
854
855#
856# Hardware Monitoring support
857#
858CONFIG_HWMON=y
859# CONFIG_HWMON_VID is not set
860# CONFIG_SENSORS_ADM1021 is not set
861# CONFIG_SENSORS_ADM1025 is not set
862# CONFIG_SENSORS_ADM1026 is not set
863# CONFIG_SENSORS_ADM1031 is not set
864# CONFIG_SENSORS_ADM9240 is not set
865# CONFIG_SENSORS_ASB100 is not set
866# CONFIG_SENSORS_ATXP1 is not set
867# CONFIG_SENSORS_DS1621 is not set
868# CONFIG_SENSORS_F71805F is not set
869# CONFIG_SENSORS_FSCHER is not set
870# CONFIG_SENSORS_FSCPOS is not set
871# CONFIG_SENSORS_GL518SM is not set
872# CONFIG_SENSORS_GL520SM is not set
873# CONFIG_SENSORS_IT87 is not set
874# CONFIG_SENSORS_LM63 is not set
875# CONFIG_SENSORS_LM75 is not set
876# CONFIG_SENSORS_LM77 is not set
877# CONFIG_SENSORS_LM78 is not set
878# CONFIG_SENSORS_LM80 is not set
879# CONFIG_SENSORS_LM83 is not set
880# CONFIG_SENSORS_LM85 is not set
881# CONFIG_SENSORS_LM87 is not set
882# CONFIG_SENSORS_LM90 is not set
883# CONFIG_SENSORS_LM92 is not set
884# CONFIG_SENSORS_MAX1619 is not set
885# CONFIG_SENSORS_PC87360 is not set
886# CONFIG_SENSORS_SIS5595 is not set
887# CONFIG_SENSORS_SMSC47M1 is not set
888# CONFIG_SENSORS_SMSC47B397 is not set
889# CONFIG_SENSORS_VIA686A is not set
890# CONFIG_SENSORS_VT8231 is not set
891# CONFIG_SENSORS_W83781D is not set
892# CONFIG_SENSORS_W83792D is not set
893# CONFIG_SENSORS_W83L785TS is not set
894# CONFIG_SENSORS_W83627HF is not set
895# CONFIG_SENSORS_W83627EHF is not set
896# CONFIG_HWMON_DEBUG_CHIP is not set
897
898#
899# Misc devices
900#
901
902#
903# Multimedia devices
904#
905# CONFIG_VIDEO_DEV is not set
906CONFIG_VIDEO_V4L2=y
907
908#
909# Digital Video Broadcasting Devices
910#
911# CONFIG_DVB is not set
912
913#
914# Graphics support
915#
916# CONFIG_FB is not set
917
918#
919# Sound
920#
921# CONFIG_SOUND is not set
922
923#
924# USB support
925#
926CONFIG_USB_ARCH_HAS_HCD=y
927CONFIG_USB_ARCH_HAS_OHCI=y
928CONFIG_USB_ARCH_HAS_EHCI=y
929# CONFIG_USB is not set
930
931#
932# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
933#
934
935#
936# USB Gadget Support
937#
938# CONFIG_USB_GADGET is not set
939
940#
941# MMC/SD Card support
942#
943# CONFIG_MMC is not set
944
945#
946# LED devices
947#
948# CONFIG_NEW_LEDS is not set
949
950#
951# LED drivers
952#
953
954#
955# LED Triggers
956#
957
958#
959# InfiniBand support
960#
961# CONFIG_INFINIBAND is not set
962
963#
964# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
965#
966
967#
968# Real Time Clock
969#
970# CONFIG_RTC_CLASS is not set
971
972#
973# File systems
974#
975CONFIG_EXT2_FS=y
976CONFIG_EXT2_FS_XATTR=y
977CONFIG_EXT2_FS_POSIX_ACL=y
978CONFIG_EXT2_FS_SECURITY=y
979# CONFIG_EXT2_FS_XIP is not set
980CONFIG_EXT3_FS=m
981CONFIG_EXT3_FS_XATTR=y
982# CONFIG_EXT3_FS_POSIX_ACL is not set
983# CONFIG_EXT3_FS_SECURITY is not set
984CONFIG_JBD=m
985# CONFIG_JBD_DEBUG is not set
986CONFIG_FS_MBCACHE=y
987# CONFIG_REISERFS_FS is not set
988# CONFIG_JFS_FS is not set
989CONFIG_FS_POSIX_ACL=y
990CONFIG_XFS_FS=m
991CONFIG_XFS_EXPORT=y
992# CONFIG_XFS_QUOTA is not set
993# CONFIG_XFS_SECURITY is not set
994# CONFIG_XFS_POSIX_ACL is not set
995# CONFIG_XFS_RT is not set
996# CONFIG_OCFS2_FS is not set
997# CONFIG_MINIX_FS is not set
998# CONFIG_ROMFS_FS is not set
999CONFIG_INOTIFY=y
1000# CONFIG_QUOTA is not set
1001# CONFIG_DNOTIFY is not set
1002# CONFIG_AUTOFS_FS is not set
1003CONFIG_AUTOFS4_FS=m
1004# CONFIG_FUSE_FS is not set
1005
1006#
1007# CD-ROM/DVD Filesystems
1008#
1009# CONFIG_ISO9660_FS is not set
1010# CONFIG_UDF_FS is not set
1011
1012#
1013# DOS/FAT/NT Filesystems
1014#
1015CONFIG_FAT_FS=y
1016CONFIG_MSDOS_FS=y
1017CONFIG_VFAT_FS=y
1018CONFIG_FAT_DEFAULT_CODEPAGE=437
1019CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1020CONFIG_NTFS_FS=m
1021# CONFIG_NTFS_DEBUG is not set
1022# CONFIG_NTFS_RW is not set
1023
1024#
1025# Pseudo filesystems
1026#
1027CONFIG_PROC_FS=y
1028CONFIG_PROC_KCORE=y
1029CONFIG_SYSFS=y
1030CONFIG_TMPFS=y
1031# CONFIG_HUGETLB_PAGE is not set
1032CONFIG_RAMFS=y
1033# CONFIG_CONFIGFS_FS is not set
1034
1035#
1036# Miscellaneous filesystems
1037#
1038# CONFIG_ADFS_FS is not set
1039# CONFIG_AFFS_FS is not set
1040# CONFIG_HFS_FS is not set
1041# CONFIG_HFSPLUS_FS is not set
1042# CONFIG_BEFS_FS is not set
1043# CONFIG_BFS_FS is not set
1044# CONFIG_EFS_FS is not set
1045# CONFIG_JFFS_FS is not set
1046CONFIG_JFFS2_FS=y
1047CONFIG_JFFS2_FS_DEBUG=0
1048CONFIG_JFFS2_FS_WRITEBUFFER=y
1049# CONFIG_JFFS2_SUMMARY is not set
1050CONFIG_JFFS2_COMPRESSION_OPTIONS=y
1051CONFIG_JFFS2_ZLIB=y
1052CONFIG_JFFS2_RTIME=y
1053# CONFIG_JFFS2_RUBIN is not set
1054# CONFIG_JFFS2_CMODE_NONE is not set
1055CONFIG_JFFS2_CMODE_PRIORITY=y
1056# CONFIG_JFFS2_CMODE_SIZE is not set
1057CONFIG_CRAMFS=y
1058# CONFIG_VXFS_FS is not set
1059# CONFIG_HPFS_FS is not set
1060# CONFIG_QNX4FS_FS is not set
1061# CONFIG_SYSV_FS is not set
1062# CONFIG_UFS_FS is not set
1063
1064#
1065# Network File Systems
1066#
1067CONFIG_NFS_FS=y
1068CONFIG_NFS_V3=y
1069# CONFIG_NFS_V3_ACL is not set
1070CONFIG_NFS_V4=y
1071CONFIG_NFS_DIRECTIO=y
1072CONFIG_NFSD=m
1073CONFIG_NFSD_V3=y
1074# CONFIG_NFSD_V3_ACL is not set
1075# CONFIG_NFSD_V4 is not set
1076CONFIG_NFSD_TCP=y
1077CONFIG_ROOT_NFS=y
1078CONFIG_LOCKD=y
1079CONFIG_LOCKD_V4=y
1080CONFIG_EXPORTFS=m
1081CONFIG_NFS_COMMON=y
1082CONFIG_SUNRPC=y
1083CONFIG_SUNRPC_GSS=y
1084CONFIG_RPCSEC_GSS_KRB5=y
1085# CONFIG_RPCSEC_GSS_SPKM3 is not set
1086CONFIG_SMB_FS=m
1087# CONFIG_SMB_NLS_DEFAULT is not set
1088# CONFIG_CIFS is not set
1089# CONFIG_NCP_FS is not set
1090# CONFIG_CODA_FS is not set
1091# CONFIG_AFS_FS is not set
1092# CONFIG_9P_FS is not set
1093
1094#
1095# Partition Types
1096#
1097# CONFIG_PARTITION_ADVANCED is not set
1098CONFIG_MSDOS_PARTITION=y
1099
1100#
1101# Native Language Support
1102#
1103CONFIG_NLS=y
1104CONFIG_NLS_DEFAULT=""
1105CONFIG_NLS_CODEPAGE_437=m
1106# CONFIG_NLS_CODEPAGE_737 is not set
1107# CONFIG_NLS_CODEPAGE_775 is not set
1108# CONFIG_NLS_CODEPAGE_850 is not set
1109# CONFIG_NLS_CODEPAGE_852 is not set
1110# CONFIG_NLS_CODEPAGE_855 is not set
1111# CONFIG_NLS_CODEPAGE_857 is not set
1112# CONFIG_NLS_CODEPAGE_860 is not set
1113# CONFIG_NLS_CODEPAGE_861 is not set
1114# CONFIG_NLS_CODEPAGE_862 is not set
1115# CONFIG_NLS_CODEPAGE_863 is not set
1116# CONFIG_NLS_CODEPAGE_864 is not set
1117# CONFIG_NLS_CODEPAGE_865 is not set
1118# CONFIG_NLS_CODEPAGE_866 is not set
1119# CONFIG_NLS_CODEPAGE_869 is not set
1120# CONFIG_NLS_CODEPAGE_936 is not set
1121# CONFIG_NLS_CODEPAGE_950 is not set
1122# CONFIG_NLS_CODEPAGE_932 is not set
1123# CONFIG_NLS_CODEPAGE_949 is not set
1124# CONFIG_NLS_CODEPAGE_874 is not set
1125# CONFIG_NLS_ISO8859_8 is not set
1126# CONFIG_NLS_CODEPAGE_1250 is not set
1127# CONFIG_NLS_CODEPAGE_1251 is not set
1128CONFIG_NLS_ASCII=m
1129CONFIG_NLS_ISO8859_1=m
1130# CONFIG_NLS_ISO8859_2 is not set
1131# CONFIG_NLS_ISO8859_3 is not set
1132# CONFIG_NLS_ISO8859_4 is not set
1133# CONFIG_NLS_ISO8859_5 is not set
1134# CONFIG_NLS_ISO8859_6 is not set
1135# CONFIG_NLS_ISO8859_7 is not set
1136# CONFIG_NLS_ISO8859_9 is not set
1137# CONFIG_NLS_ISO8859_13 is not set
1138# CONFIG_NLS_ISO8859_14 is not set
1139# CONFIG_NLS_ISO8859_15 is not set
1140# CONFIG_NLS_KOI8_R is not set
1141# CONFIG_NLS_KOI8_U is not set
1142CONFIG_NLS_UTF8=m
1143
1144#
1145# Profiling support
1146#
1147# CONFIG_PROFILING is not set
1148
1149#
1150# Kernel hacking
1151#
1152# CONFIG_PRINTK_TIME is not set
1153# CONFIG_MAGIC_SYSRQ is not set
1154# CONFIG_DEBUG_KERNEL is not set
1155CONFIG_LOG_BUF_SHIFT=14
1156# CONFIG_DEBUG_FS is not set
1157CONFIG_CROSSCOMPILE=y
1158CONFIG_CMDLINE="console=ttyS0,115200 mem=192m ip=bootp root=/dev/nfs rw"
1159
1160#
1161# Security options
1162#
1163# CONFIG_KEYS is not set
1164# CONFIG_SECURITY is not set
1165
1166#
1167# Cryptographic options
1168#
1169CONFIG_CRYPTO=y
1170CONFIG_CRYPTO_HMAC=y
1171# CONFIG_CRYPTO_NULL is not set
1172# CONFIG_CRYPTO_MD4 is not set
1173CONFIG_CRYPTO_MD5=y
1174# CONFIG_CRYPTO_SHA1 is not set
1175# CONFIG_CRYPTO_SHA256 is not set
1176# CONFIG_CRYPTO_SHA512 is not set
1177# CONFIG_CRYPTO_WP512 is not set
1178# CONFIG_CRYPTO_TGR192 is not set
1179CONFIG_CRYPTO_DES=y
1180# CONFIG_CRYPTO_BLOWFISH is not set
1181# CONFIG_CRYPTO_TWOFISH is not set
1182# CONFIG_CRYPTO_SERPENT is not set
1183# CONFIG_CRYPTO_AES is not set
1184# CONFIG_CRYPTO_CAST5 is not set
1185# CONFIG_CRYPTO_CAST6 is not set
1186# CONFIG_CRYPTO_TEA is not set
1187# CONFIG_CRYPTO_ARC4 is not set
1188# CONFIG_CRYPTO_KHAZAD is not set
1189# CONFIG_CRYPTO_ANUBIS is not set
1190# CONFIG_CRYPTO_DEFLATE is not set
1191# CONFIG_CRYPTO_MICHAEL_MIC is not set
1192# CONFIG_CRYPTO_CRC32C is not set
1193# CONFIG_CRYPTO_TEST is not set
1194
1195#
1196# Hardware crypto devices
1197#
1198
1199#
1200# Library routines
1201#
1202CONFIG_CRC_CCITT=m
1203# CONFIG_CRC16 is not set
1204CONFIG_CRC32=y
1205# CONFIG_LIBCRC32C is not set
1206CONFIG_ZLIB_INFLATE=y
1207CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/mips/configs/ev64120_defconfig b/arch/mips/configs/ev64120_defconfig
index 7067f608b22c..5248a1d8131d 100644
--- a/arch/mips/configs/ev64120_defconfig
+++ b/arch/mips/configs/ev64120_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_EV64120=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -131,6 +129,15 @@ CONFIG_FLATMEM=y
131CONFIG_FLAT_NODE_MEM_MAP=y 129CONFIG_FLAT_NODE_MEM_MAP=y
132# CONFIG_SPARSEMEM_STATIC is not set 130# CONFIG_SPARSEMEM_STATIC is not set
133CONFIG_SPLIT_PTLOCK_CPUS=4 131CONFIG_SPLIT_PTLOCK_CPUS=4
132# CONFIG_HZ_48 is not set
133# CONFIG_HZ_100 is not set
134# CONFIG_HZ_128 is not set
135# CONFIG_HZ_250 is not set
136# CONFIG_HZ_256 is not set
137CONFIG_HZ_1000=y
138# CONFIG_HZ_1024 is not set
139CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
140CONFIG_HZ=1000
134CONFIG_PREEMPT_NONE=y 141CONFIG_PREEMPT_NONE=y
135# CONFIG_PREEMPT_VOLUNTARY is not set 142# CONFIG_PREEMPT_VOLUNTARY is not set
136# CONFIG_PREEMPT is not set 143# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/ev96100_defconfig b/arch/mips/configs/ev96100_defconfig
index 00b56ed0e638..4858491ce669 100644
--- a/arch/mips/configs/ev96100_defconfig
+++ b/arch/mips/configs/ev96100_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_EV96100=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -135,6 +133,15 @@ CONFIG_FLATMEM=y
135CONFIG_FLAT_NODE_MEM_MAP=y 133CONFIG_FLAT_NODE_MEM_MAP=y
136# CONFIG_SPARSEMEM_STATIC is not set 134# CONFIG_SPARSEMEM_STATIC is not set
137CONFIG_SPLIT_PTLOCK_CPUS=4 135CONFIG_SPLIT_PTLOCK_CPUS=4
136# CONFIG_HZ_48 is not set
137# CONFIG_HZ_100 is not set
138# CONFIG_HZ_128 is not set
139# CONFIG_HZ_250 is not set
140# CONFIG_HZ_256 is not set
141CONFIG_HZ_1000=y
142# CONFIG_HZ_1024 is not set
143CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
144CONFIG_HZ=1000
138CONFIG_PREEMPT_NONE=y 145CONFIG_PREEMPT_NONE=y
139# CONFIG_PREEMPT_VOLUNTARY is not set 146# CONFIG_PREEMPT_VOLUNTARY is not set
140# CONFIG_PREEMPT is not set 147# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/excite_defconfig b/arch/mips/configs/excite_defconfig
new file mode 100644
index 000000000000..f2ce64cb41a8
--- /dev/null
+++ b/arch/mips/configs/excite_defconfig
@@ -0,0 +1,1220 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc4
4# Thu Feb 23 13:15:27 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
44CONFIG_BASLER_EXCITE=y
45# CONFIG_BASLER_EXCITE_PROTOTYPE is not set
46# CONFIG_DDB5074 is not set
47# CONFIG_DDB5476 is not set
48# CONFIG_DDB5477 is not set
49# CONFIG_MACH_VR41XX is not set
50# CONFIG_PMC_YOSEMITE is not set
51# CONFIG_QEMU is not set
52# CONFIG_SGI_IP22 is not set
53# CONFIG_SGI_IP27 is not set
54# CONFIG_SGI_IP32 is not set
55# CONFIG_SIBYTE_BIGSUR is not set
56# CONFIG_SIBYTE_SWARM is not set
57# CONFIG_SIBYTE_SENTOSA is not set
58# CONFIG_SIBYTE_RHONE is not set
59# CONFIG_SIBYTE_CARMEL is not set
60# CONFIG_SIBYTE_PTSWARM is not set
61# CONFIG_SIBYTE_LITTLESUR is not set
62# CONFIG_SIBYTE_CRHINE is not set
63# CONFIG_SIBYTE_CRHONE is not set
64# CONFIG_SNI_RM200_PCI is not set
65# CONFIG_TOSHIBA_JMR3927 is not set
66# CONFIG_TOSHIBA_RBTX4927 is not set
67# CONFIG_TOSHIBA_RBTX4938 is not set
68CONFIG_RWSEM_GENERIC_SPINLOCK=y
69CONFIG_GENERIC_CALIBRATE_DELAY=y
70CONFIG_DMA_COHERENT=y
71CONFIG_SERIAL_RM9000=y
72CONFIG_CPU_BIG_ENDIAN=y
73# CONFIG_CPU_LITTLE_ENDIAN is not set
74CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
75CONFIG_IRQ_CPU=y
76CONFIG_IRQ_CPU_RM7K=y
77CONFIG_IRQ_CPU_RM9K=y
78CONFIG_MIPS_L1_CACHE_SHIFT=5
79
80#
81# CPU selection
82#
83# CONFIG_CPU_MIPS32_R1 is not set
84# CONFIG_CPU_MIPS32_R2 is not set
85# CONFIG_CPU_MIPS64_R1 is not set
86# CONFIG_CPU_MIPS64_R2 is not set
87# CONFIG_CPU_R3000 is not set
88# CONFIG_CPU_TX39XX is not set
89# CONFIG_CPU_VR41XX is not set
90# CONFIG_CPU_R4300 is not set
91# CONFIG_CPU_R4X00 is not set
92# CONFIG_CPU_TX49XX is not set
93# CONFIG_CPU_R5000 is not set
94# CONFIG_CPU_R5432 is not set
95# CONFIG_CPU_R6000 is not set
96# CONFIG_CPU_NEVADA is not set
97# CONFIG_CPU_R8000 is not set
98# CONFIG_CPU_R10000 is not set
99# CONFIG_CPU_RM7000 is not set
100CONFIG_CPU_RM9000=y
101# CONFIG_CPU_SB1 is not set
102CONFIG_SYS_HAS_CPU_RM9000=y
103CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
104CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
105CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
106CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
107
108#
109# Kernel type
110#
111CONFIG_32BIT=y
112# CONFIG_64BIT is not set
113CONFIG_PAGE_SIZE_4KB=y
114# CONFIG_PAGE_SIZE_8KB is not set
115# CONFIG_PAGE_SIZE_16KB is not set
116# CONFIG_PAGE_SIZE_64KB is not set
117CONFIG_CPU_HAS_PREFETCH=y
118# CONFIG_MIPS_MT is not set
119# CONFIG_64BIT_PHYS_ADDR is not set
120# CONFIG_CPU_ADVANCED is not set
121CONFIG_CPU_HAS_LLSC=y
122CONFIG_CPU_HAS_SYNC=y
123CONFIG_GENERIC_HARDIRQS=y
124CONFIG_GENERIC_IRQ_PROBE=y
125CONFIG_CPU_SUPPORTS_HIGHMEM=y
126CONFIG_ARCH_FLATMEM_ENABLE=y
127CONFIG_SELECT_MEMORY_MODEL=y
128CONFIG_FLATMEM_MANUAL=y
129# CONFIG_DISCONTIGMEM_MANUAL is not set
130# CONFIG_SPARSEMEM_MANUAL is not set
131CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y
133# CONFIG_SPARSEMEM_STATIC is not set
134CONFIG_SPLIT_PTLOCK_CPUS=4
135# CONFIG_HZ_48 is not set
136# CONFIG_HZ_100 is not set
137# CONFIG_HZ_128 is not set
138# CONFIG_HZ_250 is not set
139# CONFIG_HZ_256 is not set
140CONFIG_HZ_1000=y
141# CONFIG_HZ_1024 is not set
142CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
143CONFIG_HZ=1000
144# CONFIG_SMP is not set
145# CONFIG_PREEMPT_NONE is not set
146# CONFIG_PREEMPT_VOLUNTARY is not set
147CONFIG_PREEMPT=y
148CONFIG_PREEMPT_BKL=y
149
150#
151# Code maturity level options
152#
153CONFIG_EXPERIMENTAL=y
154CONFIG_BROKEN_ON_SMP=y
155CONFIG_LOCK_KERNEL=y
156CONFIG_INIT_ENV_ARG_LIMIT=32
157
158#
159# General setup
160#
161CONFIG_LOCALVERSION=""
162# CONFIG_LOCALVERSION_AUTO is not set
163CONFIG_SWAP=y
164CONFIG_SYSVIPC=y
165CONFIG_POSIX_MQUEUE=y
166# CONFIG_BSD_PROCESS_ACCT is not set
167CONFIG_SYSCTL=y
168# CONFIG_AUDIT is not set
169# CONFIG_IKCONFIG is not set
170CONFIG_INITRAMFS_SOURCE=""
171CONFIG_CC_OPTIMIZE_FOR_SIZE=y
172CONFIG_EMBEDDED=y
173CONFIG_KALLSYMS=y
174# CONFIG_KALLSYMS_EXTRA_PASS is not set
175CONFIG_HOTPLUG=y
176CONFIG_PRINTK=y
177CONFIG_BUG=y
178CONFIG_ELF_CORE=y
179CONFIG_BASE_FULL=y
180CONFIG_FUTEX=y
181CONFIG_EPOLL=y
182CONFIG_SHMEM=y
183CONFIG_CC_ALIGN_FUNCTIONS=0
184CONFIG_CC_ALIGN_LABELS=0
185CONFIG_CC_ALIGN_LOOPS=0
186CONFIG_CC_ALIGN_JUMPS=0
187CONFIG_SLAB=y
188# CONFIG_TINY_SHMEM is not set
189CONFIG_BASE_SMALL=0
190# CONFIG_SLOB is not set
191
192#
193# Loadable module support
194#
195CONFIG_MODULES=y
196CONFIG_MODULE_UNLOAD=y
197# CONFIG_MODULE_FORCE_UNLOAD is not set
198CONFIG_OBSOLETE_MODPARM=y
199# CONFIG_MODVERSIONS is not set
200# CONFIG_MODULE_SRCVERSION_ALL is not set
201CONFIG_KMOD=y
202
203#
204# Block layer
205#
206# CONFIG_LBD is not set
207
208#
209# IO Schedulers
210#
211CONFIG_IOSCHED_NOOP=y
212CONFIG_IOSCHED_AS=y
213CONFIG_IOSCHED_DEADLINE=y
214CONFIG_IOSCHED_CFQ=y
215CONFIG_DEFAULT_AS=y
216# CONFIG_DEFAULT_DEADLINE is not set
217# CONFIG_DEFAULT_CFQ is not set
218# CONFIG_DEFAULT_NOOP is not set
219CONFIG_DEFAULT_IOSCHED="anticipatory"
220
221#
222# Bus options (PCI, PCMCIA, EISA, ISA, TC)
223#
224CONFIG_HW_HAS_PCI=y
225CONFIG_PCI=y
226# CONFIG_PCI_LEGACY_PROC is not set
227CONFIG_MMU=y
228
229#
230# PCCARD (PCMCIA/CardBus) support
231#
232# CONFIG_PCCARD is not set
233
234#
235# PCI Hotplug Support
236#
237# CONFIG_HOTPLUG_PCI is not set
238
239#
240# Executable file formats
241#
242CONFIG_BINFMT_ELF=y
243# CONFIG_BINFMT_MISC is not set
244CONFIG_TRAD_SIGNALS=y
245
246#
247# Networking
248#
249CONFIG_NET=y
250
251#
252# Networking options
253#
254# CONFIG_NETDEBUG is not set
255CONFIG_PACKET=y
256CONFIG_PACKET_MMAP=y
257CONFIG_UNIX=y
258# CONFIG_NET_KEY is not set
259CONFIG_INET=y
260# CONFIG_IP_MULTICAST is not set
261# CONFIG_IP_ADVANCED_ROUTER is not set
262CONFIG_IP_FIB_HASH=y
263CONFIG_IP_PNP=y
264CONFIG_IP_PNP_DHCP=y
265# CONFIG_IP_PNP_BOOTP is not set
266# CONFIG_IP_PNP_RARP is not set
267# CONFIG_NET_IPIP is not set
268# CONFIG_NET_IPGRE is not set
269# CONFIG_ARPD is not set
270# CONFIG_SYN_COOKIES is not set
271# CONFIG_INET_AH is not set
272# CONFIG_INET_ESP is not set
273# CONFIG_INET_IPCOMP is not set
274# CONFIG_INET_TUNNEL is not set
275CONFIG_INET_DIAG=y
276CONFIG_INET_TCP_DIAG=y
277# CONFIG_TCP_CONG_ADVANCED is not set
278CONFIG_TCP_CONG_BIC=y
279# CONFIG_IPV6 is not set
280# CONFIG_NETFILTER is not set
281
282#
283# DCCP Configuration (EXPERIMENTAL)
284#
285# CONFIG_IP_DCCP is not set
286
287#
288# SCTP Configuration (EXPERIMENTAL)
289#
290# CONFIG_IP_SCTP is not set
291
292#
293# TIPC Configuration (EXPERIMENTAL)
294#
295# CONFIG_TIPC is not set
296# CONFIG_ATM is not set
297# CONFIG_BRIDGE is not set
298# CONFIG_VLAN_8021Q is not set
299# CONFIG_DECNET is not set
300# CONFIG_LLC2 is not set
301# CONFIG_IPX is not set
302# CONFIG_ATALK is not set
303# CONFIG_X25 is not set
304# CONFIG_LAPB is not set
305# CONFIG_NET_DIVERT is not set
306# CONFIG_ECONET is not set
307# CONFIG_WAN_ROUTER is not set
308
309#
310# QoS and/or fair queueing
311#
312# CONFIG_NET_SCHED is not set
313
314#
315# Network testing
316#
317# CONFIG_NET_PKTGEN is not set
318# CONFIG_HAMRADIO is not set
319# CONFIG_IRDA is not set
320# CONFIG_BT is not set
321# CONFIG_IEEE80211 is not set
322
323#
324# Device Drivers
325#
326
327#
328# Generic Driver Options
329#
330CONFIG_STANDALONE=y
331CONFIG_PREVENT_FIRMWARE_BUILD=y
332# CONFIG_FW_LOADER is not set
333
334#
335# Connector - unified userspace <-> kernelspace linker
336#
337# CONFIG_CONNECTOR is not set
338
339#
340# Memory Technology Devices (MTD)
341#
342CONFIG_MTD=y
343# CONFIG_MTD_DEBUG is not set
344# CONFIG_MTD_CONCAT is not set
345CONFIG_MTD_PARTITIONS=y
346# CONFIG_MTD_REDBOOT_PARTS is not set
347# CONFIG_MTD_CMDLINE_PARTS is not set
348
349#
350# User Modules And Translation Layers
351#
352CONFIG_MTD_CHAR=y
353CONFIG_MTD_BLOCK=y
354# CONFIG_FTL is not set
355# CONFIG_NFTL is not set
356# CONFIG_INFTL is not set
357# CONFIG_RFD_FTL is not set
358
359#
360# RAM/ROM/Flash chip drivers
361#
362# CONFIG_MTD_CFI is not set
363# CONFIG_MTD_JEDECPROBE is not set
364CONFIG_MTD_MAP_BANK_WIDTH_1=y
365CONFIG_MTD_MAP_BANK_WIDTH_2=y
366CONFIG_MTD_MAP_BANK_WIDTH_4=y
367# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
368# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
369# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
370CONFIG_MTD_CFI_I1=y
371CONFIG_MTD_CFI_I2=y
372# CONFIG_MTD_CFI_I4 is not set
373# CONFIG_MTD_CFI_I8 is not set
374# CONFIG_MTD_RAM is not set
375# CONFIG_MTD_ROM is not set
376# CONFIG_MTD_ABSENT is not set
377# CONFIG_MTD_OBSOLETE_CHIPS is not set
378
379#
380# Mapping drivers for chip access
381#
382# CONFIG_MTD_COMPLEX_MAPPINGS is not set
383# CONFIG_MTD_PLATRAM is not set
384
385#
386# Self-contained MTD device drivers
387#
388# CONFIG_MTD_PMC551 is not set
389# CONFIG_MTD_SLRAM is not set
390# CONFIG_MTD_PHRAM is not set
391# CONFIG_MTD_MTDRAM is not set
392# CONFIG_MTD_BLKMTD is not set
393# CONFIG_MTD_BLOCK2MTD is not set
394
395#
396# Disk-On-Chip Device Drivers
397#
398# CONFIG_MTD_DOC2000 is not set
399# CONFIG_MTD_DOC2001 is not set
400# CONFIG_MTD_DOC2001PLUS is not set
401
402#
403# NAND Flash Device Drivers
404#
405CONFIG_MTD_NAND=y
406CONFIG_MTD_NAND_VERIFY_WRITE=y
407CONFIG_MTD_NAND_IDS=y
408# CONFIG_MTD_NAND_DISKONCHIP is not set
409CONFIG_MTD_NAND_BASLER_EXCITE=y
410# CONFIG_MTD_NAND_BASLER_EXCITE_RDNBY is not set
411# CONFIG_MTD_NAND_BASLER_EXCITE_PERF is not set
412# CONFIG_MTD_NAND_NANDSIM is not set
413
414#
415# OneNAND Flash Device Drivers
416#
417# CONFIG_MTD_ONENAND is not set
418
419#
420# Parallel port support
421#
422# CONFIG_PARPORT is not set
423
424#
425# Plug and Play support
426#
427
428#
429# Block devices
430#
431# CONFIG_BLK_CPQ_DA is not set
432# CONFIG_BLK_CPQ_CISS_DA is not set
433# CONFIG_BLK_DEV_DAC960 is not set
434# CONFIG_BLK_DEV_UMEM is not set
435# CONFIG_BLK_DEV_COW_COMMON is not set
436CONFIG_BLK_DEV_LOOP=m
437# CONFIG_BLK_DEV_CRYPTOLOOP is not set
438# CONFIG_BLK_DEV_NBD is not set
439# CONFIG_BLK_DEV_SX8 is not set
440# CONFIG_BLK_DEV_UB is not set
441# CONFIG_BLK_DEV_RAM is not set
442CONFIG_BLK_DEV_RAM_COUNT=16
443# CONFIG_CDROM_PKTCDVD is not set
444# CONFIG_ATA_OVER_ETH is not set
445
446#
447# ATA/ATAPI/MFM/RLL support
448#
449# CONFIG_IDE is not set
450
451#
452# SCSI device support
453#
454# CONFIG_RAID_ATTRS is not set
455CONFIG_SCSI=y
456# CONFIG_SCSI_PROC_FS is not set
457
458#
459# SCSI support type (disk, tape, CD-ROM)
460#
461CONFIG_BLK_DEV_SD=y
462# CONFIG_CHR_DEV_ST is not set
463# CONFIG_CHR_DEV_OSST is not set
464# CONFIG_BLK_DEV_SR is not set
465# CONFIG_CHR_DEV_SG is not set
466# CONFIG_CHR_DEV_SCH is not set
467
468#
469# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
470#
471# CONFIG_SCSI_MULTI_LUN is not set
472# CONFIG_SCSI_CONSTANTS is not set
473# CONFIG_SCSI_LOGGING is not set
474
475#
476# SCSI Transport Attributes
477#
478# CONFIG_SCSI_SPI_ATTRS is not set
479# CONFIG_SCSI_FC_ATTRS is not set
480# CONFIG_SCSI_ISCSI_ATTRS is not set
481# CONFIG_SCSI_SAS_ATTRS is not set
482
483#
484# SCSI low-level drivers
485#
486# CONFIG_ISCSI_TCP is not set
487# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
488# CONFIG_SCSI_3W_9XXX is not set
489# CONFIG_SCSI_ACARD is not set
490# CONFIG_SCSI_AACRAID is not set
491# CONFIG_SCSI_AIC7XXX is not set
492# CONFIG_SCSI_AIC7XXX_OLD is not set
493# CONFIG_SCSI_AIC79XX is not set
494# CONFIG_SCSI_DPT_I2O is not set
495# CONFIG_MEGARAID_NEWGEN is not set
496# CONFIG_MEGARAID_LEGACY is not set
497# CONFIG_MEGARAID_SAS is not set
498# CONFIG_SCSI_SATA is not set
499# CONFIG_SCSI_DMX3191D is not set
500# CONFIG_SCSI_FUTURE_DOMAIN is not set
501# CONFIG_SCSI_IPS is not set
502# CONFIG_SCSI_INITIO is not set
503# CONFIG_SCSI_INIA100 is not set
504# CONFIG_SCSI_SYM53C8XX_2 is not set
505# CONFIG_SCSI_IPR is not set
506# CONFIG_SCSI_QLOGIC_FC is not set
507# CONFIG_SCSI_QLOGIC_1280 is not set
508# CONFIG_SCSI_QLA_FC is not set
509# CONFIG_SCSI_LPFC is not set
510# CONFIG_SCSI_DC395x is not set
511# CONFIG_SCSI_DC390T is not set
512# CONFIG_SCSI_NSP32 is not set
513# CONFIG_SCSI_DEBUG is not set
514
515#
516# Multi-device support (RAID and LVM)
517#
518# CONFIG_MD is not set
519
520#
521# Fusion MPT device support
522#
523# CONFIG_FUSION is not set
524# CONFIG_FUSION_SPI is not set
525# CONFIG_FUSION_FC is not set
526# CONFIG_FUSION_SAS is not set
527
528#
529# IEEE 1394 (FireWire) support
530#
531# CONFIG_IEEE1394 is not set
532
533#
534# I2O device support
535#
536# CONFIG_I2O is not set
537
538#
539# Network device support
540#
541CONFIG_NETDEVICES=y
542# CONFIG_DUMMY is not set
543# CONFIG_BONDING is not set
544# CONFIG_EQUALIZER is not set
545# CONFIG_TUN is not set
546
547#
548# ARCnet devices
549#
550# CONFIG_ARCNET is not set
551
552#
553# PHY device support
554#
555
556#
557# Ethernet (10 or 100Mbit)
558#
559# CONFIG_NET_ETHERNET is not set
560
561#
562# Ethernet (1000 Mbit)
563#
564# CONFIG_ACENIC is not set
565# CONFIG_DL2K is not set
566# CONFIG_E1000 is not set
567# CONFIG_NS83820 is not set
568# CONFIG_HAMACHI is not set
569# CONFIG_YELLOWFIN is not set
570# CONFIG_R8169 is not set
571# CONFIG_SIS190 is not set
572# CONFIG_SKGE is not set
573# CONFIG_SKY2 is not set
574# CONFIG_SK98LIN is not set
575# CONFIG_TIGON3 is not set
576# CONFIG_BNX2 is not set
577# CONFIG_TITAN_GE is not set
578CONFIG_RM9K_GE=m
579
580#
581# Ethernet (10000 Mbit)
582#
583# CONFIG_CHELSIO_T1 is not set
584# CONFIG_IXGB is not set
585# CONFIG_S2IO is not set
586
587#
588# Token Ring devices
589#
590# CONFIG_TR is not set
591
592#
593# Wireless LAN (non-hamradio)
594#
595# CONFIG_NET_RADIO is not set
596
597#
598# Wan interfaces
599#
600# CONFIG_WAN is not set
601# CONFIG_FDDI is not set
602# CONFIG_HIPPI is not set
603# CONFIG_PPP is not set
604# CONFIG_SLIP is not set
605# CONFIG_NET_FC is not set
606# CONFIG_SHAPER is not set
607# CONFIG_NETCONSOLE is not set
608# CONFIG_NETPOLL is not set
609# CONFIG_NET_POLL_CONTROLLER is not set
610
611#
612# ISDN subsystem
613#
614# CONFIG_ISDN is not set
615
616#
617# Telephony Support
618#
619# CONFIG_PHONE is not set
620
621#
622# Input device support
623#
624CONFIG_INPUT=y
625
626#
627# Userland interfaces
628#
629CONFIG_INPUT_MOUSEDEV=m
630CONFIG_INPUT_MOUSEDEV_PSAUX=y
631CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
632CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
633# CONFIG_INPUT_JOYDEV is not set
634# CONFIG_INPUT_TSDEV is not set
635CONFIG_INPUT_EVDEV=m
636# CONFIG_INPUT_EVBUG is not set
637
638#
639# Input Device Drivers
640#
641# CONFIG_INPUT_KEYBOARD is not set
642# CONFIG_INPUT_MOUSE is not set
643# CONFIG_INPUT_JOYSTICK is not set
644# CONFIG_INPUT_TOUCHSCREEN is not set
645# CONFIG_INPUT_MISC is not set
646
647#
648# Hardware I/O ports
649#
650# CONFIG_SERIO is not set
651# CONFIG_GAMEPORT is not set
652
653#
654# Character devices
655#
656CONFIG_VT=y
657CONFIG_VT_CONSOLE=y
658CONFIG_HW_CONSOLE=y
659# CONFIG_SERIAL_NONSTANDARD is not set
660
661#
662# Serial drivers
663#
664CONFIG_SERIAL_8250=y
665CONFIG_SERIAL_8250_CONSOLE=y
666CONFIG_SERIAL_8250_NR_UARTS=2
667CONFIG_SERIAL_8250_RUNTIME_UARTS=2
668CONFIG_SERIAL_8250_EXTENDED=y
669# CONFIG_SERIAL_8250_MANY_PORTS is not set
670CONFIG_SERIAL_8250_SHARE_IRQ=y
671# CONFIG_SERIAL_8250_DETECT_IRQ is not set
672# CONFIG_SERIAL_8250_RSA is not set
673
674#
675# Non-8250 serial port support
676#
677CONFIG_SERIAL_CORE=y
678CONFIG_SERIAL_CORE_CONSOLE=y
679# CONFIG_SERIAL_JSM is not set
680CONFIG_UNIX98_PTYS=y
681# CONFIG_LEGACY_PTYS is not set
682
683#
684# IPMI
685#
686# CONFIG_IPMI_HANDLER is not set
687
688#
689# Watchdog Cards
690#
691CONFIG_WATCHDOG=y
692# CONFIG_WATCHDOG_NOWAYOUT is not set
693
694#
695# Watchdog Device Drivers
696#
697# CONFIG_SOFT_WATCHDOG is not set
698CONFIG_WDT_RM9K_GPI=m
699
700#
701# PCI-based Watchdog Cards
702#
703# CONFIG_PCIPCWATCHDOG is not set
704# CONFIG_WDTPCI is not set
705
706#
707# USB-based Watchdog Cards
708#
709# CONFIG_USBPCWATCHDOG is not set
710# CONFIG_RTC is not set
711# CONFIG_GEN_RTC is not set
712# CONFIG_DTLK is not set
713# CONFIG_R3964 is not set
714# CONFIG_APPLICOM is not set
715
716#
717# Ftape, the floppy tape device driver
718#
719# CONFIG_DRM is not set
720# CONFIG_RAW_DRIVER is not set
721
722#
723# TPM devices
724#
725# CONFIG_TCG_TPM is not set
726# CONFIG_TELCLOCK is not set
727
728#
729# I2C support
730#
731# CONFIG_I2C is not set
732
733#
734# SPI support
735#
736# CONFIG_SPI is not set
737# CONFIG_SPI_MASTER is not set
738
739#
740# Dallas's 1-wire bus
741#
742# CONFIG_W1 is not set
743
744#
745# Hardware Monitoring support
746#
747# CONFIG_HWMON is not set
748# CONFIG_HWMON_VID is not set
749
750#
751# Misc devices
752#
753
754#
755# Multimedia Capabilities Port drivers
756#
757
758#
759# Multimedia devices
760#
761# CONFIG_VIDEO_DEV is not set
762
763#
764# Digital Video Broadcasting Devices
765#
766# CONFIG_DVB is not set
767
768#
769# Graphics support
770#
771CONFIG_FB=y
772CONFIG_FB_CFB_FILLRECT=y
773CONFIG_FB_CFB_COPYAREA=y
774CONFIG_FB_CFB_IMAGEBLIT=y
775# CONFIG_FB_MACMODES is not set
776# CONFIG_FB_MODE_HELPERS is not set
777# CONFIG_FB_TILEBLITTING is not set
778# CONFIG_FB_CIRRUS is not set
779# CONFIG_FB_PM2 is not set
780# CONFIG_FB_CYBER2000 is not set
781# CONFIG_FB_ASILIANT is not set
782# CONFIG_FB_IMSTT is not set
783# CONFIG_FB_S1D13XXX is not set
784# CONFIG_FB_NVIDIA is not set
785# CONFIG_FB_RIVA is not set
786# CONFIG_FB_MATROX is not set
787# CONFIG_FB_RADEON_OLD is not set
788# CONFIG_FB_RADEON is not set
789# CONFIG_FB_ATY128 is not set
790# CONFIG_FB_ATY is not set
791# CONFIG_FB_SAVAGE is not set
792# CONFIG_FB_SIS is not set
793# CONFIG_FB_NEOMAGIC is not set
794# CONFIG_FB_KYRO is not set
795# CONFIG_FB_3DFX is not set
796# CONFIG_FB_VOODOO1 is not set
797# CONFIG_FB_SMIVGX is not set
798# CONFIG_FB_TRIDENT is not set
799# CONFIG_FB_VIRTUAL is not set
800CONFIG_FB_DD=y
801
802#
803# Console display driver support
804#
805# CONFIG_VGA_CONSOLE is not set
806CONFIG_DUMMY_CONSOLE=y
807CONFIG_FRAMEBUFFER_CONSOLE=m
808# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
809# CONFIG_FONTS is not set
810CONFIG_FONT_8x8=y
811CONFIG_FONT_8x16=y
812
813#
814# Logo configuration
815#
816# CONFIG_LOGO is not set
817# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
818
819#
820# Sound
821#
822# CONFIG_SOUND is not set
823
824#
825# USB support
826#
827CONFIG_USB_ARCH_HAS_HCD=y
828CONFIG_USB_ARCH_HAS_OHCI=y
829CONFIG_USB=y
830# CONFIG_USB_DEBUG is not set
831
832#
833# Miscellaneous USB options
834#
835CONFIG_USB_DEVICEFS=y
836# CONFIG_USB_BANDWIDTH is not set
837# CONFIG_USB_DYNAMIC_MINORS is not set
838# CONFIG_USB_OTG is not set
839
840#
841# USB Host Controller Drivers
842#
843CONFIG_USB_EHCI_HCD=y
844# CONFIG_USB_EHCI_SPLIT_ISO is not set
845# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
846# CONFIG_USB_ISP116X_HCD is not set
847CONFIG_USB_OHCI_HCD=y
848# CONFIG_USB_OHCI_BIG_ENDIAN is not set
849CONFIG_USB_OHCI_LITTLE_ENDIAN=y
850# CONFIG_USB_UHCI_HCD is not set
851# CONFIG_USB_SL811_HCD is not set
852
853#
854# USB Device Class drivers
855#
856# CONFIG_USB_ACM is not set
857# CONFIG_USB_PRINTER is not set
858
859#
860# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
861#
862
863#
864# may also be needed; see USB_STORAGE Help for more information
865#
866CONFIG_USB_STORAGE=y
867# CONFIG_USB_STORAGE_DEBUG is not set
868# CONFIG_USB_STORAGE_DATAFAB is not set
869# CONFIG_USB_STORAGE_FREECOM is not set
870# CONFIG_USB_STORAGE_DPCM is not set
871# CONFIG_USB_STORAGE_USBAT is not set
872# CONFIG_USB_STORAGE_SDDR09 is not set
873# CONFIG_USB_STORAGE_SDDR55 is not set
874# CONFIG_USB_STORAGE_JUMPSHOT is not set
875# CONFIG_USB_STORAGE_ALAUDA is not set
876# CONFIG_USB_STORAGE_ONETOUCH is not set
877# CONFIG_USB_LIBUSUAL is not set
878
879#
880# USB Input Devices
881#
882CONFIG_USB_HID=m
883CONFIG_USB_HIDINPUT=y
884# CONFIG_USB_HIDINPUT_POWERBOOK is not set
885# CONFIG_HID_FF is not set
886# CONFIG_USB_HIDDEV is not set
887
888#
889# USB HID Boot Protocol drivers
890#
891# CONFIG_USB_KBD is not set
892# CONFIG_USB_MOUSE is not set
893# CONFIG_USB_AIPTEK is not set
894# CONFIG_USB_WACOM is not set
895# CONFIG_USB_ACECAD is not set
896# CONFIG_USB_KBTAB is not set
897# CONFIG_USB_POWERMATE is not set
898# CONFIG_USB_MTOUCH is not set
899# CONFIG_USB_ITMTOUCH is not set
900# CONFIG_USB_EGALAX is not set
901# CONFIG_USB_YEALINK is not set
902# CONFIG_USB_XPAD is not set
903# CONFIG_USB_ATI_REMOTE is not set
904# CONFIG_USB_ATI_REMOTE2 is not set
905# CONFIG_USB_KEYSPAN_REMOTE is not set
906# CONFIG_USB_APPLETOUCH is not set
907
908#
909# USB Imaging devices
910#
911# CONFIG_USB_MDC800 is not set
912# CONFIG_USB_MICROTEK is not set
913
914#
915# USB Multimedia devices
916#
917# CONFIG_USB_DABUSB is not set
918
919#
920# Video4Linux support is needed for USB Multimedia device support
921#
922
923#
924# USB Network Adapters
925#
926# CONFIG_USB_CATC is not set
927# CONFIG_USB_KAWETH is not set
928# CONFIG_USB_PEGASUS is not set
929# CONFIG_USB_RTL8150 is not set
930# CONFIG_USB_USBNET is not set
931# CONFIG_USB_MON is not set
932
933#
934# USB port drivers
935#
936
937#
938# USB Serial Converter support
939#
940# CONFIG_USB_SERIAL is not set
941
942#
943# USB Miscellaneous drivers
944#
945# CONFIG_USB_EMI62 is not set
946# CONFIG_USB_EMI26 is not set
947# CONFIG_USB_AUERSWALD is not set
948# CONFIG_USB_RIO500 is not set
949CONFIG_USB_ARTTFT=m
950# CONFIG_USB_ARTTOUCH is not set
951# CONFIG_USB_LEGOTOWER is not set
952# CONFIG_USB_LCD is not set
953# CONFIG_USB_LED is not set
954# CONFIG_USB_CYTHERM is not set
955# CONFIG_USB_PHIDGETKIT is not set
956# CONFIG_USB_PHIDGETSERVO is not set
957# CONFIG_USB_IDMOUSE is not set
958# CONFIG_USB_SISUSBVGA is not set
959# CONFIG_USB_LD is not set
960# CONFIG_USB_TEST is not set
961
962#
963# USB DSL modem support
964#
965
966#
967# USB Gadget Support
968#
969# CONFIG_USB_GADGET is not set
970
971#
972# MMC/SD Card support
973#
974# CONFIG_MMC is not set
975
976#
977# InfiniBand support
978#
979# CONFIG_INFINIBAND is not set
980
981#
982# SN Devices
983#
984
985#
986# EDAC - error detection and reporting (RAS)
987#
988
989#
990# eXcite frame capture support
991#
992CONFIG_EXCITE_FCAP=m
993CONFIG_EXCITE_FCAP_GPI=m
994
995#
996# File systems
997#
998CONFIG_EXT2_FS=y
999# CONFIG_EXT2_FS_XATTR is not set
1000# CONFIG_EXT2_FS_XIP is not set
1001# CONFIG_EXT3_FS is not set
1002# CONFIG_REISERFS_FS is not set
1003# CONFIG_JFS_FS is not set
1004# CONFIG_FS_POSIX_ACL is not set
1005# CONFIG_XFS_FS is not set
1006# CONFIG_OCFS2_FS is not set
1007# CONFIG_MINIX_FS is not set
1008# CONFIG_ROMFS_FS is not set
1009CONFIG_INOTIFY=y
1010# CONFIG_QUOTA is not set
1011# CONFIG_DNOTIFY is not set
1012# CONFIG_AUTOFS_FS is not set
1013# CONFIG_AUTOFS4_FS is not set
1014# CONFIG_FUSE_FS is not set
1015
1016#
1017# CD-ROM/DVD Filesystems
1018#
1019# CONFIG_ISO9660_FS is not set
1020# CONFIG_UDF_FS is not set
1021
1022#
1023# DOS/FAT/NT Filesystems
1024#
1025CONFIG_FAT_FS=m
1026CONFIG_MSDOS_FS=m
1027CONFIG_VFAT_FS=m
1028CONFIG_FAT_DEFAULT_CODEPAGE=437
1029CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1030# CONFIG_NTFS_FS is not set
1031
1032#
1033# Pseudo filesystems
1034#
1035CONFIG_PROC_FS=y
1036CONFIG_PROC_KCORE=y
1037CONFIG_SYSFS=y
1038CONFIG_TMPFS=y
1039# CONFIG_HUGETLB_PAGE is not set
1040CONFIG_RAMFS=y
1041# CONFIG_RELAYFS_FS is not set
1042# CONFIG_CONFIGFS_FS is not set
1043
1044#
1045# Miscellaneous filesystems
1046#
1047# CONFIG_ADFS_FS is not set
1048# CONFIG_AFFS_FS is not set
1049# CONFIG_HFS_FS is not set
1050# CONFIG_HFSPLUS_FS is not set
1051# CONFIG_BEFS_FS is not set
1052# CONFIG_BFS_FS is not set
1053# CONFIG_EFS_FS is not set
1054# CONFIG_JFFS_FS is not set
1055CONFIG_JFFS2_FS=y
1056CONFIG_JFFS2_FS_DEBUG=0
1057CONFIG_JFFS2_FS_WRITEBUFFER=y
1058# CONFIG_JFFS2_SUMMARY is not set
1059# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1060CONFIG_JFFS2_ZLIB=y
1061CONFIG_JFFS2_RTIME=y
1062# CONFIG_JFFS2_RUBIN is not set
1063# CONFIG_CRAMFS is not set
1064# CONFIG_VXFS_FS is not set
1065# CONFIG_HPFS_FS is not set
1066# CONFIG_QNX4FS_FS is not set
1067# CONFIG_SYSV_FS is not set
1068# CONFIG_UFS_FS is not set
1069
1070#
1071# Network File Systems
1072#
1073CONFIG_NFS_FS=y
1074CONFIG_NFS_V3=y
1075# CONFIG_NFS_V3_ACL is not set
1076# CONFIG_NFS_V4 is not set
1077# CONFIG_NFS_DIRECTIO is not set
1078# CONFIG_NFSD is not set
1079CONFIG_ROOT_NFS=y
1080CONFIG_LOCKD=y
1081CONFIG_LOCKD_V4=y
1082CONFIG_NFS_COMMON=y
1083CONFIG_SUNRPC=y
1084# CONFIG_RPCSEC_GSS_KRB5 is not set
1085# CONFIG_RPCSEC_GSS_SPKM3 is not set
1086# CONFIG_SMB_FS is not set
1087# CONFIG_CIFS is not set
1088# CONFIG_NCP_FS is not set
1089# CONFIG_CODA_FS is not set
1090# CONFIG_AFS_FS is not set
1091# CONFIG_9P_FS is not set
1092
1093#
1094# Partition Types
1095#
1096CONFIG_PARTITION_ADVANCED=y
1097# CONFIG_ACORN_PARTITION is not set
1098# CONFIG_OSF_PARTITION is not set
1099# CONFIG_AMIGA_PARTITION is not set
1100# CONFIG_ATARI_PARTITION is not set
1101# CONFIG_MAC_PARTITION is not set
1102CONFIG_MSDOS_PARTITION=y
1103# CONFIG_BSD_DISKLABEL is not set
1104# CONFIG_MINIX_SUBPARTITION is not set
1105# CONFIG_SOLARIS_X86_PARTITION is not set
1106# CONFIG_UNIXWARE_DISKLABEL is not set
1107# CONFIG_LDM_PARTITION is not set
1108# CONFIG_SGI_PARTITION is not set
1109# CONFIG_ULTRIX_PARTITION is not set
1110# CONFIG_SUN_PARTITION is not set
1111# CONFIG_KARMA_PARTITION is not set
1112# CONFIG_EFI_PARTITION is not set
1113
1114#
1115# Native Language Support
1116#
1117CONFIG_NLS=y
1118CONFIG_NLS_DEFAULT="iso8859-1"
1119CONFIG_NLS_CODEPAGE_437=m
1120# CONFIG_NLS_CODEPAGE_737 is not set
1121# CONFIG_NLS_CODEPAGE_775 is not set
1122CONFIG_NLS_CODEPAGE_850=m
1123# CONFIG_NLS_CODEPAGE_852 is not set
1124# CONFIG_NLS_CODEPAGE_855 is not set
1125# CONFIG_NLS_CODEPAGE_857 is not set
1126# CONFIG_NLS_CODEPAGE_860 is not set
1127# CONFIG_NLS_CODEPAGE_861 is not set
1128# CONFIG_NLS_CODEPAGE_862 is not set
1129# CONFIG_NLS_CODEPAGE_863 is not set
1130# CONFIG_NLS_CODEPAGE_864 is not set
1131# CONFIG_NLS_CODEPAGE_865 is not set
1132# CONFIG_NLS_CODEPAGE_866 is not set
1133# CONFIG_NLS_CODEPAGE_869 is not set
1134# CONFIG_NLS_CODEPAGE_936 is not set
1135# CONFIG_NLS_CODEPAGE_950 is not set
1136# CONFIG_NLS_CODEPAGE_932 is not set
1137# CONFIG_NLS_CODEPAGE_949 is not set
1138# CONFIG_NLS_CODEPAGE_874 is not set
1139# CONFIG_NLS_ISO8859_8 is not set
1140# CONFIG_NLS_CODEPAGE_1250 is not set
1141# CONFIG_NLS_CODEPAGE_1251 is not set
1142# CONFIG_NLS_ASCII is not set
1143CONFIG_NLS_ISO8859_1=m
1144# CONFIG_NLS_ISO8859_2 is not set
1145# CONFIG_NLS_ISO8859_3 is not set
1146# CONFIG_NLS_ISO8859_4 is not set
1147# CONFIG_NLS_ISO8859_5 is not set
1148# CONFIG_NLS_ISO8859_6 is not set
1149# CONFIG_NLS_ISO8859_7 is not set
1150# CONFIG_NLS_ISO8859_9 is not set
1151# CONFIG_NLS_ISO8859_13 is not set
1152# CONFIG_NLS_ISO8859_14 is not set
1153# CONFIG_NLS_ISO8859_15 is not set
1154# CONFIG_NLS_KOI8_R is not set
1155# CONFIG_NLS_KOI8_U is not set
1156# CONFIG_NLS_UTF8 is not set
1157
1158#
1159# Profiling support
1160#
1161# CONFIG_PROFILING is not set
1162
1163#
1164# Kernel hacking
1165#
1166# CONFIG_PRINTK_TIME is not set
1167# CONFIG_MAGIC_SYSRQ is not set
1168# CONFIG_DEBUG_KERNEL is not set
1169CONFIG_LOG_BUF_SHIFT=14
1170CONFIG_CROSSCOMPILE=y
1171CONFIG_CMDLINE=""
1172
1173#
1174# Security options
1175#
1176# CONFIG_KEYS is not set
1177# CONFIG_SECURITY is not set
1178
1179#
1180# Cryptographic options
1181#
1182CONFIG_CRYPTO=y
1183# CONFIG_CRYPTO_HMAC is not set
1184# CONFIG_CRYPTO_NULL is not set
1185# CONFIG_CRYPTO_MD4 is not set
1186# CONFIG_CRYPTO_MD5 is not set
1187# CONFIG_CRYPTO_SHA1 is not set
1188# CONFIG_CRYPTO_SHA256 is not set
1189# CONFIG_CRYPTO_SHA512 is not set
1190# CONFIG_CRYPTO_WP512 is not set
1191# CONFIG_CRYPTO_TGR192 is not set
1192# CONFIG_CRYPTO_DES is not set
1193# CONFIG_CRYPTO_BLOWFISH is not set
1194# CONFIG_CRYPTO_TWOFISH is not set
1195# CONFIG_CRYPTO_SERPENT is not set
1196# CONFIG_CRYPTO_AES is not set
1197# CONFIG_CRYPTO_CAST5 is not set
1198# CONFIG_CRYPTO_CAST6 is not set
1199# CONFIG_CRYPTO_TEA is not set
1200# CONFIG_CRYPTO_ARC4 is not set
1201# CONFIG_CRYPTO_KHAZAD is not set
1202# CONFIG_CRYPTO_ANUBIS is not set
1203# CONFIG_CRYPTO_DEFLATE is not set
1204# CONFIG_CRYPTO_MICHAEL_MIC is not set
1205# CONFIG_CRYPTO_CRC32C is not set
1206# CONFIG_CRYPTO_TEST is not set
1207
1208#
1209# Hardware crypto devices
1210#
1211
1212#
1213# Library routines
1214#
1215# CONFIG_CRC_CCITT is not set
1216# CONFIG_CRC16 is not set
1217CONFIG_CRC32=y
1218# CONFIG_LIBCRC32C is not set
1219CONFIG_ZLIB_INFLATE=y
1220CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index 607e2985ffe3..879ba1ad99ca 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -136,6 +134,15 @@ CONFIG_FLATMEM=y
136CONFIG_FLAT_NODE_MEM_MAP=y 134CONFIG_FLAT_NODE_MEM_MAP=y
137# CONFIG_SPARSEMEM_STATIC is not set 135# CONFIG_SPARSEMEM_STATIC is not set
138CONFIG_SPLIT_PTLOCK_CPUS=4 136CONFIG_SPLIT_PTLOCK_CPUS=4
137# CONFIG_HZ_48 is not set
138# CONFIG_HZ_100 is not set
139# CONFIG_HZ_128 is not set
140# CONFIG_HZ_250 is not set
141# CONFIG_HZ_256 is not set
142CONFIG_HZ_1000=y
143# CONFIG_HZ_1024 is not set
144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
145CONFIG_HZ=1000
139# CONFIG_PREEMPT_NONE is not set 146# CONFIG_PREEMPT_NONE is not set
140CONFIG_PREEMPT_VOLUNTARY=y 147CONFIG_PREEMPT_VOLUNTARY=y
141# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index f724b4b2ecf2..bb1426806430 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -63,7 +61,7 @@ CONFIG_SGI_IP27=y
63# CONFIG_TOSHIBA_JMR3927 is not set 61# CONFIG_TOSHIBA_JMR3927 is not set
64# CONFIG_TOSHIBA_RBTX4927 is not set 62# CONFIG_TOSHIBA_RBTX4927 is not set
65# CONFIG_TOSHIBA_RBTX4938 is not set 63# CONFIG_TOSHIBA_RBTX4938 is not set
66# CONFIG_SGI_SN0_N_MODE is not set 64# CONFIG_SGI_SN_N_MODE is not set
67CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 65CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
68CONFIG_NUMA=y 66CONFIG_NUMA=y
69# CONFIG_MAPPED_KERNEL is not set 67# CONFIG_MAPPED_KERNEL is not set
@@ -135,6 +133,15 @@ CONFIG_FLAT_NODE_MEM_MAP=y
135CONFIG_NEED_MULTIPLE_NODES=y 133CONFIG_NEED_MULTIPLE_NODES=y
136# CONFIG_SPARSEMEM_STATIC is not set 134# CONFIG_SPARSEMEM_STATIC is not set
137CONFIG_SPLIT_PTLOCK_CPUS=4 135CONFIG_SPLIT_PTLOCK_CPUS=4
136# CONFIG_HZ_48 is not set
137# CONFIG_HZ_100 is not set
138# CONFIG_HZ_128 is not set
139# CONFIG_HZ_250 is not set
140# CONFIG_HZ_256 is not set
141CONFIG_HZ_1000=y
142# CONFIG_HZ_1024 is not set
143CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
144CONFIG_HZ=1000
138CONFIG_MIGRATION=y 145CONFIG_MIGRATION=y
139CONFIG_SMP=y 146CONFIG_SMP=y
140CONFIG_NR_CPUS=64 147CONFIG_NR_CPUS=64
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index 8f11d3565b2d..31b3c92a3841 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -136,6 +134,15 @@ CONFIG_FLATMEM=y
136CONFIG_FLAT_NODE_MEM_MAP=y 134CONFIG_FLAT_NODE_MEM_MAP=y
137# CONFIG_SPARSEMEM_STATIC is not set 135# CONFIG_SPARSEMEM_STATIC is not set
138CONFIG_SPLIT_PTLOCK_CPUS=4 136CONFIG_SPLIT_PTLOCK_CPUS=4
137# CONFIG_HZ_48 is not set
138# CONFIG_HZ_100 is not set
139# CONFIG_HZ_128 is not set
140# CONFIG_HZ_250 is not set
141# CONFIG_HZ_256 is not set
142CONFIG_HZ_1000=y
143# CONFIG_HZ_1024 is not set
144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
145CONFIG_HZ=1000
139# CONFIG_PREEMPT_NONE is not set 146# CONFIG_PREEMPT_NONE is not set
140CONFIG_PREEMPT_VOLUNTARY=y 147CONFIG_PREEMPT_VOLUNTARY=y
141# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/it8172_defconfig b/arch/mips/configs/it8172_defconfig
index 757adf23853d..809bae9013ac 100644
--- a/arch/mips/configs/it8172_defconfig
+++ b/arch/mips/configs/it8172_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_ITE8172=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
134# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
135# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/ivr_defconfig b/arch/mips/configs/ivr_defconfig
index 021761a8a237..55108fd67844 100644
--- a/arch/mips/configs/ivr_defconfig
+++ b/arch/mips/configs/ivr_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_IVR=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -127,6 +125,15 @@ CONFIG_FLATMEM=y
127CONFIG_FLAT_NODE_MEM_MAP=y 125CONFIG_FLAT_NODE_MEM_MAP=y
128# CONFIG_SPARSEMEM_STATIC is not set 126# CONFIG_SPARSEMEM_STATIC is not set
129CONFIG_SPLIT_PTLOCK_CPUS=4 127CONFIG_SPLIT_PTLOCK_CPUS=4
128# CONFIG_HZ_48 is not set
129# CONFIG_HZ_100 is not set
130# CONFIG_HZ_128 is not set
131# CONFIG_HZ_250 is not set
132# CONFIG_HZ_256 is not set
133CONFIG_HZ_1000=y
134# CONFIG_HZ_1024 is not set
135CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
136CONFIG_HZ=1000
130CONFIG_PREEMPT_NONE=y 137CONFIG_PREEMPT_NONE=y
131# CONFIG_PREEMPT_VOLUNTARY is not set 138# CONFIG_PREEMPT_VOLUNTARY is not set
132# CONFIG_PREEMPT is not set 139# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/jaguar-atx_defconfig b/arch/mips/configs/jaguar-atx_defconfig
index 08f6c30b0abc..ef2843436057 100644
--- a/arch/mips/configs/jaguar-atx_defconfig
+++ b/arch/mips/configs/jaguar-atx_defconfig
@@ -41,8 +41,6 @@ CONFIG_MOMENCO_JAGUAR_ATX=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -136,6 +134,15 @@ CONFIG_FLATMEM=y
136CONFIG_FLAT_NODE_MEM_MAP=y 134CONFIG_FLAT_NODE_MEM_MAP=y
137# CONFIG_SPARSEMEM_STATIC is not set 135# CONFIG_SPARSEMEM_STATIC is not set
138CONFIG_SPLIT_PTLOCK_CPUS=4 136CONFIG_SPLIT_PTLOCK_CPUS=4
137# CONFIG_HZ_48 is not set
138# CONFIG_HZ_100 is not set
139# CONFIG_HZ_128 is not set
140# CONFIG_HZ_250 is not set
141# CONFIG_HZ_256 is not set
142CONFIG_HZ_1000=y
143# CONFIG_HZ_1024 is not set
144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
145CONFIG_HZ=1000
139# CONFIG_SMP is not set 146# CONFIG_SMP is not set
140CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
141# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index 38b1e026e10d..5ef5a08289a5 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -125,6 +123,15 @@ CONFIG_FLATMEM=y
125CONFIG_FLAT_NODE_MEM_MAP=y 123CONFIG_FLAT_NODE_MEM_MAP=y
126# CONFIG_SPARSEMEM_STATIC is not set 124# CONFIG_SPARSEMEM_STATIC is not set
127CONFIG_SPLIT_PTLOCK_CPUS=4 125CONFIG_SPLIT_PTLOCK_CPUS=4
126# CONFIG_HZ_48 is not set
127# CONFIG_HZ_100 is not set
128# CONFIG_HZ_128 is not set
129# CONFIG_HZ_250 is not set
130# CONFIG_HZ_256 is not set
131CONFIG_HZ_1000=y
132# CONFIG_HZ_1024 is not set
133CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
134CONFIG_HZ=1000
128CONFIG_PREEMPT_NONE=y 135CONFIG_PREEMPT_NONE=y
129# CONFIG_PREEMPT_VOLUNTARY is not set 136# CONFIG_PREEMPT_VOLUNTARY is not set
130# CONFIG_PREEMPT is not set 137# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/lasat200_defconfig b/arch/mips/configs/lasat200_defconfig
index 4d25990a0a05..eabcff26fc0e 100644
--- a/arch/mips/configs/lasat200_defconfig
+++ b/arch/mips/configs/lasat200_defconfig
@@ -41,8 +41,6 @@ CONFIG_LASAT=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -134,6 +132,15 @@ CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y 132CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set 133# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4 134CONFIG_SPLIT_PTLOCK_CPUS=4
135# CONFIG_HZ_48 is not set
136# CONFIG_HZ_100 is not set
137# CONFIG_HZ_128 is not set
138# CONFIG_HZ_250 is not set
139# CONFIG_HZ_256 is not set
140CONFIG_HZ_1000=y
141# CONFIG_HZ_1024 is not set
142CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
143CONFIG_HZ=1000
137CONFIG_PREEMPT_NONE=y 144CONFIG_PREEMPT_NONE=y
138# CONFIG_PREEMPT_VOLUNTARY is not set 145# CONFIG_PREEMPT_VOLUNTARY is not set
139# CONFIG_PREEMPT is not set 146# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 977f52be51dc..b73cff0d83ca 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_MALTA=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -154,6 +152,15 @@ CONFIG_FLATMEM=y
154CONFIG_FLAT_NODE_MEM_MAP=y 152CONFIG_FLAT_NODE_MEM_MAP=y
155# CONFIG_SPARSEMEM_STATIC is not set 153# CONFIG_SPARSEMEM_STATIC is not set
156CONFIG_SPLIT_PTLOCK_CPUS=4 154CONFIG_SPLIT_PTLOCK_CPUS=4
155# CONFIG_HZ_48 is not set
156CONFIG_HZ_100=y
157# CONFIG_HZ_128 is not set
158# CONFIG_HZ_250 is not set
159# CONFIG_HZ_256 is not set
160# CONFIG_HZ_1000 is not set
161# CONFIG_HZ_1024 is not set
162CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
163CONFIG_HZ=100
157CONFIG_PREEMPT_NONE=y 164CONFIG_PREEMPT_NONE=y
158# CONFIG_PREEMPT_VOLUNTARY is not set 165# CONFIG_PREEMPT_VOLUNTARY is not set
159# CONFIG_PREEMPT is not set 166# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index 00560e0143f1..8dd27b55413d 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_SIM=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -138,6 +136,15 @@ CONFIG_FLATMEM=y
138CONFIG_FLAT_NODE_MEM_MAP=y 136CONFIG_FLAT_NODE_MEM_MAP=y
139# CONFIG_SPARSEMEM_STATIC is not set 137# CONFIG_SPARSEMEM_STATIC is not set
140CONFIG_SPLIT_PTLOCK_CPUS=4 138CONFIG_SPLIT_PTLOCK_CPUS=4
139# CONFIG_HZ_48 is not set
140# CONFIG_HZ_100 is not set
141# CONFIG_HZ_128 is not set
142# CONFIG_HZ_250 is not set
143# CONFIG_HZ_256 is not set
144CONFIG_HZ_1000=y
145# CONFIG_HZ_1024 is not set
146CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
147CONFIG_HZ=1000
141CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
142# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
143# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index 286a018375b2..5d6ff3c352c9 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47CONFIG_MACH_VR41XX=y 45CONFIG_MACH_VR41XX=y
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -132,6 +130,15 @@ CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 130CONFIG_FLAT_NODE_MEM_MAP=y
133# CONFIG_SPARSEMEM_STATIC is not set 131# CONFIG_SPARSEMEM_STATIC is not set
134CONFIG_SPLIT_PTLOCK_CPUS=4 132CONFIG_SPLIT_PTLOCK_CPUS=4
133# CONFIG_HZ_48 is not set
134# CONFIG_HZ_100 is not set
135# CONFIG_HZ_128 is not set
136# CONFIG_HZ_250 is not set
137# CONFIG_HZ_256 is not set
138CONFIG_HZ_1000=y
139# CONFIG_HZ_1024 is not set
140CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
141CONFIG_HZ=1000
135CONFIG_PREEMPT_NONE=y 142CONFIG_PREEMPT_NONE=y
136# CONFIG_PREEMPT_VOLUNTARY is not set 143# CONFIG_PREEMPT_VOLUNTARY is not set
137# CONFIG_PREEMPT is not set 144# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/ocelot_3_defconfig b/arch/mips/configs/ocelot_3_defconfig
index 1ce4310fd92a..fe5e3dd915f5 100644
--- a/arch/mips/configs/ocelot_3_defconfig
+++ b/arch/mips/configs/ocelot_3_defconfig
@@ -41,8 +41,6 @@ CONFIG_MOMENCO_OCELOT_3=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -136,6 +134,15 @@ CONFIG_FLATMEM=y
136CONFIG_FLAT_NODE_MEM_MAP=y 134CONFIG_FLAT_NODE_MEM_MAP=y
137# CONFIG_SPARSEMEM_STATIC is not set 135# CONFIG_SPARSEMEM_STATIC is not set
138CONFIG_SPLIT_PTLOCK_CPUS=4 136CONFIG_SPLIT_PTLOCK_CPUS=4
137# CONFIG_HZ_48 is not set
138# CONFIG_HZ_100 is not set
139# CONFIG_HZ_128 is not set
140# CONFIG_HZ_250 is not set
141# CONFIG_HZ_256 is not set
142CONFIG_HZ_1000=y
143# CONFIG_HZ_1024 is not set
144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
145CONFIG_HZ=1000
139# CONFIG_SMP is not set 146# CONFIG_SMP is not set
140CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
141# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
diff --git a/arch/mips/configs/ocelot_c_defconfig b/arch/mips/configs/ocelot_c_defconfig
index 8a6aa5012f89..f4a33ce47e50 100644
--- a/arch/mips/configs/ocelot_c_defconfig
+++ b/arch/mips/configs/ocelot_c_defconfig
@@ -41,8 +41,6 @@ CONFIG_MOMENCO_OCELOT_C=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -133,6 +131,15 @@ CONFIG_FLATMEM=y
133CONFIG_FLAT_NODE_MEM_MAP=y 131CONFIG_FLAT_NODE_MEM_MAP=y
134# CONFIG_SPARSEMEM_STATIC is not set 132# CONFIG_SPARSEMEM_STATIC is not set
135CONFIG_SPLIT_PTLOCK_CPUS=4 133CONFIG_SPLIT_PTLOCK_CPUS=4
134# CONFIG_HZ_48 is not set
135# CONFIG_HZ_100 is not set
136# CONFIG_HZ_128 is not set
137# CONFIG_HZ_250 is not set
138# CONFIG_HZ_256 is not set
139CONFIG_HZ_1000=y
140# CONFIG_HZ_1024 is not set
141CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
142CONFIG_HZ=1000
136CONFIG_PREEMPT_NONE=y 143CONFIG_PREEMPT_NONE=y
137# CONFIG_PREEMPT_VOLUNTARY is not set 144# CONFIG_PREEMPT_VOLUNTARY is not set
138# CONFIG_PREEMPT is not set 145# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
index f9ee35eeb762..21dea9549feb 100644
--- a/arch/mips/configs/ocelot_defconfig
+++ b/arch/mips/configs/ocelot_defconfig
@@ -41,8 +41,6 @@ CONFIG_MOMENCO_OCELOT=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -137,6 +135,15 @@ CONFIG_FLATMEM=y
137CONFIG_FLAT_NODE_MEM_MAP=y 135CONFIG_FLAT_NODE_MEM_MAP=y
138# CONFIG_SPARSEMEM_STATIC is not set 136# CONFIG_SPARSEMEM_STATIC is not set
139CONFIG_SPLIT_PTLOCK_CPUS=4 137CONFIG_SPLIT_PTLOCK_CPUS=4
138# CONFIG_HZ_48 is not set
139# CONFIG_HZ_100 is not set
140# CONFIG_HZ_128 is not set
141# CONFIG_HZ_250 is not set
142# CONFIG_HZ_256 is not set
143CONFIG_HZ_1000=y
144# CONFIG_HZ_1024 is not set
145CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
146CONFIG_HZ=1000
140CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
141# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
142# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/ocelot_g_defconfig b/arch/mips/configs/ocelot_g_defconfig
index b48bdee2411f..c63b1ca8c8b3 100644
--- a/arch/mips/configs/ocelot_g_defconfig
+++ b/arch/mips/configs/ocelot_g_defconfig
@@ -41,8 +41,6 @@ CONFIG_MOMENCO_OCELOT_G=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -136,6 +134,15 @@ CONFIG_FLATMEM=y
136CONFIG_FLAT_NODE_MEM_MAP=y 134CONFIG_FLAT_NODE_MEM_MAP=y
137# CONFIG_SPARSEMEM_STATIC is not set 135# CONFIG_SPARSEMEM_STATIC is not set
138CONFIG_SPLIT_PTLOCK_CPUS=4 136CONFIG_SPLIT_PTLOCK_CPUS=4
137# CONFIG_HZ_48 is not set
138# CONFIG_HZ_100 is not set
139# CONFIG_HZ_128 is not set
140# CONFIG_HZ_250 is not set
141# CONFIG_HZ_256 is not set
142CONFIG_HZ_1000=y
143# CONFIG_HZ_1024 is not set
144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
145CONFIG_HZ=1000
139CONFIG_PREEMPT_NONE=y 146CONFIG_PREEMPT_NONE=y
140# CONFIG_PREEMPT_VOLUNTARY is not set 147# CONFIG_PREEMPT_VOLUNTARY is not set
141# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index 01aac40634b4..6f5c7261e9de 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_PB1100=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -132,6 +130,15 @@ CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 130CONFIG_FLAT_NODE_MEM_MAP=y
133# CONFIG_SPARSEMEM_STATIC is not set 131# CONFIG_SPARSEMEM_STATIC is not set
134CONFIG_SPLIT_PTLOCK_CPUS=4 132CONFIG_SPLIT_PTLOCK_CPUS=4
133# CONFIG_HZ_48 is not set
134# CONFIG_HZ_100 is not set
135# CONFIG_HZ_128 is not set
136# CONFIG_HZ_250 is not set
137# CONFIG_HZ_256 is not set
138CONFIG_HZ_1000=y
139# CONFIG_HZ_1024 is not set
140CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
141CONFIG_HZ=1000
135CONFIG_PREEMPT_NONE=y 142CONFIG_PREEMPT_NONE=y
136# CONFIG_PREEMPT_VOLUNTARY is not set 143# CONFIG_PREEMPT_VOLUNTARY is not set
137# CONFIG_PREEMPT is not set 144# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index 398c3c265b9f..5676f3747fd5 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_PB1500=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -131,6 +129,15 @@ CONFIG_FLATMEM=y
131CONFIG_FLAT_NODE_MEM_MAP=y 129CONFIG_FLAT_NODE_MEM_MAP=y
132# CONFIG_SPARSEMEM_STATIC is not set 130# CONFIG_SPARSEMEM_STATIC is not set
133CONFIG_SPLIT_PTLOCK_CPUS=4 131CONFIG_SPLIT_PTLOCK_CPUS=4
132# CONFIG_HZ_48 is not set
133# CONFIG_HZ_100 is not set
134# CONFIG_HZ_128 is not set
135# CONFIG_HZ_250 is not set
136# CONFIG_HZ_256 is not set
137CONFIG_HZ_1000=y
138# CONFIG_HZ_1024 is not set
139CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
140CONFIG_HZ=1000
134CONFIG_PREEMPT_NONE=y 141CONFIG_PREEMPT_NONE=y
135# CONFIG_PREEMPT_VOLUNTARY is not set 142# CONFIG_PREEMPT_VOLUNTARY is not set
136# CONFIG_PREEMPT is not set 143# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index ea282a53bb66..a1c479fa613b 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_PB1550=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -131,6 +129,15 @@ CONFIG_FLATMEM=y
131CONFIG_FLAT_NODE_MEM_MAP=y 129CONFIG_FLAT_NODE_MEM_MAP=y
132# CONFIG_SPARSEMEM_STATIC is not set 130# CONFIG_SPARSEMEM_STATIC is not set
133CONFIG_SPLIT_PTLOCK_CPUS=4 131CONFIG_SPLIT_PTLOCK_CPUS=4
132# CONFIG_HZ_48 is not set
133# CONFIG_HZ_100 is not set
134# CONFIG_HZ_128 is not set
135# CONFIG_HZ_250 is not set
136# CONFIG_HZ_256 is not set
137CONFIG_HZ_1000=y
138# CONFIG_HZ_1024 is not set
139CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
140CONFIG_HZ=1000
134CONFIG_PREEMPT_NONE=y 141CONFIG_PREEMPT_NONE=y
135# CONFIG_PREEMPT_VOLUNTARY is not set 142# CONFIG_PREEMPT_VOLUNTARY is not set
136# CONFIG_PREEMPT is not set 143# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 4c57e564db0b..b2d991b80309 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43CONFIG_PNX8550_JBS=y 43CONFIG_PNX8550_JBS=y
44# CONFIG_DDB5074 is not set
45# CONFIG_DDB5476 is not set
46# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
134# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
135# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/pnx8550-v2pci_defconfig b/arch/mips/configs/pnx8550-v2pci_defconfig
index 3c8f35162fec..fe092ac92e89 100644
--- a/arch/mips/configs/pnx8550-v2pci_defconfig
+++ b/arch/mips/configs/pnx8550-v2pci_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42CONFIG_PNX8550_V2PCI=y 42CONFIG_PNX8550_V2PCI=y
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
134# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
135# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index 4bcc01dea041..db8701344cee 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -128,6 +126,15 @@ CONFIG_FLAT_NODE_MEM_MAP=y
128# CONFIG_SPARSEMEM_STATIC is not set 126# CONFIG_SPARSEMEM_STATIC is not set
129CONFIG_SPLIT_PTLOCK_CPUS=4 127CONFIG_SPLIT_PTLOCK_CPUS=4
130# CONFIG_SMP is not set 128# CONFIG_SMP is not set
129# CONFIG_HZ_48 is not set
130CONFIG_HZ_100=y
131# CONFIG_HZ_128 is not set
132# CONFIG_HZ_250 is not set
133# CONFIG_HZ_256 is not set
134# CONFIG_HZ_1000 is not set
135# CONFIG_HZ_1024 is not set
136CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
137CONFIG_HZ=100
131CONFIG_PREEMPT_NONE=y 138CONFIG_PREEMPT_NONE=y
132# CONFIG_PREEMPT_VOLUNTARY is not set 139# CONFIG_PREEMPT_VOLUNTARY is not set
133# CONFIG_PREEMPT is not set 140# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/rbhma4500_defconfig b/arch/mips/configs/rbhma4500_defconfig
index 3d441932e43a..b16731f3684b 100644
--- a/arch/mips/configs/rbhma4500_defconfig
+++ b/arch/mips/configs/rbhma4500_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -138,6 +136,15 @@ CONFIG_FLATMEM=y
138CONFIG_FLAT_NODE_MEM_MAP=y 136CONFIG_FLAT_NODE_MEM_MAP=y
139# CONFIG_SPARSEMEM_STATIC is not set 137# CONFIG_SPARSEMEM_STATIC is not set
140CONFIG_SPLIT_PTLOCK_CPUS=4 138CONFIG_SPLIT_PTLOCK_CPUS=4
139# CONFIG_HZ_48 is not set
140# CONFIG_HZ_100 is not set
141# CONFIG_HZ_128 is not set
142# CONFIG_HZ_250 is not set
143# CONFIG_HZ_256 is not set
144CONFIG_HZ_1000=y
145# CONFIG_HZ_1024 is not set
146CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
147CONFIG_HZ=1000
141CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
142# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
143# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index edfb9679a25a..8b0dd8651264 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -138,6 +136,15 @@ CONFIG_FLATMEM=y
138CONFIG_FLAT_NODE_MEM_MAP=y 136CONFIG_FLAT_NODE_MEM_MAP=y
139# CONFIG_SPARSEMEM_STATIC is not set 137# CONFIG_SPARSEMEM_STATIC is not set
140CONFIG_SPLIT_PTLOCK_CPUS=4 138CONFIG_SPLIT_PTLOCK_CPUS=4
139# CONFIG_HZ_48 is not set
140# CONFIG_HZ_100 is not set
141# CONFIG_HZ_128 is not set
142# CONFIG_HZ_250 is not set
143# CONFIG_HZ_256 is not set
144CONFIG_HZ_1000=y
145# CONFIG_HZ_1024 is not set
146CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
147CONFIG_HZ=1000
141# CONFIG_PREEMPT_NONE is not set 148# CONFIG_PREEMPT_NONE is not set
142CONFIG_PREEMPT_VOLUNTARY=y 149CONFIG_PREEMPT_VOLUNTARY=y
143# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index e388a3dae0a9..ff34ed66fe65 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -149,6 +147,15 @@ CONFIG_FLATMEM=y
149CONFIG_FLAT_NODE_MEM_MAP=y 147CONFIG_FLAT_NODE_MEM_MAP=y
150# CONFIG_SPARSEMEM_STATIC is not set 148# CONFIG_SPARSEMEM_STATIC is not set
151CONFIG_SPLIT_PTLOCK_CPUS=4 149CONFIG_SPLIT_PTLOCK_CPUS=4
150# CONFIG_HZ_48 is not set
151# CONFIG_HZ_100 is not set
152# CONFIG_HZ_128 is not set
153# CONFIG_HZ_250 is not set
154# CONFIG_HZ_256 is not set
155CONFIG_HZ_1000=y
156# CONFIG_HZ_1024 is not set
157CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
158CONFIG_HZ=1000
152CONFIG_SMP=y 159CONFIG_SMP=y
153CONFIG_NR_CPUS=2 160CONFIG_NR_CPUS=2
154CONFIG_PREEMPT_NONE=y 161CONFIG_PREEMPT_NONE=y
diff --git a/arch/mips/configs/sead_defconfig b/arch/mips/configs/sead_defconfig
index 6b8a6a416a25..77edeae7f018 100644
--- a/arch/mips/configs/sead_defconfig
+++ b/arch/mips/configs/sead_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS_SEAD=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -134,6 +132,15 @@ CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y 132CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set 133# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4 134CONFIG_SPLIT_PTLOCK_CPUS=4
135# CONFIG_HZ_48 is not set
136# CONFIG_HZ_100 is not set
137# CONFIG_HZ_128 is not set
138# CONFIG_HZ_250 is not set
139# CONFIG_HZ_256 is not set
140CONFIG_HZ_1000=y
141# CONFIG_HZ_1024 is not set
142CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
143CONFIG_HZ=1000
137CONFIG_PREEMPT_NONE=y 144CONFIG_PREEMPT_NONE=y
138# CONFIG_PREEMPT_VOLUNTARY is not set 145# CONFIG_PREEMPT_VOLUNTARY is not set
139# CONFIG_PREEMPT is not set 146# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index dba0bdcdcf29..6aa229d54851 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47CONFIG_MACH_VR41XX=y 45CONFIG_MACH_VR41XX=y
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -134,6 +132,15 @@ CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y 132CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set 133# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4 134CONFIG_SPLIT_PTLOCK_CPUS=4
135# CONFIG_HZ_48 is not set
136# CONFIG_HZ_100 is not set
137# CONFIG_HZ_128 is not set
138# CONFIG_HZ_250 is not set
139# CONFIG_HZ_256 is not set
140CONFIG_HZ_1000=y
141# CONFIG_HZ_1024 is not set
142CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
143CONFIG_HZ=1000
137CONFIG_PREEMPT_NONE=y 144CONFIG_PREEMPT_NONE=y
138# CONFIG_PREEMPT_VOLUNTARY is not set 145# CONFIG_PREEMPT_VOLUNTARY is not set
139# CONFIG_PREEMPT is not set 146# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig
index 5a924c1a5803..a187b1f0004c 100644
--- a/arch/mips/configs/tb0229_defconfig
+++ b/arch/mips/configs/tb0229_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47CONFIG_MACH_VR41XX=y 45CONFIG_MACH_VR41XX=y
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -134,6 +132,15 @@ CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y 132CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set 133# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4 134CONFIG_SPLIT_PTLOCK_CPUS=4
135# CONFIG_HZ_48 is not set
136# CONFIG_HZ_100 is not set
137# CONFIG_HZ_128 is not set
138# CONFIG_HZ_250 is not set
139# CONFIG_HZ_256 is not set
140CONFIG_HZ_1000=y
141# CONFIG_HZ_1024 is not set
142CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
143CONFIG_HZ=1000
137CONFIG_PREEMPT_NONE=y 144CONFIG_PREEMPT_NONE=y
138# CONFIG_PREEMPT_VOLUNTARY is not set 145# CONFIG_PREEMPT_VOLUNTARY is not set
139# CONFIG_PREEMPT is not set 146# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index 9f215ea350dc..258457fcbe11 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47CONFIG_MACH_VR41XX=y 45CONFIG_MACH_VR41XX=y
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -135,6 +133,15 @@ CONFIG_FLATMEM=y
135CONFIG_FLAT_NODE_MEM_MAP=y 133CONFIG_FLAT_NODE_MEM_MAP=y
136# CONFIG_SPARSEMEM_STATIC is not set 134# CONFIG_SPARSEMEM_STATIC is not set
137CONFIG_SPLIT_PTLOCK_CPUS=4 135CONFIG_SPLIT_PTLOCK_CPUS=4
136# CONFIG_HZ_48 is not set
137# CONFIG_HZ_100 is not set
138# CONFIG_HZ_128 is not set
139# CONFIG_HZ_250 is not set
140# CONFIG_HZ_256 is not set
141CONFIG_HZ_1000=y
142# CONFIG_HZ_1024 is not set
143CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
144CONFIG_HZ=1000
138CONFIG_PREEMPT_NONE=y 145CONFIG_PREEMPT_NONE=y
139# CONFIG_PREEMPT_VOLUNTARY is not set 146# CONFIG_PREEMPT_VOLUNTARY is not set
140# CONFIG_PREEMPT is not set 147# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index ac7765eb8da7..68af54f746e1 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47CONFIG_MACH_VR41XX=y 45CONFIG_MACH_VR41XX=y
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_PREEMPT_NONE=y 140CONFIG_PREEMPT_NONE=y
134# CONFIG_PREEMPT_VOLUNTARY is not set 141# CONFIG_PREEMPT_VOLUNTARY is not set
135# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
diff --git a/arch/mips/configs/ddb5476_defconfig b/arch/mips/configs/wrppmc_defconfig
index 8d88ac1bbfeb..40572a3c8cac 100644
--- a/arch/mips/configs/ddb5476_defconfig
+++ b/arch/mips/configs/wrppmc_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.17-rc2 3# Linux kernel version: 2.6.16.11
4# Mon Apr 24 14:51:00 2006 4# Fri May 5 17:11:22 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -32,6 +32,7 @@ CONFIG_MIPS=y
32# CONFIG_MIPS_ATLAS is not set 32# CONFIG_MIPS_ATLAS is not set
33# CONFIG_MIPS_MALTA is not set 33# CONFIG_MIPS_MALTA is not set
34# CONFIG_MIPS_SEAD is not set 34# CONFIG_MIPS_SEAD is not set
35CONFIG_WR_PPMC=y
35# CONFIG_MIPS_SIM is not set 36# CONFIG_MIPS_SIM is not set
36# CONFIG_MOMENCO_JAGUAR_ATX is not set 37# CONFIG_MOMENCO_JAGUAR_ATX is not set
37# CONFIG_MOMENCO_OCELOT is not set 38# CONFIG_MOMENCO_OCELOT is not set
@@ -41,8 +42,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 42# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 43# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 44# CONFIG_PNX8550_JBS is not set
44# CONFIG_DDB5074 is not set
45CONFIG_DDB5476=y
46# CONFIG_DDB5477 is not set 45# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 46# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 47# CONFIG_PMC_YOSEMITE is not set
@@ -64,24 +63,23 @@ CONFIG_DDB5476=y
64# CONFIG_TOSHIBA_RBTX4927 is not set 63# CONFIG_TOSHIBA_RBTX4927 is not set
65# CONFIG_TOSHIBA_RBTX4938 is not set 64# CONFIG_TOSHIBA_RBTX4938 is not set
66CONFIG_RWSEM_GENERIC_SPINLOCK=y 65CONFIG_RWSEM_GENERIC_SPINLOCK=y
67CONFIG_GENERIC_FIND_NEXT_BIT=y
68CONFIG_GENERIC_HWEIGHT=y
69CONFIG_GENERIC_CALIBRATE_DELAY=y 66CONFIG_GENERIC_CALIBRATE_DELAY=y
70CONFIG_DMA_NONCOHERENT=y 67CONFIG_DMA_NONCOHERENT=y
71CONFIG_DMA_NEED_PCI_MAP_STATE=y 68CONFIG_DMA_NEED_PCI_MAP_STATE=y
72CONFIG_I8259=y 69CONFIG_CPU_BIG_ENDIAN=y
73# CONFIG_CPU_BIG_ENDIAN is not set 70# CONFIG_CPU_LITTLE_ENDIAN is not set
74CONFIG_CPU_LITTLE_ENDIAN=y 71CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
75CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y 72CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
76CONFIG_IRQ_CPU=y 73CONFIG_IRQ_CPU=y
77CONFIG_DDB5XXX_COMMON=y 74CONFIG_MIPS_GT64120=y
75CONFIG_SWAP_IO_SPACE=y
76CONFIG_BOOT_ELF32=y
78CONFIG_MIPS_L1_CACHE_SHIFT=5 77CONFIG_MIPS_L1_CACHE_SHIFT=5
79CONFIG_HAVE_STD_PC_SERIAL_PORT=y
80 78
81# 79#
82# CPU selection 80# CPU selection
83# 81#
84# CONFIG_CPU_MIPS32_R1 is not set 82CONFIG_CPU_MIPS32_R1=y
85# CONFIG_CPU_MIPS32_R2 is not set 83# CONFIG_CPU_MIPS32_R2 is not set
86# CONFIG_CPU_MIPS64_R1 is not set 84# CONFIG_CPU_MIPS64_R1 is not set
87# CONFIG_CPU_MIPS64_R2 is not set 85# CONFIG_CPU_MIPS64_R2 is not set
@@ -92,7 +90,7 @@ CONFIG_HAVE_STD_PC_SERIAL_PORT=y
92# CONFIG_CPU_R4X00 is not set 90# CONFIG_CPU_R4X00 is not set
93# CONFIG_CPU_TX49XX is not set 91# CONFIG_CPU_TX49XX is not set
94# CONFIG_CPU_R5000 is not set 92# CONFIG_CPU_R5000 is not set
95CONFIG_CPU_R5432=y 93# CONFIG_CPU_R5432 is not set
96# CONFIG_CPU_R6000 is not set 94# CONFIG_CPU_R6000 is not set
97# CONFIG_CPU_NEVADA is not set 95# CONFIG_CPU_NEVADA is not set
98# CONFIG_CPU_R8000 is not set 96# CONFIG_CPU_R8000 is not set
@@ -100,11 +98,16 @@ CONFIG_CPU_R5432=y
100# CONFIG_CPU_RM7000 is not set 98# CONFIG_CPU_RM7000 is not set
101# CONFIG_CPU_RM9000 is not set 99# CONFIG_CPU_RM9000 is not set
102# CONFIG_CPU_SB1 is not set 100# CONFIG_CPU_SB1 is not set
103CONFIG_SYS_HAS_CPU_R5432=y 101CONFIG_SYS_HAS_CPU_MIPS32_R1=y
102CONFIG_SYS_HAS_CPU_MIPS32_R2=y
103CONFIG_SYS_HAS_CPU_MIPS64_R1=y
104CONFIG_SYS_HAS_CPU_NEVADA=y
105CONFIG_SYS_HAS_CPU_RM7000=y
106CONFIG_CPU_MIPS32=y
107CONFIG_CPU_MIPSR1=y
104CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y 108CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
105CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y 109CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
106CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y 110CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
107CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
108 111
109# 112#
110# Kernel type 113# Kernel type
@@ -115,11 +118,15 @@ CONFIG_PAGE_SIZE_4KB=y
115# CONFIG_PAGE_SIZE_8KB is not set 118# CONFIG_PAGE_SIZE_8KB is not set
116# CONFIG_PAGE_SIZE_16KB is not set 119# CONFIG_PAGE_SIZE_16KB is not set
117# CONFIG_PAGE_SIZE_64KB is not set 120# CONFIG_PAGE_SIZE_64KB is not set
121CONFIG_CPU_HAS_PREFETCH=y
118# CONFIG_MIPS_MT is not set 122# CONFIG_MIPS_MT is not set
123# CONFIG_64BIT_PHYS_ADDR is not set
124# CONFIG_CPU_ADVANCED is not set
119CONFIG_CPU_HAS_LLSC=y 125CONFIG_CPU_HAS_LLSC=y
120CONFIG_CPU_HAS_SYNC=y 126CONFIG_CPU_HAS_SYNC=y
121CONFIG_GENERIC_HARDIRQS=y 127CONFIG_GENERIC_HARDIRQS=y
122CONFIG_GENERIC_IRQ_PROBE=y 128CONFIG_GENERIC_IRQ_PROBE=y
129CONFIG_CPU_SUPPORTS_HIGHMEM=y
123CONFIG_ARCH_FLATMEM_ENABLE=y 130CONFIG_ARCH_FLATMEM_ENABLE=y
124CONFIG_SELECT_MEMORY_MODEL=y 131CONFIG_SELECT_MEMORY_MODEL=y
125CONFIG_FLATMEM_MANUAL=y 132CONFIG_FLATMEM_MANUAL=y
@@ -129,6 +136,15 @@ CONFIG_FLATMEM=y
129CONFIG_FLAT_NODE_MEM_MAP=y 136CONFIG_FLAT_NODE_MEM_MAP=y
130# CONFIG_SPARSEMEM_STATIC is not set 137# CONFIG_SPARSEMEM_STATIC is not set
131CONFIG_SPLIT_PTLOCK_CPUS=4 138CONFIG_SPLIT_PTLOCK_CPUS=4
139# CONFIG_HZ_48 is not set
140# CONFIG_HZ_100 is not set
141# CONFIG_HZ_128 is not set
142# CONFIG_HZ_250 is not set
143# CONFIG_HZ_256 is not set
144CONFIG_HZ_1000=y
145# CONFIG_HZ_1024 is not set
146CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
147CONFIG_HZ=1000
132CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
133# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
134# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
@@ -145,27 +161,31 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
145# 161#
146CONFIG_LOCALVERSION="" 162CONFIG_LOCALVERSION=""
147CONFIG_LOCALVERSION_AUTO=y 163CONFIG_LOCALVERSION_AUTO=y
148CONFIG_SWAP=y 164# CONFIG_SWAP is not set
149CONFIG_SYSVIPC=y 165CONFIG_SYSVIPC=y
150# CONFIG_POSIX_MQUEUE is not set 166# CONFIG_POSIX_MQUEUE is not set
151# CONFIG_BSD_PROCESS_ACCT is not set 167CONFIG_BSD_PROCESS_ACCT=y
168# CONFIG_BSD_PROCESS_ACCT_V3 is not set
152CONFIG_SYSCTL=y 169CONFIG_SYSCTL=y
153# CONFIG_AUDIT is not set 170# CONFIG_AUDIT is not set
154# CONFIG_IKCONFIG is not set 171# CONFIG_IKCONFIG is not set
155CONFIG_RELAY=y
156CONFIG_INITRAMFS_SOURCE="" 172CONFIG_INITRAMFS_SOURCE=""
157# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 173# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
158CONFIG_EMBEDDED=y 174CONFIG_EMBEDDED=y
159CONFIG_KALLSYMS=y 175CONFIG_KALLSYMS=y
160# CONFIG_KALLSYMS_EXTRA_PASS is not set 176CONFIG_KALLSYMS_EXTRA_PASS=y
161CONFIG_HOTPLUG=y 177CONFIG_HOTPLUG=y
162CONFIG_PRINTK=y 178CONFIG_PRINTK=y
163CONFIG_BUG=y 179CONFIG_BUG=y
164CONFIG_ELF_CORE=y 180CONFIG_ELF_CORE=y
165CONFIG_BASE_FULL=y 181CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y 182CONFIG_FUTEX=y
167CONFIG_EPOLL=y 183# CONFIG_EPOLL is not set
168CONFIG_SHMEM=y 184CONFIG_SHMEM=y
185CONFIG_CC_ALIGN_FUNCTIONS=0
186CONFIG_CC_ALIGN_LABELS=0
187CONFIG_CC_ALIGN_LOOPS=0
188CONFIG_CC_ALIGN_JUMPS=0
169CONFIG_SLAB=y 189CONFIG_SLAB=y
170# CONFIG_TINY_SHMEM is not set 190# CONFIG_TINY_SHMEM is not set
171CONFIG_BASE_SMALL=0 191CONFIG_BASE_SMALL=0
@@ -174,14 +194,18 @@ CONFIG_BASE_SMALL=0
174# 194#
175# Loadable module support 195# Loadable module support
176# 196#
177# CONFIG_MODULES is not set 197CONFIG_MODULES=y
198CONFIG_MODULE_UNLOAD=y
199# CONFIG_MODULE_FORCE_UNLOAD is not set
200CONFIG_OBSOLETE_MODPARM=y
201CONFIG_MODVERSIONS=y
202CONFIG_MODULE_SRCVERSION_ALL=y
203# CONFIG_KMOD is not set
178 204
179# 205#
180# Block layer 206# Block layer
181# 207#
182# CONFIG_LBD is not set 208# CONFIG_LBD is not set
183# CONFIG_BLK_DEV_IO_TRACE is not set
184# CONFIG_LSF is not set
185 209
186# 210#
187# IO Schedulers 211# IO Schedulers
@@ -201,7 +225,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
201# 225#
202CONFIG_HW_HAS_PCI=y 226CONFIG_HW_HAS_PCI=y
203CONFIG_PCI=y 227CONFIG_PCI=y
204CONFIG_ISA=y 228CONFIG_PCI_LEGACY_PROC=y
205CONFIG_MMU=y 229CONFIG_MMU=y
206 230
207# 231#
@@ -212,13 +236,16 @@ CONFIG_MMU=y
212# 236#
213# PCI Hotplug Support 237# PCI Hotplug Support
214# 238#
215# CONFIG_HOTPLUG_PCI is not set 239CONFIG_HOTPLUG_PCI=y
240# CONFIG_HOTPLUG_PCI_FAKE is not set
241# CONFIG_HOTPLUG_PCI_CPCI is not set
242# CONFIG_HOTPLUG_PCI_SHPC is not set
216 243
217# 244#
218# Executable file formats 245# Executable file formats
219# 246#
220CONFIG_BINFMT_ELF=y 247CONFIG_BINFMT_ELF=y
221# CONFIG_BINFMT_MISC is not set 248CONFIG_BINFMT_MISC=y
222CONFIG_TRAD_SIGNALS=y 249CONFIG_TRAD_SIGNALS=y
223 250
224# 251#
@@ -231,35 +258,33 @@ CONFIG_NET=y
231# 258#
232# CONFIG_NETDEBUG is not set 259# CONFIG_NETDEBUG is not set
233CONFIG_PACKET=y 260CONFIG_PACKET=y
234# CONFIG_PACKET_MMAP is not set 261CONFIG_PACKET_MMAP=y
235CONFIG_UNIX=y 262CONFIG_UNIX=y
236CONFIG_XFRM=y 263# CONFIG_NET_KEY is not set
237CONFIG_XFRM_USER=y
238CONFIG_NET_KEY=y
239CONFIG_INET=y 264CONFIG_INET=y
240# CONFIG_IP_MULTICAST is not set 265CONFIG_IP_MULTICAST=y
241# CONFIG_IP_ADVANCED_ROUTER is not set 266# CONFIG_IP_ADVANCED_ROUTER is not set
242CONFIG_IP_FIB_HASH=y 267CONFIG_IP_FIB_HASH=y
243CONFIG_IP_PNP=y 268CONFIG_IP_PNP=y
244# CONFIG_IP_PNP_DHCP is not set 269CONFIG_IP_PNP_DHCP=y
245CONFIG_IP_PNP_BOOTP=y 270CONFIG_IP_PNP_BOOTP=y
246# CONFIG_IP_PNP_RARP is not set 271CONFIG_IP_PNP_RARP=y
247# CONFIG_NET_IPIP is not set 272# CONFIG_NET_IPIP is not set
248# CONFIG_NET_IPGRE is not set 273# CONFIG_NET_IPGRE is not set
249# CONFIG_ARPD is not set 274CONFIG_IP_MROUTE=y
275# CONFIG_IP_PIMSM_V1 is not set
276# CONFIG_IP_PIMSM_V2 is not set
277CONFIG_ARPD=y
250# CONFIG_SYN_COOKIES is not set 278# CONFIG_SYN_COOKIES is not set
251# CONFIG_INET_AH is not set 279# CONFIG_INET_AH is not set
252# CONFIG_INET_ESP is not set 280# CONFIG_INET_ESP is not set
253# CONFIG_INET_IPCOMP is not set 281# CONFIG_INET_IPCOMP is not set
254# CONFIG_INET_XFRM_TUNNEL is not set
255# CONFIG_INET_TUNNEL is not set 282# CONFIG_INET_TUNNEL is not set
256CONFIG_INET_DIAG=y 283CONFIG_INET_DIAG=y
257CONFIG_INET_TCP_DIAG=y 284CONFIG_INET_TCP_DIAG=y
258# CONFIG_TCP_CONG_ADVANCED is not set 285# CONFIG_TCP_CONG_ADVANCED is not set
259CONFIG_TCP_CONG_BIC=y 286CONFIG_TCP_CONG_BIC=y
260# CONFIG_IPV6 is not set 287# CONFIG_IPV6 is not set
261# CONFIG_INET6_XFRM_TUNNEL is not set
262# CONFIG_INET6_TUNNEL is not set
263# CONFIG_NETFILTER is not set 288# CONFIG_NETFILTER is not set
264 289
265# 290#
@@ -301,13 +326,7 @@ CONFIG_TCP_CONG_BIC=y
301# CONFIG_HAMRADIO is not set 326# CONFIG_HAMRADIO is not set
302# CONFIG_IRDA is not set 327# CONFIG_IRDA is not set
303# CONFIG_BT is not set 328# CONFIG_BT is not set
304CONFIG_IEEE80211=y 329# CONFIG_IEEE80211 is not set
305# CONFIG_IEEE80211_DEBUG is not set
306CONFIG_IEEE80211_CRYPT_WEP=y
307CONFIG_IEEE80211_CRYPT_CCMP=y
308CONFIG_IEEE80211_SOFTMAC=y
309# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
310CONFIG_WIRELESS_EXT=y
311 330
312# 331#
313# Device Drivers 332# Device Drivers
@@ -318,13 +337,12 @@ CONFIG_WIRELESS_EXT=y
318# 337#
319CONFIG_STANDALONE=y 338CONFIG_STANDALONE=y
320CONFIG_PREVENT_FIRMWARE_BUILD=y 339CONFIG_PREVENT_FIRMWARE_BUILD=y
321CONFIG_FW_LOADER=y 340# CONFIG_FW_LOADER is not set
322 341
323# 342#
324# Connector - unified userspace <-> kernelspace linker 343# Connector - unified userspace <-> kernelspace linker
325# 344#
326CONFIG_CONNECTOR=y 345# CONFIG_CONNECTOR is not set
327CONFIG_PROC_EVENTS=y
328 346
329# 347#
330# Memory Technology Devices (MTD) 348# Memory Technology Devices (MTD)
@@ -339,7 +357,6 @@ CONFIG_PROC_EVENTS=y
339# 357#
340# Plug and Play support 358# Plug and Play support
341# 359#
342# CONFIG_PNP is not set
343 360
344# 361#
345# Block devices 362# Block devices
@@ -352,53 +369,25 @@ CONFIG_PROC_EVENTS=y
352# CONFIG_BLK_DEV_LOOP is not set 369# CONFIG_BLK_DEV_LOOP is not set
353# CONFIG_BLK_DEV_NBD is not set 370# CONFIG_BLK_DEV_NBD is not set
354# CONFIG_BLK_DEV_SX8 is not set 371# CONFIG_BLK_DEV_SX8 is not set
355# CONFIG_BLK_DEV_RAM is not set 372CONFIG_BLK_DEV_RAM=y
356# CONFIG_BLK_DEV_INITRD is not set 373CONFIG_BLK_DEV_RAM_COUNT=16
357CONFIG_CDROM_PKTCDVD=y 374CONFIG_BLK_DEV_RAM_SIZE=4096
358CONFIG_CDROM_PKTCDVD_BUFFERS=8 375CONFIG_BLK_DEV_INITRD=y
359# CONFIG_CDROM_PKTCDVD_WCACHE is not set 376# CONFIG_CDROM_PKTCDVD is not set
360CONFIG_ATA_OVER_ETH=y 377# CONFIG_ATA_OVER_ETH is not set
361 378
362# 379#
363# ATA/ATAPI/MFM/RLL support 380# ATA/ATAPI/MFM/RLL support
364# 381#
365CONFIG_IDE=y 382# CONFIG_IDE is not set
366CONFIG_BLK_DEV_IDE=y
367
368#
369# Please see Documentation/ide.txt for help/info on IDE drives
370#
371# CONFIG_BLK_DEV_IDE_SATA is not set
372CONFIG_BLK_DEV_IDEDISK=y
373# CONFIG_IDEDISK_MULTI_MODE is not set
374# CONFIG_BLK_DEV_IDECD is not set
375# CONFIG_BLK_DEV_IDETAPE is not set
376# CONFIG_BLK_DEV_IDEFLOPPY is not set
377# CONFIG_IDE_TASK_IOCTL is not set
378
379#
380# IDE chipset support/bugfixes
381#
382CONFIG_IDE_GENERIC=y
383# CONFIG_BLK_DEV_IDEPCI is not set
384# CONFIG_IDE_ARM is not set
385# CONFIG_IDE_CHIPSETS is not set
386# CONFIG_BLK_DEV_IDEDMA is not set
387# CONFIG_IDEDMA_AUTO is not set
388# CONFIG_BLK_DEV_HD is not set
389 383
390# 384#
391# SCSI device support 385# SCSI device support
392# 386#
393CONFIG_RAID_ATTRS=y 387# CONFIG_RAID_ATTRS is not set
394# CONFIG_SCSI is not set 388# CONFIG_SCSI is not set
395 389
396# 390#
397# Old CD-ROM drivers (not SCSI, not IDE)
398#
399# CONFIG_CD_NO_IDESCSI is not set
400
401#
402# Multi-device support (RAID and LVM) 391# Multi-device support (RAID and LVM)
403# 392#
404# CONFIG_MD is not set 393# CONFIG_MD is not set
@@ -440,34 +429,48 @@ CONFIG_PHYLIB=y
440# 429#
441# MII PHY device drivers 430# MII PHY device drivers
442# 431#
443CONFIG_MARVELL_PHY=y 432# CONFIG_MARVELL_PHY is not set
444CONFIG_DAVICOM_PHY=y 433# CONFIG_DAVICOM_PHY is not set
445CONFIG_QSEMI_PHY=y 434# CONFIG_QSEMI_PHY is not set
446CONFIG_LXT_PHY=y 435# CONFIG_LXT_PHY is not set
447CONFIG_CICADA_PHY=y 436# CONFIG_CICADA_PHY is not set
448 437
449# 438#
450# Ethernet (10 or 100Mbit) 439# Ethernet (10 or 100Mbit)
451# 440#
452CONFIG_NET_ETHERNET=y 441CONFIG_NET_ETHERNET=y
453# CONFIG_MII is not set 442CONFIG_MII=y
454# CONFIG_HAPPYMEAL is not set 443# CONFIG_HAPPYMEAL is not set
455# CONFIG_SUNGEM is not set 444# CONFIG_SUNGEM is not set
456# CONFIG_CASSINI is not set 445# CONFIG_CASSINI is not set
457# CONFIG_NET_VENDOR_3COM is not set 446# CONFIG_NET_VENDOR_3COM is not set
458# CONFIG_NET_VENDOR_SMC is not set
459# CONFIG_DM9000 is not set 447# CONFIG_DM9000 is not set
460# CONFIG_NET_VENDOR_RACAL is not set
461 448
462# 449#
463# Tulip family network device support 450# Tulip family network device support
464# 451#
465# CONFIG_NET_TULIP is not set 452# CONFIG_NET_TULIP is not set
466# CONFIG_AT1700 is not set
467# CONFIG_DEPCA is not set
468# CONFIG_HP100 is not set 453# CONFIG_HP100 is not set
469# CONFIG_NET_ISA is not set 454CONFIG_NET_PCI=y
470# CONFIG_NET_PCI is not set 455# CONFIG_PCNET32 is not set
456# CONFIG_AMD8111_ETH is not set
457# CONFIG_ADAPTEC_STARFIRE is not set
458# CONFIG_B44 is not set
459# CONFIG_FORCEDETH is not set
460# CONFIG_DGRS is not set
461# CONFIG_EEPRO100 is not set
462CONFIG_E100=y
463# CONFIG_FEALNX is not set
464# CONFIG_NATSEMI is not set
465# CONFIG_NE2K_PCI is not set
466# CONFIG_8139CP is not set
467# CONFIG_8139TOO is not set
468# CONFIG_SIS900 is not set
469# CONFIG_EPIC100 is not set
470# CONFIG_SUNDANCE is not set
471# CONFIG_TLAN is not set
472# CONFIG_VIA_RHINE is not set
473# CONFIG_LAN_SAA9730 is not set
471 474
472# 475#
473# Ethernet (1000 Mbit) 476# Ethernet (1000 Mbit)
@@ -483,6 +486,7 @@ CONFIG_NET_ETHERNET=y
483# CONFIG_SKGE is not set 486# CONFIG_SKGE is not set
484# CONFIG_SKY2 is not set 487# CONFIG_SKY2 is not set
485# CONFIG_SK98LIN is not set 488# CONFIG_SK98LIN is not set
489# CONFIG_VIA_VELOCITY is not set
486# CONFIG_TIGON3 is not set 490# CONFIG_TIGON3 is not set
487# CONFIG_BNX2 is not set 491# CONFIG_BNX2 is not set
488 492
@@ -529,46 +533,18 @@ CONFIG_NET_ETHERNET=y
529# 533#
530# Input device support 534# Input device support
531# 535#
532CONFIG_INPUT=y 536# CONFIG_INPUT is not set
533
534#
535# Userland interfaces
536#
537CONFIG_INPUT_MOUSEDEV=y
538CONFIG_INPUT_MOUSEDEV_PSAUX=y
539CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
540CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
541# CONFIG_INPUT_JOYDEV is not set
542# CONFIG_INPUT_TSDEV is not set
543# CONFIG_INPUT_EVDEV is not set
544# CONFIG_INPUT_EVBUG is not set
545
546#
547# Input Device Drivers
548#
549# CONFIG_INPUT_KEYBOARD is not set
550# CONFIG_INPUT_MOUSE is not set
551# CONFIG_INPUT_JOYSTICK is not set
552# CONFIG_INPUT_TOUCHSCREEN is not set
553# CONFIG_INPUT_MISC is not set
554 537
555# 538#
556# Hardware I/O ports 539# Hardware I/O ports
557# 540#
558CONFIG_SERIO=y 541# CONFIG_SERIO is not set
559# CONFIG_SERIO_I8042 is not set
560CONFIG_SERIO_SERPORT=y
561# CONFIG_SERIO_PCIPS2 is not set
562# CONFIG_SERIO_LIBPS2 is not set
563CONFIG_SERIO_RAW=y
564# CONFIG_GAMEPORT is not set 542# CONFIG_GAMEPORT is not set
565 543
566# 544#
567# Character devices 545# Character devices
568# 546#
569CONFIG_VT=y 547# CONFIG_VT is not set
570CONFIG_VT_CONSOLE=y
571CONFIG_HW_CONSOLE=y
572# CONFIG_SERIAL_NONSTANDARD is not set 548# CONFIG_SERIAL_NONSTANDARD is not set
573 549
574# 550#
@@ -576,9 +552,8 @@ CONFIG_HW_CONSOLE=y
576# 552#
577CONFIG_SERIAL_8250=y 553CONFIG_SERIAL_8250=y
578CONFIG_SERIAL_8250_CONSOLE=y 554CONFIG_SERIAL_8250_CONSOLE=y
579CONFIG_SERIAL_8250_PCI=y 555CONFIG_SERIAL_8250_NR_UARTS=1
580CONFIG_SERIAL_8250_NR_UARTS=4 556CONFIG_SERIAL_8250_RUNTIME_UARTS=1
581CONFIG_SERIAL_8250_RUNTIME_UARTS=4
582# CONFIG_SERIAL_8250_EXTENDED is not set 557# CONFIG_SERIAL_8250_EXTENDED is not set
583 558
584# 559#
@@ -600,8 +575,7 @@ CONFIG_LEGACY_PTY_COUNT=256
600# Watchdog Cards 575# Watchdog Cards
601# 576#
602# CONFIG_WATCHDOG is not set 577# CONFIG_WATCHDOG is not set
603# CONFIG_RTC is not set 578CONFIG_RTC=y
604# CONFIG_GEN_RTC is not set
605# CONFIG_DTLK is not set 579# CONFIG_DTLK is not set
606# CONFIG_R3964 is not set 580# CONFIG_R3964 is not set
607# CONFIG_APPLICOM is not set 581# CONFIG_APPLICOM is not set
@@ -637,14 +611,20 @@ CONFIG_LEGACY_PTY_COUNT=256
637# 611#
638# Hardware Monitoring support 612# Hardware Monitoring support
639# 613#
640# CONFIG_HWMON is not set 614CONFIG_HWMON=y
641# CONFIG_HWMON_VID is not set 615# CONFIG_HWMON_VID is not set
616# CONFIG_SENSORS_F71805F is not set
617# CONFIG_HWMON_DEBUG_CHIP is not set
642 618
643# 619#
644# Misc devices 620# Misc devices
645# 621#
646 622
647# 623#
624# Multimedia Capabilities Port drivers
625#
626
627#
648# Multimedia devices 628# Multimedia devices
649# 629#
650# CONFIG_VIDEO_DEV is not set 630# CONFIG_VIDEO_DEV is not set
@@ -657,49 +637,7 @@ CONFIG_LEGACY_PTY_COUNT=256
657# 637#
658# Graphics support 638# Graphics support
659# 639#
660CONFIG_FB=y 640# CONFIG_FB is not set
661# CONFIG_FB_CFB_FILLRECT is not set
662# CONFIG_FB_CFB_COPYAREA is not set
663# CONFIG_FB_CFB_IMAGEBLIT is not set
664# CONFIG_FB_MACMODES is not set
665CONFIG_FB_FIRMWARE_EDID=y
666# CONFIG_FB_MODE_HELPERS is not set
667# CONFIG_FB_TILEBLITTING is not set
668# CONFIG_FB_CIRRUS is not set
669# CONFIG_FB_PM2 is not set
670# CONFIG_FB_CYBER2000 is not set
671# CONFIG_FB_ASILIANT is not set
672# CONFIG_FB_IMSTT is not set
673# CONFIG_FB_S1D13XXX is not set
674# CONFIG_FB_NVIDIA is not set
675# CONFIG_FB_RIVA is not set
676# CONFIG_FB_MATROX is not set
677# CONFIG_FB_RADEON is not set
678# CONFIG_FB_ATY128 is not set
679# CONFIG_FB_ATY is not set
680# CONFIG_FB_SAVAGE is not set
681# CONFIG_FB_SIS is not set
682# CONFIG_FB_NEOMAGIC is not set
683# CONFIG_FB_KYRO is not set
684# CONFIG_FB_3DFX is not set
685# CONFIG_FB_VOODOO1 is not set
686# CONFIG_FB_SMIVGX is not set
687# CONFIG_FB_TRIDENT is not set
688# CONFIG_FB_VIRTUAL is not set
689
690#
691# Console display driver support
692#
693# CONFIG_VGA_CONSOLE is not set
694# CONFIG_MDA_CONSOLE is not set
695CONFIG_DUMMY_CONSOLE=y
696# CONFIG_FRAMEBUFFER_CONSOLE is not set
697
698#
699# Logo configuration
700#
701# CONFIG_LOGO is not set
702# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
703 641
704# 642#
705# Sound 643# Sound
@@ -711,7 +649,6 @@ CONFIG_DUMMY_CONSOLE=y
711# 649#
712CONFIG_USB_ARCH_HAS_HCD=y 650CONFIG_USB_ARCH_HAS_HCD=y
713CONFIG_USB_ARCH_HAS_OHCI=y 651CONFIG_USB_ARCH_HAS_OHCI=y
714CONFIG_USB_ARCH_HAS_EHCI=y
715# CONFIG_USB is not set 652# CONFIG_USB is not set
716 653
717# 654#
@@ -729,19 +666,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
729# CONFIG_MMC is not set 666# CONFIG_MMC is not set
730 667
731# 668#
732# LED devices
733#
734# CONFIG_NEW_LEDS is not set
735
736#
737# LED drivers
738#
739
740#
741# LED Triggers
742#
743
744#
745# InfiniBand support 669# InfiniBand support
746# 670#
747# CONFIG_INFINIBAND is not set 671# CONFIG_INFINIBAND is not set
@@ -751,16 +675,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
751# 675#
752 676
753# 677#
754# Real Time Clock
755#
756# CONFIG_RTC_CLASS is not set
757
758#
759# File systems 678# File systems
760# 679#
761CONFIG_EXT2_FS=y 680# CONFIG_EXT2_FS is not set
762# CONFIG_EXT2_FS_XATTR is not set
763# CONFIG_EXT2_FS_XIP is not set
764# CONFIG_EXT3_FS is not set 681# CONFIG_EXT3_FS is not set
765# CONFIG_REISERFS_FS is not set 682# CONFIG_REISERFS_FS is not set
766# CONFIG_JFS_FS is not set 683# CONFIG_JFS_FS is not set
@@ -774,7 +691,7 @@ CONFIG_INOTIFY=y
774CONFIG_DNOTIFY=y 691CONFIG_DNOTIFY=y
775# CONFIG_AUTOFS_FS is not set 692# CONFIG_AUTOFS_FS is not set
776# CONFIG_AUTOFS4_FS is not set 693# CONFIG_AUTOFS4_FS is not set
777CONFIG_FUSE_FS=y 694# CONFIG_FUSE_FS is not set
778 695
779# 696#
780# CD-ROM/DVD Filesystems 697# CD-ROM/DVD Filesystems
@@ -795,9 +712,10 @@ CONFIG_FUSE_FS=y
795CONFIG_PROC_FS=y 712CONFIG_PROC_FS=y
796CONFIG_PROC_KCORE=y 713CONFIG_PROC_KCORE=y
797CONFIG_SYSFS=y 714CONFIG_SYSFS=y
798# CONFIG_TMPFS is not set 715CONFIG_TMPFS=y
799# CONFIG_HUGETLB_PAGE is not set 716# CONFIG_HUGETLB_PAGE is not set
800CONFIG_RAMFS=y 717CONFIG_RAMFS=y
718# CONFIG_RELAYFS_FS is not set
801# CONFIG_CONFIGFS_FS is not set 719# CONFIG_CONFIGFS_FS is not set
802 720
803# 721#
@@ -821,12 +739,14 @@ CONFIG_RAMFS=y
821# Network File Systems 739# Network File Systems
822# 740#
823CONFIG_NFS_FS=y 741CONFIG_NFS_FS=y
824# CONFIG_NFS_V3 is not set 742CONFIG_NFS_V3=y
743# CONFIG_NFS_V3_ACL is not set
825# CONFIG_NFS_V4 is not set 744# CONFIG_NFS_V4 is not set
826# CONFIG_NFS_DIRECTIO is not set 745# CONFIG_NFS_DIRECTIO is not set
827# CONFIG_NFSD is not set 746# CONFIG_NFSD is not set
828CONFIG_ROOT_NFS=y 747CONFIG_ROOT_NFS=y
829CONFIG_LOCKD=y 748CONFIG_LOCKD=y
749CONFIG_LOCKD_V4=y
830CONFIG_NFS_COMMON=y 750CONFIG_NFS_COMMON=y
831CONFIG_SUNRPC=y 751CONFIG_SUNRPC=y
832# CONFIG_RPCSEC_GSS_KRB5 is not set 752# CONFIG_RPCSEC_GSS_KRB5 is not set
@@ -861,46 +781,19 @@ CONFIG_MSDOS_PARTITION=y
861# CONFIG_MAGIC_SYSRQ is not set 781# CONFIG_MAGIC_SYSRQ is not set
862# CONFIG_DEBUG_KERNEL is not set 782# CONFIG_DEBUG_KERNEL is not set
863CONFIG_LOG_BUF_SHIFT=14 783CONFIG_LOG_BUF_SHIFT=14
864# CONFIG_DEBUG_FS is not set
865# CONFIG_UNWIND_INFO is not set
866CONFIG_CROSSCOMPILE=y 784CONFIG_CROSSCOMPILE=y
867CONFIG_CMDLINE="ip=any" 785CONFIG_CMDLINE="console=ttyS0,115200n8"
868 786
869# 787#
870# Security options 788# Security options
871# 789#
872CONFIG_KEYS=y 790# CONFIG_KEYS is not set
873CONFIG_KEYS_DEBUG_PROC_KEYS=y
874# CONFIG_SECURITY is not set 791# CONFIG_SECURITY is not set
875 792
876# 793#
877# Cryptographic options 794# Cryptographic options
878# 795#
879CONFIG_CRYPTO=y 796# CONFIG_CRYPTO is not set
880CONFIG_CRYPTO_HMAC=y
881CONFIG_CRYPTO_NULL=y
882CONFIG_CRYPTO_MD4=y
883CONFIG_CRYPTO_MD5=y
884CONFIG_CRYPTO_SHA1=y
885CONFIG_CRYPTO_SHA256=y
886CONFIG_CRYPTO_SHA512=y
887CONFIG_CRYPTO_WP512=y
888CONFIG_CRYPTO_TGR192=y
889CONFIG_CRYPTO_DES=y
890CONFIG_CRYPTO_BLOWFISH=y
891CONFIG_CRYPTO_TWOFISH=y
892CONFIG_CRYPTO_SERPENT=y
893CONFIG_CRYPTO_AES=y
894CONFIG_CRYPTO_CAST5=y
895CONFIG_CRYPTO_CAST6=y
896CONFIG_CRYPTO_TEA=y
897CONFIG_CRYPTO_ARC4=y
898CONFIG_CRYPTO_KHAZAD=y
899CONFIG_CRYPTO_ANUBIS=y
900CONFIG_CRYPTO_DEFLATE=y
901CONFIG_CRYPTO_MICHAEL_MIC=y
902CONFIG_CRYPTO_CRC32C=y
903# CONFIG_CRYPTO_TEST is not set
904 797
905# 798#
906# Hardware crypto devices 799# Hardware crypto devices
@@ -909,9 +802,7 @@ CONFIG_CRYPTO_CRC32C=y
909# 802#
910# Library routines 803# Library routines
911# 804#
912# CONFIG_CRC_CCITT is not set 805CONFIG_CRC_CCITT=y
913CONFIG_CRC16=y 806CONFIG_CRC16=y
914CONFIG_CRC32=y 807CONFIG_CRC32=y
915CONFIG_LIBCRC32C=y 808CONFIG_LIBCRC32C=y
916CONFIG_ZLIB_INFLATE=y
917CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index b52d709de962..7ece2c008e9b 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48CONFIG_PMC_YOSEMITE=y 46CONFIG_PMC_YOSEMITE=y
@@ -130,6 +128,15 @@ CONFIG_FLATMEM=y
130CONFIG_FLAT_NODE_MEM_MAP=y 128CONFIG_FLAT_NODE_MEM_MAP=y
131# CONFIG_SPARSEMEM_STATIC is not set 129# CONFIG_SPARSEMEM_STATIC is not set
132CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
131# CONFIG_HZ_48 is not set
132# CONFIG_HZ_100 is not set
133# CONFIG_HZ_128 is not set
134# CONFIG_HZ_250 is not set
135# CONFIG_HZ_256 is not set
136CONFIG_HZ_1000=y
137# CONFIG_HZ_1024 is not set
138CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
139CONFIG_HZ=1000
133CONFIG_SMP=y 140CONFIG_SMP=y
134CONFIG_NR_CPUS=2 141CONFIG_NR_CPUS=2
135CONFIG_PREEMPT_NONE=y 142CONFIG_PREEMPT_NONE=y
diff --git a/arch/mips/ddb5xxx/common/prom.c b/arch/mips/ddb5xxx/common/prom.c
index b8d1f7489f3b..00c62c1c28a3 100644
--- a/arch/mips/ddb5xxx/common/prom.c
+++ b/arch/mips/ddb5xxx/common/prom.c
@@ -56,13 +56,7 @@ void __init prom_init(void)
56 56
57 mips_machgroup = MACH_GROUP_NEC_DDB; 57 mips_machgroup = MACH_GROUP_NEC_DDB;
58 58
59#if defined(CONFIG_DDB5074) 59#if defined(CONFIG_DDB5477)
60 mips_machtype = MACH_NEC_DDB5074;
61 add_memory_region(0, DDB_SDRAM_SIZE, BOOT_MEM_RAM);
62#elif defined(CONFIG_DDB5476)
63 mips_machtype = MACH_NEC_DDB5476;
64 add_memory_region(0, DDB_SDRAM_SIZE, BOOT_MEM_RAM);
65#elif defined(CONFIG_DDB5477)
66 ddb5477_runtime_detection(); 60 ddb5477_runtime_detection();
67 add_memory_region(0, board_ram_size, BOOT_MEM_RAM); 61 add_memory_region(0, board_ram_size, BOOT_MEM_RAM);
68#endif 62#endif
diff --git a/arch/mips/ddb5xxx/ddb5074/Makefile b/arch/mips/ddb5xxx/ddb5074/Makefile
deleted file mode 100644
index 304c02107b46..000000000000
--- a/arch/mips/ddb5xxx/ddb5074/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
1#
2# Makefile for the NEC DDB Vrc-5074 specific kernel interface routines
3# under Linux.
4#
5
6obj-y += setup.o irq.o nile4_pic.o
7
8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ddb5xxx/ddb5074/irq.c b/arch/mips/ddb5xxx/ddb5074/irq.c
deleted file mode 100644
index 60c087b7738c..000000000000
--- a/arch/mips/ddb5xxx/ddb5074/irq.c
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 * arch/mips/ddb5074/irq.c -- NEC DDB Vrc-5074 interrupt routines
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7#include <linux/init.h>
8#include <linux/irq.h>
9#include <linux/signal.h>
10#include <linux/sched.h>
11#include <linux/types.h>
12#include <linux/interrupt.h>
13#include <linux/ioport.h>
14
15#include <asm/i8259.h>
16#include <asm/io.h>
17#include <asm/irq_cpu.h>
18#include <asm/ptrace.h>
19#include <asm/nile4.h>
20#include <asm/ddb5xxx/ddb5xxx.h>
21#include <asm/ddb5xxx/ddb5074.h>
22
23
24static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
25
26#define M1543_PNP_CONFIG 0x03f0 /* PnP Config Port */
27#define M1543_PNP_INDEX 0x03f0 /* PnP Index Port */
28#define M1543_PNP_DATA 0x03f1 /* PnP Data Port */
29
30#define M1543_PNP_ALT_CONFIG 0x0370 /* Alternative PnP Config Port */
31#define M1543_PNP_ALT_INDEX 0x0370 /* Alternative PnP Index Port */
32#define M1543_PNP_ALT_DATA 0x0371 /* Alternative PnP Data Port */
33
34#define M1543_INT1_MASTER_CTRL 0x0020 /* INT_1 (master) Control Register */
35#define M1543_INT1_MASTER_MASK 0x0021 /* INT_1 (master) Mask Register */
36
37#define M1543_INT1_SLAVE_CTRL 0x00a0 /* INT_1 (slave) Control Register */
38#define M1543_INT1_SLAVE_MASK 0x00a1 /* INT_1 (slave) Mask Register */
39
40#define M1543_INT1_MASTER_ELCR 0x04d0 /* INT_1 (master) Edge/Level Control */
41#define M1543_INT1_SLAVE_ELCR 0x04d1 /* INT_1 (slave) Edge/Level Control */
42
43
44static void m1543_irq_setup(void)
45{
46 /*
47 * The ALI M1543 has 13 interrupt inputs, IRQ1..IRQ13. Not all
48 * the possible IO sources in the M1543 are in use by us. We will
49 * use the following mapping:
50 *
51 * IRQ1 - keyboard (default set by M1543)
52 * IRQ3 - reserved for UART B (default set by M1543) (note that
53 * the schematics for the DDB Vrc-5074 board seem to
54 * indicate that IRQ3 is connected to the DS1386
55 * watchdog timer interrupt output so we might have
56 * a conflict)
57 * IRQ4 - reserved for UART A (default set by M1543)
58 * IRQ5 - parallel (default set by M1543)
59 * IRQ8 - DS1386 time of day (RTC) interrupt
60 * IRQ12 - mouse
61 */
62
63 /*
64 * Assing mouse interrupt to IRQ12
65 */
66
67 /* Enter configuration mode */
68 outb(0x51, M1543_PNP_CONFIG);
69 outb(0x23, M1543_PNP_CONFIG);
70
71 /* Select logical device 7 (Keyboard) */
72 outb(0x07, M1543_PNP_INDEX);
73 outb(0x07, M1543_PNP_DATA);
74
75 /* Select IRQ12 */
76 outb(0x72, M1543_PNP_INDEX);
77 outb(0x0c, M1543_PNP_DATA);
78
79 outb(0x30, M1543_PNP_INDEX);
80 printk("device 7, 0x30: %02x\n",inb(M1543_PNP_DATA));
81
82 outb(0x70, M1543_PNP_INDEX);
83 printk("device 7, 0x70: %02x\n",inb(M1543_PNP_DATA));
84
85 /* Leave configration mode */
86 outb(0xbb, M1543_PNP_CONFIG);
87
88
89}
90
91static void ddb_local0_irqdispatch(struct pt_regs *regs)
92{
93 u32 mask;
94 int nile4_irq;
95
96 mask = nile4_get_irq_stat(0);
97
98 /* Handle the timer interrupt first */
99#if 0
100 if (mask & (1 << NILE4_INT_GPT)) {
101 do_IRQ(nile4_to_irq(NILE4_INT_GPT), regs);
102 mask &= ~(1 << NILE4_INT_GPT);
103 }
104#endif
105 for (nile4_irq = 0; mask; nile4_irq++, mask >>= 1)
106 if (mask & 1) {
107 if (nile4_irq == NILE4_INT_INTE) {
108 int i8259_irq;
109
110 nile4_clear_irq(NILE4_INT_INTE);
111 i8259_irq = nile4_i8259_iack();
112 do_IRQ(i8259_irq, regs);
113 } else
114 do_IRQ(nile4_to_irq(nile4_irq), regs);
115
116 }
117}
118
119static void ddb_local1_irqdispatch(void)
120{
121 printk("ddb_local1_irqdispatch called\n");
122}
123
124static void ddb_buserror_irq(void)
125{
126 printk("ddb_buserror_irq called\n");
127}
128
129static void ddb_8254timer_irq(void)
130{
131 printk("ddb_8254timer_irq called\n");
132}
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
148void __init arch_init_irq(void)
149{
150 /* setup cascade interrupts */
151 setup_irq(NILE4_IRQ_BASE + NILE4_INT_INTE, &irq_cascade);
152 setup_irq(CPU_IRQ_BASE + CPU_NILE4_CASCADE, &irq_cascade);
153
154 nile4_irq_setup(NILE4_IRQ_BASE);
155 m1543_irq_setup();
156 init_i8259_irqs();
157
158
159 printk("CPU_IRQ_BASE: %d\n",CPU_IRQ_BASE);
160
161 mips_cpu_irq_init(CPU_IRQ_BASE);
162
163 printk("enabling 8259 cascade\n");
164
165 ddb5074_led_hex(0);
166
167 /* Enable the interrupt cascade */
168 nile4_enable_irq(NILE4_IRQ_BASE+IRQ_I8259_CASCADE);
169}
diff --git a/arch/mips/ddb5xxx/ddb5074/nile4_pic.c b/arch/mips/ddb5xxx/ddb5074/nile4_pic.c
deleted file mode 100644
index 8743ffce8653..000000000000
--- a/arch/mips/ddb5xxx/ddb5074/nile4_pic.c
+++ /dev/null
@@ -1,286 +0,0 @@
1/*
2 * arch/mips/ddb5476/nile4.c --
3 * low-level PIC code for NEC Vrc-5476 (Nile 4)
4 *
5 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
6 * Sony Software Development Center Europe (SDCE), Brussels
7 *
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 *
11 */
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/ioport.h>
17
18#include <asm/addrspace.h>
19
20#include <asm/ddb5xxx/ddb5xxx.h>
21
22static int irq_base;
23
24/*
25 * Interrupt Programming
26 */
27void nile4_map_irq(int nile4_irq, int cpu_irq)
28{
29 u32 offset, t;
30
31 offset = DDB_INTCTRL;
32 if (nile4_irq >= 8) {
33 offset += 4;
34 nile4_irq -= 8;
35 }
36 t = ddb_in32(offset);
37 t &= ~(7 << (nile4_irq * 4));
38 t |= cpu_irq << (nile4_irq * 4);
39 ddb_out32(offset, t);
40}
41
42void nile4_map_irq_all(int cpu_irq)
43{
44 u32 all, t;
45
46 all = cpu_irq;
47 all |= all << 4;
48 all |= all << 8;
49 all |= all << 16;
50 t = ddb_in32(DDB_INTCTRL);
51 t &= 0x88888888;
52 t |= all;
53 ddb_out32(DDB_INTCTRL, t);
54 t = ddb_in32(DDB_INTCTRL + 4);
55 t &= 0x88888888;
56 t |= all;
57 ddb_out32(DDB_INTCTRL + 4, t);
58}
59
60void nile4_enable_irq(unsigned int nile4_irq)
61{
62 u32 offset, t;
63
64 nile4_irq-=irq_base;
65
66 ddb5074_led_hex(8);
67
68 offset = DDB_INTCTRL;
69 if (nile4_irq >= 8) {
70 offset += 4;
71 nile4_irq -= 8;
72 }
73 ddb5074_led_hex(9);
74 t = ddb_in32(offset);
75 ddb5074_led_hex(0xa);
76 t |= 8 << (nile4_irq * 4);
77 ddb_out32(offset, t);
78 ddb5074_led_hex(0xb);
79}
80
81void nile4_disable_irq(unsigned int nile4_irq)
82{
83 u32 offset, t;
84
85 nile4_irq-=irq_base;
86
87 offset = DDB_INTCTRL;
88 if (nile4_irq >= 8) {
89 offset += 4;
90 nile4_irq -= 8;
91 }
92 t = ddb_in32(offset);
93 t &= ~(8 << (nile4_irq * 4));
94 ddb_out32(offset, t);
95}
96
97void nile4_disable_irq_all(void)
98{
99 ddb_out32(DDB_INTCTRL, 0);
100 ddb_out32(DDB_INTCTRL + 4, 0);
101}
102
103u16 nile4_get_irq_stat(int cpu_irq)
104{
105 return ddb_in16(DDB_INTSTAT0 + cpu_irq * 2);
106}
107
108void nile4_enable_irq_output(int cpu_irq)
109{
110 u32 t;
111
112 t = ddb_in32(DDB_INTSTAT1 + 4);
113 t |= 1 << (16 + cpu_irq);
114 ddb_out32(DDB_INTSTAT1, t);
115}
116
117void nile4_disable_irq_output(int cpu_irq)
118{
119 u32 t;
120
121 t = ddb_in32(DDB_INTSTAT1 + 4);
122 t &= ~(1 << (16 + cpu_irq));
123 ddb_out32(DDB_INTSTAT1, t);
124}
125
126void nile4_set_pci_irq_polarity(int pci_irq, int high)
127{
128 u32 t;
129
130 t = ddb_in32(DDB_INTPPES);
131 if (high)
132 t &= ~(1 << (pci_irq * 2));
133 else
134 t |= 1 << (pci_irq * 2);
135 ddb_out32(DDB_INTPPES, t);
136}
137
138void nile4_set_pci_irq_level_or_edge(int pci_irq, int level)
139{
140 u32 t;
141
142 t = ddb_in32(DDB_INTPPES);
143 if (level)
144 t |= 2 << (pci_irq * 2);
145 else
146 t &= ~(2 << (pci_irq * 2));
147 ddb_out32(DDB_INTPPES, t);
148}
149
150void nile4_clear_irq(int nile4_irq)
151{
152 nile4_irq-=irq_base;
153 ddb_out32(DDB_INTCLR, 1 << nile4_irq);
154}
155
156void nile4_clear_irq_mask(u32 mask)
157{
158 ddb_out32(DDB_INTCLR, mask);
159}
160
161u8 nile4_i8259_iack(void)
162{
163 u8 irq;
164 u32 reg;
165
166 /* Set window 0 for interrupt acknowledge */
167 reg = ddb_in32(DDB_PCIINIT0);
168
169 ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IACK, 0, DDB_PCI_ACCESS_32);
170 irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE);
171 /* restore window 0 for PCI I/O space */
172 // ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
173 ddb_out32(DDB_PCIINIT0, reg);
174
175 /* i8269.c set the base vector to be 0x0 */
176 return irq ;
177}
178
179static unsigned int nile4_irq_startup(unsigned int irq) {
180
181 nile4_enable_irq(irq);
182 return 0;
183
184}
185
186static void nile4_ack_irq(unsigned int irq) {
187
188 ddb5074_led_hex(4);
189
190 nile4_clear_irq(irq);
191 ddb5074_led_hex(2);
192 nile4_disable_irq(irq);
193
194 ddb5074_led_hex(0);
195}
196
197static void nile4_irq_end(unsigned int irq) {
198
199 ddb5074_led_hex(3);
200 if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
201 ddb5074_led_hex(5);
202 nile4_enable_irq(irq);
203 ddb5074_led_hex(7);
204 }
205
206 ddb5074_led_hex(1);
207}
208
209#define nile4_irq_shutdown nile4_disable_irq
210
211static hw_irq_controller nile4_irq_controller = {
212 .typename = "nile4",
213 .startup = nile4_irq_startup,
214 .shutdown = nile4_irq_shutdown,
215 .enable = nile4_enable_irq,
216 .disable = nile4_disable_irq,
217 .ack = nile4_ack_irq,
218 .end = nile4_irq_end,
219};
220
221void nile4_irq_setup(u32 base) {
222
223 int i;
224
225 irq_base=base;
226
227 /* Map all interrupts to CPU int #0 */
228 nile4_map_irq_all(0);
229
230 /* PCI INTA#-E# must be level triggered */
231 nile4_set_pci_irq_level_or_edge(0, 1);
232 nile4_set_pci_irq_level_or_edge(1, 1);
233 nile4_set_pci_irq_level_or_edge(2, 1);
234 nile4_set_pci_irq_level_or_edge(3, 1);
235 nile4_set_pci_irq_level_or_edge(4, 1);
236
237 /* PCI INTA#-D# must be active low, INTE# must be active high */
238 nile4_set_pci_irq_polarity(0, 0);
239 nile4_set_pci_irq_polarity(1, 0);
240 nile4_set_pci_irq_polarity(2, 0);
241 nile4_set_pci_irq_polarity(3, 0);
242 nile4_set_pci_irq_polarity(4, 1);
243
244
245 for (i = 0; i < 16; i++) {
246 nile4_clear_irq(i);
247 nile4_disable_irq(i);
248 }
249
250 /* Enable CPU int #0 */
251 nile4_enable_irq_output(0);
252
253 for (i= base; i< base + NUM_NILE4_INTERRUPTS; i++) {
254 irq_desc[i].status = IRQ_DISABLED;
255 irq_desc[i].action = NULL;
256 irq_desc[i].depth = 1;
257 irq_desc[i].handler = &nile4_irq_controller;
258 }
259}
260
261#if defined(CONFIG_RUNTIME_DEBUG)
262void nile4_dump_irq_status(void)
263{
264 printk(KERN_DEBUG "
265 CPUSTAT = %p:%p\n", (void *) ddb_in32(DDB_CPUSTAT + 4),
266 (void *) ddb_in32(DDB_CPUSTAT));
267 printk(KERN_DEBUG "
268 INTCTRL = %p:%p\n", (void *) ddb_in32(DDB_INTCTRL + 4),
269 (void *) ddb_in32(DDB_INTCTRL));
270 printk(KERN_DEBUG
271 "INTSTAT0 = %p:%p\n",
272 (void *) ddb_in32(DDB_INTSTAT0 + 4),
273 (void *) ddb_in32(DDB_INTSTAT0));
274 printk(KERN_DEBUG
275 "INTSTAT1 = %p:%p\n",
276 (void *) ddb_in32(DDB_INTSTAT1 + 4),
277 (void *) ddb_in32(DDB_INTSTAT1));
278 printk(KERN_DEBUG
279 "INTCLR = %p:%p\n", (void *) ddb_in32(DDB_INTCLR + 4),
280 (void *) ddb_in32(DDB_INTCLR));
281 printk(KERN_DEBUG
282 "INTPPES = %p:%p\n", (void *) ddb_in32(DDB_INTPPES + 4),
283 (void *) ddb_in32(DDB_INTPPES));
284}
285
286#endif
diff --git a/arch/mips/ddb5xxx/ddb5074/setup.c b/arch/mips/ddb5xxx/ddb5074/setup.c
deleted file mode 100644
index 91456b068c2e..000000000000
--- a/arch/mips/ddb5xxx/ddb5074/setup.c
+++ /dev/null
@@ -1,234 +0,0 @@
1/*
2 * arch/mips/ddb5074/setup.c -- NEC DDB Vrc-5074 setup routines
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7#include <linux/init.h>
8#include <linux/kbd_ll.h>
9#include <linux/kernel.h>
10#include <linux/kdev_t.h>
11#include <linux/types.h>
12#include <linux/sched.h>
13#include <linux/pci.h>
14#include <linux/ide.h>
15#include <linux/ioport.h>
16#include <linux/irq.h>
17#include <linux/pm.h>
18
19#include <asm/addrspace.h>
20#include <asm/bcache.h>
21#include <asm/irq.h>
22#include <asm/reboot.h>
23#include <asm/gdb-stub.h>
24#include <asm/time.h>
25#include <asm/nile4.h>
26#include <asm/ddb5xxx/ddb5074.h>
27#include <asm/ddb5xxx/ddb5xxx.h>
28
29static void (*back_to_prom) (void) = (void (*)(void)) 0xbfc00000;
30
31static void ddb_machine_restart(char *command)
32{
33 u32 t;
34
35 /* PCI cold reset */
36 t = nile4_in32(NILE4_PCICTRL + 4);
37 t |= 0x40000000;
38 nile4_out32(NILE4_PCICTRL + 4, t);
39 /* CPU cold reset */
40 t = nile4_in32(NILE4_CPUSTAT);
41 t |= 1;
42 nile4_out32(NILE4_CPUSTAT, t);
43 /* Call the PROM */
44 back_to_prom();
45}
46
47static void ddb_machine_halt(void)
48{
49 printk("DDB Vrc-5074 halted.\n");
50 do {
51 } while (1);
52}
53
54static void ddb_machine_power_off(void)
55{
56 printk("DDB Vrc-5074 halted. Please turn off the power.\n");
57 do {
58 } while (1);
59}
60
61extern void rtc_ds1386_init(unsigned long base);
62
63extern void (*board_timer_setup) (struct irqaction * irq);
64
65static void __init ddb_timer_init(struct irqaction *irq)
66{
67 /* set the clock to 1 Hz */
68 nile4_out32(NILE4_T2CTRL, 1000000);
69 /* enable the General-Purpose Timer */
70 nile4_out32(NILE4_T2CTRL + 4, 0x00000001);
71 /* reset timer */
72 nile4_out32(NILE4_T2CNTR, 0);
73 /* enable interrupt */
74 setup_irq(nile4_to_irq(NILE4_INT_GPT), irq);
75 nile4_enable_irq(nile4_to_irq(NILE4_INT_GPT));
76 change_c0_status(ST0_IM,
77 IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4);
78
79}
80
81static void __init ddb_time_init(void)
82{
83 /* we have ds1396 RTC chip */
84 rtc_ds1386_init(KSEG1ADDR(DDB_PCI_MEM_BASE));
85}
86
87
88
89void __init plat_setup(void)
90{
91 set_io_port_base(NILE4_PCI_IO_BASE);
92 isa_slot_offset = NILE4_PCI_MEM_BASE;
93 board_timer_setup = ddb_timer_init;
94 board_time_init = ddb_time_init;
95
96
97 _machine_restart = ddb_machine_restart;
98 _machine_halt = ddb_machine_halt;
99 pm_power_off = ddb_machine_power_off;
100
101 ddb_out32(DDB_BAR0, 0);
102
103 ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IO, 0, 0x10);
104 ddb_set_pmr(DDB_PCIINIT1, DDB_PCICMD_MEM, DDB_PCI_MEM_BASE , 0x10);
105
106 /* Reboot on panic */
107 panic_timeout = 180;
108}
109
110#define USE_NILE4_SERIAL 0
111
112#if USE_NILE4_SERIAL
113#define ns16550_in(reg) nile4_in8((reg)*8)
114#define ns16550_out(reg, val) nile4_out8((reg)*8, (val))
115#else
116#define NS16550_BASE (NILE4_PCI_IO_BASE+0x03f8)
117static inline u8 ns16550_in(u32 reg)
118{
119 return *(volatile u8 *) (NS16550_BASE + reg);
120}
121
122static inline void ns16550_out(u32 reg, u8 val)
123{
124 *(volatile u8 *) (NS16550_BASE + reg) = val;
125}
126#endif
127
128#define NS16550_RBR 0
129#define NS16550_THR 0
130#define NS16550_DLL 0
131#define NS16550_IER 1
132#define NS16550_DLM 1
133#define NS16550_FCR 2
134#define NS16550_IIR 2
135#define NS16550_LCR 3
136#define NS16550_MCR 4
137#define NS16550_LSR 5
138#define NS16550_MSR 6
139#define NS16550_SCR 7
140
141#define NS16550_LSR_DR 0x01 /* Data ready */
142#define NS16550_LSR_OE 0x02 /* Overrun */
143#define NS16550_LSR_PE 0x04 /* Parity error */
144#define NS16550_LSR_FE 0x08 /* Framing error */
145#define NS16550_LSR_BI 0x10 /* Break */
146#define NS16550_LSR_THRE 0x20 /* Xmit holding register empty */
147#define NS16550_LSR_TEMT 0x40 /* Xmitter empty */
148#define NS16550_LSR_ERR 0x80 /* Error */
149
150
151void _serinit(void)
152{
153#if USE_NILE4_SERIAL
154 ns16550_out(NS16550_LCR, 0x80);
155 ns16550_out(NS16550_DLM, 0x00);
156 ns16550_out(NS16550_DLL, 0x36); /* 9600 baud */
157 ns16550_out(NS16550_LCR, 0x00);
158 ns16550_out(NS16550_LCR, 0x03);
159 ns16550_out(NS16550_FCR, 0x47);
160#else
161 /* done by PMON */
162#endif
163}
164
165void _putc(char c)
166{
167 while (!(ns16550_in(NS16550_LSR) & NS16550_LSR_THRE));
168 ns16550_out(NS16550_THR, c);
169 if (c == '\n') {
170 while (!(ns16550_in(NS16550_LSR) & NS16550_LSR_THRE));
171 ns16550_out(NS16550_THR, '\r');
172 }
173}
174
175void _puts(const char *s)
176{
177 char c;
178 while ((c = *s++))
179 _putc(c);
180}
181
182char _getc(void)
183{
184 while (!(ns16550_in(NS16550_LSR) & NS16550_LSR_DR));
185 return ns16550_in(NS16550_RBR);
186}
187
188int _testc(void)
189{
190 return (ns16550_in(NS16550_LSR) & NS16550_LSR_DR) != 0;
191}
192
193
194/*
195 * Hexadecimal 7-segment LED
196 */
197void ddb5074_led_hex(int hex)
198{
199 outb(hex, 0x80);
200}
201
202
203/*
204 * LEDs D2 and D3, connected to the GPIO pins of the PMU in the ALi M1543
205 */
206struct pci_dev *pci_pmu = NULL;
207
208void ddb5074_led_d2(int on)
209{
210 u8 t;
211
212 if (pci_pmu) {
213 pci_read_config_byte(pci_pmu, 0x7e, &t);
214 if (on)
215 t &= 0x7f;
216 else
217 t |= 0x80;
218 pci_write_config_byte(pci_pmu, 0x7e, t);
219 }
220}
221
222void ddb5074_led_d3(int on)
223{
224 u8 t;
225
226 if (pci_pmu) {
227 pci_read_config_byte(pci_pmu, 0x7e, &t);
228 if (on)
229 t &= 0xbf;
230 else
231 t |= 0x40;
232 pci_write_config_byte(pci_pmu, 0x7e, t);
233 }
234}
diff --git a/arch/mips/ddb5xxx/ddb5476/Makefile b/arch/mips/ddb5xxx/ddb5476/Makefile
deleted file mode 100644
index ab0312cb47b4..000000000000
--- a/arch/mips/ddb5xxx/ddb5476/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1#
2# Makefile for the NEC DDB Vrc-5476 specific kernel interface routines
3# under Linux.
4#
5
6obj-y += setup.o irq.o nile4_pic.o vrc5476_irq.o
7obj-$(CONFIG_KGDB) += dbg_io.o
8
9EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ddb5xxx/ddb5476/dbg_io.c b/arch/mips/ddb5xxx/ddb5476/dbg_io.c
deleted file mode 100644
index f2296a999953..000000000000
--- a/arch/mips/ddb5xxx/ddb5476/dbg_io.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * kgdb io functions for DDB5476. We use the second serial port.
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14/* ======================= CONFIG ======================== */
15
16/* [jsun] we use the second serial port for kdb */
17#define BASE 0xa60002f8
18#define MAX_BAUD 115200
19
20/* distance in bytes between two serial registers */
21#define REG_OFFSET 1
22
23/*
24 * 0 - kgdb does serial init
25 * 1 - kgdb skip serial init
26 */
27static int remoteDebugInitialized = 0;
28
29/*
30 * the default baud rate *if* kgdb does serial init
31 */
32#define BAUD_DEFAULT UART16550_BAUD_38400
33
34/* ======================= END OF CONFIG ======================== */
35
36typedef unsigned char uint8;
37typedef unsigned int uint32;
38
39#define UART16550_BAUD_2400 2400
40#define UART16550_BAUD_4800 4800
41#define UART16550_BAUD_9600 9600
42#define UART16550_BAUD_19200 19200
43#define UART16550_BAUD_38400 38400
44#define UART16550_BAUD_57600 57600
45#define UART16550_BAUD_115200 115200
46
47#define UART16550_PARITY_NONE 0
48#define UART16550_PARITY_ODD 0x08
49#define UART16550_PARITY_EVEN 0x18
50#define UART16550_PARITY_MARK 0x28
51#define UART16550_PARITY_SPACE 0x38
52
53#define UART16550_DATA_5BIT 0x0
54#define UART16550_DATA_6BIT 0x1
55#define UART16550_DATA_7BIT 0x2
56#define UART16550_DATA_8BIT 0x3
57
58#define UART16550_STOP_1BIT 0x0
59#define UART16550_STOP_2BIT 0x4
60
61/* register offset */
62#define OFS_RCV_BUFFER 0
63#define OFS_TRANS_HOLD 0
64#define OFS_SEND_BUFFER 0
65#define OFS_INTR_ENABLE (1*REG_OFFSET)
66#define OFS_INTR_ID (2*REG_OFFSET)
67#define OFS_DATA_FORMAT (3*REG_OFFSET)
68#define OFS_LINE_CONTROL (3*REG_OFFSET)
69#define OFS_MODEM_CONTROL (4*REG_OFFSET)
70#define OFS_RS232_OUTPUT (4*REG_OFFSET)
71#define OFS_LINE_STATUS (5*REG_OFFSET)
72#define OFS_MODEM_STATUS (6*REG_OFFSET)
73#define OFS_RS232_INPUT (6*REG_OFFSET)
74#define OFS_SCRATCH_PAD (7*REG_OFFSET)
75
76#define OFS_DIVISOR_LSB (0*REG_OFFSET)
77#define OFS_DIVISOR_MSB (1*REG_OFFSET)
78
79
80/* memory-mapped read/write of the port */
81#define UART16550_READ(y) (*((volatile uint8*)(BASE + y)))
82#define UART16550_WRITE(y, z) ((*((volatile uint8*)(BASE + y))) = z)
83
84void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
85{
86 /* disable interrupts */
87 UART16550_WRITE(OFS_INTR_ENABLE, 0);
88
89 /* set up baud rate */
90 {
91 uint32 divisor;
92
93 /* set DIAB bit */
94 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
95
96 /* set divisor */
97 divisor = MAX_BAUD / baud;
98 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
99 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
100
101 /* clear DIAB bit */
102 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
103 }
104
105 /* set data format */
106 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
107}
108
109
110uint8 getDebugChar(void)
111{
112 if (!remoteDebugInitialized) {
113 remoteDebugInitialized = 1;
114 debugInit(BAUD_DEFAULT,
115 UART16550_DATA_8BIT,
116 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
117 }
118
119 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
120 return UART16550_READ(OFS_RCV_BUFFER);
121}
122
123
124int putDebugChar(uint8 byte)
125{
126 if (!remoteDebugInitialized) {
127 remoteDebugInitialized = 1;
128 debugInit(BAUD_DEFAULT,
129 UART16550_DATA_8BIT,
130 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
131 }
132
133 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
134 UART16550_WRITE(OFS_SEND_BUFFER, byte);
135 return 1;
136}
diff --git a/arch/mips/ddb5xxx/ddb5476/irq.c b/arch/mips/ddb5xxx/ddb5476/irq.c
deleted file mode 100644
index 7583a1f30711..000000000000
--- a/arch/mips/ddb5xxx/ddb5476/irq.c
+++ /dev/null
@@ -1,165 +0,0 @@
1/*
2 * arch/mips/ddb5476/irq.c -- NEC DDB Vrc-5476 interrupt routines
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 *
7 * Re-write the whole thing to use new irq.c file.
8 * Copyright (C) 2001 MontaVista Software Inc.
9 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
10 *
11 */
12#include <linux/init.h>
13#include <linux/sched.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16
17#include <asm/i8259.h>
18#include <asm/io.h>
19#include <asm/ptrace.h>
20
21#include <asm/ddb5xxx/ddb5xxx.h>
22
23#define M1543_PNP_CONFIG 0x03f0 /* PnP Config Port */
24#define M1543_PNP_INDEX 0x03f0 /* PnP Index Port */
25#define M1543_PNP_DATA 0x03f1 /* PnP Data Port */
26
27#define M1543_PNP_ALT_CONFIG 0x0370 /* Alternative PnP Config Port */
28#define M1543_PNP_ALT_INDEX 0x0370 /* Alternative PnP Index Port */
29#define M1543_PNP_ALT_DATA 0x0371 /* Alternative PnP Data Port */
30
31#define M1543_INT1_MASTER_CTRL 0x0020 /* INT_1 (master) Control Register */
32#define M1543_INT1_MASTER_MASK 0x0021 /* INT_1 (master) Mask Register */
33
34#define M1543_INT1_SLAVE_CTRL 0x00a0 /* INT_1 (slave) Control Register */
35#define M1543_INT1_SLAVE_MASK 0x00a1 /* INT_1 (slave) Mask Register */
36
37#define M1543_INT1_MASTER_ELCR 0x04d0 /* INT_1 (master) Edge/Level Control */
38#define M1543_INT1_SLAVE_ELCR 0x04d1 /* INT_1 (slave) Edge/Level Control */
39
40static void m1543_irq_setup(void)
41{
42 /*
43 * The ALI M1543 has 13 interrupt inputs, IRQ1..IRQ13. Not all
44 * the possible IO sources in the M1543 are in use by us. We will
45 * use the following mapping:
46 *
47 * IRQ1 - keyboard (default set by M1543)
48 * IRQ3 - reserved for UART B (default set by M1543) (note that
49 * the schematics for the DDB Vrc-5476 board seem to
50 * indicate that IRQ3 is connected to the DS1386
51 * watchdog timer interrupt output so we might have
52 * a conflict)
53 * IRQ4 - reserved for UART A (default set by M1543)
54 * IRQ5 - parallel (default set by M1543)
55 * IRQ8 - DS1386 time of day (RTC) interrupt
56 * IRQ9 - USB (hardwired in ddb_setup)
57 * IRQ10 - PMU (hardwired in ddb_setup)
58 * IRQ12 - mouse
59 * IRQ14,15 - IDE controller (need to be confirmed, jsun)
60 */
61
62 /*
63 * Assing mouse interrupt to IRQ12
64 */
65
66 /* Enter configuration mode */
67 outb(0x51, M1543_PNP_CONFIG);
68 outb(0x23, M1543_PNP_CONFIG);
69
70 /* Select logical device 7 (Keyboard) */
71 outb(0x07, M1543_PNP_INDEX);
72 outb(0x07, M1543_PNP_DATA);
73
74 /* Select IRQ12 */
75 outb(0x72, M1543_PNP_INDEX);
76 outb(0x0c, M1543_PNP_DATA);
77
78 /* Leave configration mode */
79 outb(0xbb, M1543_PNP_CONFIG);
80}
81
82static void nile4_irq_setup(void)
83{
84 int i;
85
86 /* Map all interrupts to CPU int #0 (IP2) */
87 nile4_map_irq_all(0);
88
89 /* PCI INTA#-E# must be level triggered */
90 nile4_set_pci_irq_level_or_edge(0, 1);
91 nile4_set_pci_irq_level_or_edge(1, 1);
92 nile4_set_pci_irq_level_or_edge(2, 1);
93 nile4_set_pci_irq_level_or_edge(3, 1);
94
95 /* PCI INTA#, B#, D# must be active low, INTC# must be active high */
96 nile4_set_pci_irq_polarity(0, 0);
97 nile4_set_pci_irq_polarity(1, 0);
98 nile4_set_pci_irq_polarity(2, 1);
99 nile4_set_pci_irq_polarity(3, 0);
100
101 for (i = 0; i < 16; i++)
102 nile4_clear_irq(i);
103
104 /* Enable CPU int #0 */
105 nile4_enable_irq_output(0);
106
107 /* memory resource acquire in ddb_setup */
108}
109
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 };
112
113extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
114extern void mips_cpu_irq_init(u32 irq_base);
115extern void vrc5476_irq_init(u32 irq_base);
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
143void __init arch_init_irq(void)
144{
145 /* hardware initialization */
146 nile4_irq_setup();
147 m1543_irq_setup();
148
149 /* controller setup */
150 init_i8259_irqs();
151 vrc5476_irq_init(VRC5476_IRQ_BASE);
152 mips_cpu_irq_init(CPU_IRQ_BASE);
153
154 /* setup cascade interrupts */
155 setup_irq(VRC5476_IRQ_BASE + VRC5476_I8259_CASCADE, &irq_cascade);
156 setup_irq(CPU_IRQ_BASE + CPU_VRC5476_CASCADE, &irq_cascade);
157
158 /* setup error interrupts for debugging */
159 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_CPCE, &irq_error);
160 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_CNTD, &irq_error);
161 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_MCE, &irq_error);
162 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_LBRT, &irq_error);
163 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_PCIS, &irq_error);
164 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_PCI, &irq_error);
165}
diff --git a/arch/mips/ddb5xxx/ddb5476/nile4_pic.c b/arch/mips/ddb5xxx/ddb5476/nile4_pic.c
deleted file mode 100644
index e930cee7944f..000000000000
--- a/arch/mips/ddb5xxx/ddb5476/nile4_pic.c
+++ /dev/null
@@ -1,190 +0,0 @@
1/*
2 * arch/mips/ddb5476/nile4.c --
3 * low-level PIC code for NEC Vrc-5476 (Nile 4)
4 *
5 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
6 * Sony Software Development Center Europe (SDCE), Brussels
7 *
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 *
11 */
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/types.h>
15
16#include <asm/addrspace.h>
17
18#include <asm/ddb5xxx/ddb5xxx.h>
19
20
21/*
22 * Interrupt Programming
23 */
24void nile4_map_irq(int nile4_irq, int cpu_irq)
25{
26 u32 offset, t;
27
28 offset = DDB_INTCTRL;
29 if (nile4_irq >= 8) {
30 offset += 4;
31 nile4_irq -= 8;
32 }
33 t = ddb_in32(offset);
34 t &= ~(7 << (nile4_irq * 4));
35 t |= cpu_irq << (nile4_irq * 4);
36 ddb_out32(offset, t);
37}
38
39void nile4_map_irq_all(int cpu_irq)
40{
41 u32 all, t;
42
43 all = cpu_irq;
44 all |= all << 4;
45 all |= all << 8;
46 all |= all << 16;
47 t = ddb_in32(DDB_INTCTRL);
48 t &= 0x88888888;
49 t |= all;
50 ddb_out32(DDB_INTCTRL, t);
51 t = ddb_in32(DDB_INTCTRL + 4);
52 t &= 0x88888888;
53 t |= all;
54 ddb_out32(DDB_INTCTRL + 4, t);
55}
56
57void nile4_enable_irq(int nile4_irq)
58{
59 u32 offset, t;
60
61 offset = DDB_INTCTRL;
62 if (nile4_irq >= 8) {
63 offset += 4;
64 nile4_irq -= 8;
65 }
66 t = ddb_in32(offset);
67 t |= 8 << (nile4_irq * 4);
68 ddb_out32(offset, t);
69}
70
71void nile4_disable_irq(int nile4_irq)
72{
73 u32 offset, t;
74
75 offset = DDB_INTCTRL;
76 if (nile4_irq >= 8) {
77 offset += 4;
78 nile4_irq -= 8;
79 }
80 t = ddb_in32(offset);
81 t &= ~(8 << (nile4_irq * 4));
82 ddb_out32(offset, t);
83}
84
85void nile4_disable_irq_all(void)
86{
87 ddb_out32(DDB_INTCTRL, 0);
88 ddb_out32(DDB_INTCTRL + 4, 0);
89}
90
91u16 nile4_get_irq_stat(int cpu_irq)
92{
93 return ddb_in16(DDB_INTSTAT0 + cpu_irq * 2);
94}
95
96void nile4_enable_irq_output(int cpu_irq)
97{
98 u32 t;
99
100 t = ddb_in32(DDB_INTSTAT1 + 4);
101 t |= 1 << (16 + cpu_irq);
102 ddb_out32(DDB_INTSTAT1, t);
103}
104
105void nile4_disable_irq_output(int cpu_irq)
106{
107 u32 t;
108
109 t = ddb_in32(DDB_INTSTAT1 + 4);
110 t &= ~(1 << (16 + cpu_irq));
111 ddb_out32(DDB_INTSTAT1, t);
112}
113
114void nile4_set_pci_irq_polarity(int pci_irq, int high)
115{
116 u32 t;
117
118 t = ddb_in32(DDB_INTPPES);
119 if (high)
120 t &= ~(1 << (pci_irq * 2));
121 else
122 t |= 1 << (pci_irq * 2);
123 ddb_out32(DDB_INTPPES, t);
124}
125
126void nile4_set_pci_irq_level_or_edge(int pci_irq, int level)
127{
128 u32 t;
129
130 t = ddb_in32(DDB_INTPPES);
131 if (level)
132 t |= 2 << (pci_irq * 2);
133 else
134 t &= ~(2 << (pci_irq * 2));
135 ddb_out32(DDB_INTPPES, t);
136}
137
138void nile4_clear_irq(int nile4_irq)
139{
140 ddb_out32(DDB_INTCLR, 1 << nile4_irq);
141}
142
143void nile4_clear_irq_mask(u32 mask)
144{
145 ddb_out32(DDB_INTCLR, mask);
146}
147
148u8 nile4_i8259_iack(void)
149{
150 u8 irq;
151 u32 reg;
152
153 /* Set window 0 for interrupt acknowledge */
154 reg = ddb_in32(DDB_PCIINIT0);
155
156 ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IACK, 0, DDB_PCI_ACCESS_32);
157 irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE);
158 /* restore window 0 for PCI I/O space */
159 // ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
160 ddb_out32(DDB_PCIINIT0, reg);
161
162 /* i8269.c set the base vector to be 0x0 */
163 return irq + I8259_IRQ_BASE;
164}
165
166#if defined(CONFIG_RUNTIME_DEBUG)
167void nile4_dump_irq_status(void)
168{
169 printk(KERN_DEBUG "
170 CPUSTAT = %p:%p\n", (void *) ddb_in32(DDB_CPUSTAT + 4),
171 (void *) ddb_in32(DDB_CPUSTAT));
172 printk(KERN_DEBUG "
173 INTCTRL = %p:%p\n", (void *) ddb_in32(DDB_INTCTRL + 4),
174 (void *) ddb_in32(DDB_INTCTRL));
175 printk(KERN_DEBUG
176 "INTSTAT0 = %p:%p\n",
177 (void *) ddb_in32(DDB_INTSTAT0 + 4),
178 (void *) ddb_in32(DDB_INTSTAT0));
179 printk(KERN_DEBUG
180 "INTSTAT1 = %p:%p\n",
181 (void *) ddb_in32(DDB_INTSTAT1 + 4),
182 (void *) ddb_in32(DDB_INTSTAT1));
183 printk(KERN_DEBUG
184 "INTCLR = %p:%p\n", (void *) ddb_in32(DDB_INTCLR + 4),
185 (void *) ddb_in32(DDB_INTCLR));
186 printk(KERN_DEBUG
187 "INTPPES = %p:%p\n", (void *) ddb_in32(DDB_INTPPES + 4),
188 (void *) ddb_in32(DDB_INTPPES));
189}
190#endif
diff --git a/arch/mips/ddb5xxx/ddb5476/setup.c b/arch/mips/ddb5xxx/ddb5476/setup.c
deleted file mode 100644
index c902adef5942..000000000000
--- a/arch/mips/ddb5xxx/ddb5476/setup.c
+++ /dev/null
@@ -1,296 +0,0 @@
1/*
2 * arch/mips/ddb5476/setup.c -- NEC DDB Vrc-5476 setup routines
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7#include <linux/init.h>
8#include <linux/kbd_ll.h>
9#include <linux/kernel.h>
10#include <linux/kdev_t.h>
11#include <linux/types.h>
12#include <linux/sched.h>
13#include <linux/pci.h>
14#include <linux/pm.h>
15
16#include <asm/addrspace.h>
17#include <asm/bcache.h>
18#include <asm/irq.h>
19#include <asm/reboot.h>
20#include <asm/gdb-stub.h>
21#include <asm/time.h>
22#include <asm/debug.h>
23#include <asm/traps.h>
24
25#include <asm/ddb5xxx/ddb5xxx.h>
26
27// #define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */
28
29#ifdef USE_CPU_COUNTER_TIMER
30
31#define CPU_COUNTER_FREQUENCY 83000000
32#else
33/* otherwise we use general purpose timer */
34#define TIMER_FREQUENCY 83000000
35#define TIMER_BASE DDB_T2CTRL
36#define TIMER_IRQ (VRC5476_IRQ_BASE + VRC5476_IRQ_GPT)
37#endif
38
39static void (*back_to_prom) (void) = (void (*)(void)) 0xbfc00000;
40
41static void ddb_machine_restart(char *command)
42{
43 u32 t;
44
45 /* PCI cold reset */
46 t = ddb_in32(DDB_PCICTRL + 4);
47 t |= 0x40000000;
48 ddb_out32(DDB_PCICTRL + 4, t);
49 /* CPU cold reset */
50 t = ddb_in32(DDB_CPUSTAT);
51 t |= 1;
52 ddb_out32(DDB_CPUSTAT, t);
53 /* Call the PROM */
54 back_to_prom();
55}
56
57static void ddb_machine_halt(void)
58{
59 printk(KERN_NOTICE "DDB Vrc-5476 halted.\n");
60 while (1);
61}
62
63static void ddb_machine_power_off(void)
64{
65 printk(KERN_NOTICE "DDB Vrc-5476 halted. Please turn off the power.\n");
66 while (1);
67}
68
69extern void rtc_ds1386_init(unsigned long base);
70
71static void __init ddb_time_init(void)
72{
73#if defined(USE_CPU_COUNTER_TIMER)
74 mips_hpt_frequency = CPU_COUNTER_FREQUENCY;
75#endif
76
77 /* we have ds1396 RTC chip */
78 rtc_ds1386_init(KSEG1ADDR(DDB_PCI_MEM_BASE));
79}
80
81
82extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
83static void __init ddb_timer_setup(struct irqaction *irq)
84{
85#if defined(USE_CPU_COUNTER_TIMER)
86
87 unsigned int count;
88
89 /* we are using the cpu counter for timer interrupts */
90 setup_irq(CPU_IRQ_BASE + 7, irq);
91
92 /* to generate the first timer interrupt */
93 count = read_c0_count();
94 write_c0_compare(count + 1000);
95
96#else
97
98 ddb_out32(TIMER_BASE, TIMER_FREQUENCY/HZ);
99 ddb_out32(TIMER_BASE+4, 0x1); /* enable timer */
100 setup_irq(TIMER_IRQ, irq);
101#endif
102}
103
104static struct {
105 struct resource dma1;
106 struct resource timer;
107 struct resource rtc;
108 struct resource dma_page_reg;
109 struct resource dma2;
110} ddb5476_ioport = {
111 {
112 "dma1", 0x00, 0x1f, IORESOURCE_BUSY}, {
113 "timer", 0x40, 0x5f, IORESOURCE_BUSY}, {
114 "rtc", 0x70, 0x7f, IORESOURCE_BUSY}, {
115 "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY}, {
116 "dma2", 0xc0, 0xdf, IORESOURCE_BUSY}
117};
118
119static struct {
120 struct resource nile4;
121} ddb5476_iomem = {
122 { "Nile 4", DDB_BASE, DDB_BASE + DDB_SIZE - 1, IORESOURCE_BUSY}
123};
124
125
126static void ddb5476_board_init(void);
127
128void __init plat_setup(void)
129{
130 set_io_port_base(KSEG1ADDR(DDB_PCI_IO_BASE));
131
132 board_time_init = ddb_time_init;
133 board_timer_setup = ddb_timer_setup;
134
135 _machine_restart = ddb_machine_restart;
136 _machine_halt = ddb_machine_halt;
137 pm_power_off = ddb_machine_power_off;
138
139 /* request io port/mem resources */
140 if (request_resource(&ioport_resource, &ddb5476_ioport.dma1) ||
141 request_resource(&ioport_resource, &ddb5476_ioport.timer) ||
142 request_resource(&ioport_resource, &ddb5476_ioport.rtc) ||
143 request_resource(&ioport_resource,
144 &ddb5476_ioport.dma_page_reg)
145 || request_resource(&ioport_resource, &ddb5476_ioport.dma2)
146 || request_resource(&iomem_resource, &ddb5476_iomem.nile4)) {
147 printk
148 ("ddb_setup - requesting oo port resources failed.\n");
149 for (;;);
150 }
151
152 /* Reboot on panic */
153 panic_timeout = 180;
154
155 /* [jsun] we need to set BAR0 so that SDRAM 0 appears at 0x0 in PCI */
156 /* *(long*)0xbfa00218 = 0x8; */
157
158 /* board initialization stuff */
159 ddb5476_board_init();
160}
161
162/*
163 * We don't trust bios. We essentially does hardware re-initialization
164 * as complete as possible, as far as we know we can safely do.
165 */
166static void ddb5476_board_init(void)
167{
168 /* ----------- setup PDARs ------------ */
169 /* check SDRAM0, whether we are on MEM bus does not matter */
170 db_assert((ddb_in32(DDB_SDRAM0) & 0xffffffef) ==
171 ddb_calc_pdar(DDB_SDRAM_BASE, DDB_SDRAM_SIZE, 32, 0, 1));
172
173 /* SDRAM1 should be turned off. What is this for anyway ? */
174 db_assert( (ddb_in32(DDB_SDRAM1) & 0xf) == 0);
175
176 /* flash 1&2, DDB status, DDB control */
177 ddb_set_pdar(DDB_DCS2, DDB_DCS2_BASE, DDB_DCS2_SIZE, 16, 0, 0);
178 ddb_set_pdar(DDB_DCS3, DDB_DCS3_BASE, DDB_DCS3_SIZE, 16, 0, 0);
179 ddb_set_pdar(DDB_DCS4, DDB_DCS4_BASE, DDB_DCS4_SIZE, 8, 0, 0);
180 ddb_set_pdar(DDB_DCS5, DDB_DCS5_BASE, DDB_DCS5_SIZE, 8, 0, 0);
181
182 /* shut off other pdar so they don't accidentally get into the way */
183 ddb_set_pdar(DDB_DCS6, 0xffffffff, 0, 32, 0, 0);
184 ddb_set_pdar(DDB_DCS7, 0xffffffff, 0, 32, 0, 0);
185 ddb_set_pdar(DDB_DCS8, 0xffffffff, 0, 32, 0, 0);
186
187 /* verify VRC5477 base addr */
188 /* don't care about some details */
189 db_assert((ddb_in32(DDB_INTCS) & 0xffffff0f) ==
190 ddb_calc_pdar(DDB_INTCS_BASE, DDB_INTCS_SIZE, 8, 0, 0));
191
192 /* verify BOOT ROM addr */
193 /* don't care about some details */
194 db_assert((ddb_in32(DDB_BOOTCS) & 0xffffff0f) ==
195 ddb_calc_pdar(DDB_BOOTCS_BASE, DDB_BOOTCS_SIZE, 8, 0, 0));
196
197 /* setup PCI windows - window1 for MEM/config, window0 for IO */
198 ddb_set_pdar(DDB_PCIW0, DDB_PCI_IO_BASE, DDB_PCI_IO_SIZE, 32, 0, 1);
199 ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
200
201 ddb_set_pdar(DDB_PCIW1, DDB_PCI_MEM_BASE, DDB_PCI_MEM_SIZE, 32, 0, 1);
202 ddb_set_pmr(DDB_PCIINIT1, DDB_PCICMD_MEM, DDB_PCI_MEM_BASE, DDB_PCI_ACCESS_32);
203
204 /* ----------- setup PDARs ------------ */
205 /* this is problematic - it will reset Aladin which cause we loose
206 * serial port, and we don't know how to set up Aladin chip again.
207 */
208 // ddb_pci_reset_bus();
209
210 ddb_out32(DDB_BAR0, 0x00000008);
211
212 ddb_out32(DDB_BARC, 0xffffffff);
213 ddb_out32(DDB_BARB, 0xffffffff);
214 ddb_out32(DDB_BAR1, 0xffffffff);
215 ddb_out32(DDB_BAR2, 0xffffffff);
216 ddb_out32(DDB_BAR3, 0xffffffff);
217 ddb_out32(DDB_BAR4, 0xffffffff);
218 ddb_out32(DDB_BAR5, 0xffffffff);
219 ddb_out32(DDB_BAR6, 0xffffffff);
220 ddb_out32(DDB_BAR7, 0xffffffff);
221 ddb_out32(DDB_BAR8, 0xffffffff);
222
223 /* ----------- switch PCI1 to PCI CONFIG space ------------ */
224 ddb_set_pdar(DDB_PCIW1, DDB_PCI_CONFIG_BASE, DDB_PCI_CONFIG_SIZE, 32, 0, 1);
225 ddb_set_pmr(DDB_PCIINIT1, DDB_PCICMD_CFG, 0x0, DDB_PCI_ACCESS_32);
226
227 /* ----- M1543 PCI setup ------ */
228
229 /* we know M1543 PCI-ISA controller is at addr:18 */
230 /* xxxx1010 makes USB at addr:13 and PMU at addr:14 */
231 *(volatile unsigned char *) 0xa8040072 &= 0xf0;
232 *(volatile unsigned char *) 0xa8040072 |= 0xa;
233
234 /* setup USB interrupt to IRQ 9, (bit 0:3 - 0001)
235 * no IOCHRDY signal, (bit 7 - 1)
236 * M1543C & M7101 VID and Subsys Device ID are read-only (bit 6 - 1)
237 * Make USB Master INTAJ level to edge conversion (bit 4 - 1)
238 */
239 *(unsigned char *) 0xa8040074 = 0xd1;
240
241 /* setup PMU(SCI to IRQ 10 (bit 0:3 - 0011)
242 * SCI routing to IRQ 13 disabled (bit 7 - 1)
243 * SCI interrupt level to edge conversion bypassed (bit 4 - 0)
244 */
245 *(unsigned char *) 0xa8040076 = 0x83;
246
247 /* setup IDE controller
248 * enable IDE controller (bit 6 - 1)
249 * IDE IDSEL to be addr:24 (bit 4:5 - 11)
250 * no IDE ATA Secondary Bus Signal Pad Control (bit 3 - 0)
251 * no IDE ATA Primary Bus Signal Pad Control (bit 2 - 0)
252 * primary IRQ is 14, secondary is 15 (bit 1:0 - 01
253 */
254 // *(unsigned char*)0xa8040058 = 0x71;
255 // *(unsigned char*)0xa8040058 = 0x79;
256 // *(unsigned char*)0xa8040058 = 0x74; // use SIRQ, primary tri-state
257 *(unsigned char *) 0xa8040058 = 0x75; // primary tri-state
258
259#if 0
260 /* this is not necessary if M5229 does not use SIRQ */
261 *(unsigned char *) 0xa8040044 = 0x0d; // primary to IRQ 14
262 *(unsigned char *) 0xa8040075 = 0x0d; // secondary to IRQ 14
263#endif
264
265 /* enable IDE in the M5229 config register 0x50 (bit 0 - 1) */
266 /* M5229 IDSEL is addr:24; see above setting */
267 *(unsigned char *) 0xa9000050 |= 0x1;
268
269 /* enable bus master (bit 2) and IO decoding (bit 0) */
270 *(unsigned char *) 0xa9000004 |= 0x5;
271
272 /* enable native, copied from arch/ppc/k2boot/head.S */
273 /* TODO - need volatile, need to be portable */
274 *(unsigned char *) 0xa9000009 = 0xff;
275
276 /* ----- end of M1543 PCI setup ------ */
277
278 /* ----- reset on-board ether chip ------ */
279 *((volatile u32 *) 0xa8020004) |= 1; /* decode I/O */
280 *((volatile u32 *) 0xa8020010) = 0; /* set BAR address */
281
282 /* send reset command */
283 *((volatile u32 *) 0xa6000000) = 1; /* do a soft reset */
284
285 /* disable ether chip */
286 *((volatile u32 *) 0xa8020004) = 0; /* disable any decoding */
287
288 /* put it into sleep */
289 *((volatile u32 *) 0xa8020040) = 0x80000000;
290
291 /* ----- end of reset on-board ether chip ------ */
292
293 /* ----------- switch PCI1 back to PCI MEM space ------------ */
294 ddb_set_pdar(DDB_PCIW1, DDB_PCI_MEM_BASE, DDB_PCI_MEM_SIZE, 32, 0, 1);
295 ddb_set_pmr(DDB_PCIINIT1, DDB_PCICMD_MEM, DDB_PCI_MEM_BASE, DDB_PCI_ACCESS_32);
296}
diff --git a/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c b/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
deleted file mode 100644
index a3c5e7b18018..000000000000
--- a/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * The irq controller for vrc5476.
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16#include <linux/types.h>
17#include <linux/ptrace.h>
18
19#include <asm/system.h>
20
21#include <asm/ddb5xxx/ddb5xxx.h>
22
23static int irq_base;
24
25static void vrc5476_irq_enable(uint irq)
26{
27 nile4_enable_irq(irq - irq_base);
28}
29
30static void vrc5476_irq_disable(uint irq)
31{
32 nile4_disable_irq(irq - irq_base);
33}
34
35static unsigned int vrc5476_irq_startup(uint irq)
36{
37 nile4_enable_irq(irq - irq_base);
38 return 0;
39}
40
41#define vrc5476_irq_shutdown vrc5476_irq_disable
42
43static void vrc5476_irq_ack(uint irq)
44{
45 nile4_clear_irq(irq - irq_base);
46 nile4_disable_irq(irq - irq_base);
47}
48
49static void vrc5476_irq_end(uint irq)
50{
51 if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
52 vrc5476_irq_enable(irq);
53}
54
55static hw_irq_controller vrc5476_irq_controller = {
56 .typename = "vrc5476",
57 .startup = vrc5476_irq_startup,
58 .shutdown = vrc5476_irq_shutdown,
59 .enable = vrc5476_irq_enable,
60 .disable = vrc5476_irq_disable,
61 .ack = vrc5476_irq_ack,
62 .end = vrc5476_irq_end
63};
64
65void __init
66vrc5476_irq_init(u32 base)
67{
68 u32 i;
69
70 irq_base = base;
71 for (i= base; i< base + NUM_VRC5476_IRQ; i++) {
72 irq_desc[i].status = IRQ_DISABLED;
73 irq_desc[i].action = NULL;
74 irq_desc[i].depth = 1;
75 irq_desc[i].handler = &vrc5476_irq_controller;
76 }
77}
78
79
80void
81vrc5476_irq_dispatch(struct pt_regs *regs)
82{
83 u32 mask;
84 int nile4_irq;
85
86 mask = nile4_get_irq_stat(0);
87
88 /* quick check for possible time interrupt */
89 if (mask & (1 << VRC5476_IRQ_GPT)) {
90 do_IRQ(VRC5476_IRQ_BASE + VRC5476_IRQ_GPT, regs);
91 return;
92 }
93
94 /* check for i8259 interrupts */
95 if (mask & (1 << VRC5476_I8259_CASCADE)) {
96 int i8259_irq = nile4_i8259_iack();
97 do_IRQ(I8259_IRQ_BASE + i8259_irq, regs);
98 return;
99 }
100
101 /* regular nile4 interrupts (we should not really have any */
102 for (nile4_irq = 0; mask; nile4_irq++, mask >>= 1) {
103 if (mask & 1) {
104 do_IRQ(VRC5476_IRQ_BASE + nile4_irq, regs);
105 return;
106 }
107 }
108 spurious_interrupt(regs);
109}
diff --git a/arch/mips/ddb5xxx/ddb5477/setup.c b/arch/mips/ddb5xxx/ddb5477/setup.c
index 2f566034cc44..93167ecdb424 100644
--- a/arch/mips/ddb5xxx/ddb5477/setup.c
+++ b/arch/mips/ddb5xxx/ddb5477/setup.c
@@ -171,7 +171,7 @@ static void ddb5477_board_init(void);
171extern struct pci_controller ddb5477_ext_controller; 171extern struct pci_controller ddb5477_ext_controller;
172extern struct pci_controller ddb5477_io_controller; 172extern struct pci_controller ddb5477_io_controller;
173 173
174void __init plat_setup(void) 174void __init plat_mem_setup(void)
175{ 175{
176 /* initialize board - we don't trust the loader */ 176 /* initialize board - we don't trust the loader */
177 ddb5477_board_init(); 177 ddb5477_board_init();
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
index ad5d436d80c1..9c707b9ceb65 100644
--- a/arch/mips/dec/setup.c
+++ b/arch/mips/dec/setup.c
@@ -147,7 +147,7 @@ static void __init dec_be_init(void)
147extern void dec_time_init(void); 147extern void dec_time_init(void);
148extern void dec_timer_setup(struct irqaction *); 148extern void dec_timer_setup(struct irqaction *);
149 149
150void __init plat_setup(void) 150void __init plat_mem_setup(void)
151{ 151{
152 board_be_init = dec_be_init; 152 board_be_init = dec_be_init;
153 board_time_init = dec_time_init; 153 board_time_init = dec_time_init;
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
index 74cb055d4bf6..76e4d09ff4d2 100644
--- a/arch/mips/dec/time.c
+++ b/arch/mips/dec/time.c
@@ -181,7 +181,7 @@ void __init dec_time_init(void)
181 } 181 }
182 182
183 /* Set up the rate of periodic DS1287 interrupts. */ 183 /* Set up the rate of periodic DS1287 interrupts. */
184 CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - LOG_2_HZ), RTC_REG_A); 184 CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A);
185} 185}
186 186
187EXPORT_SYMBOL(do_settimeofday); 187EXPORT_SYMBOL(do_settimeofday);
diff --git a/arch/mips/defconfig b/arch/mips/defconfig
index 607e2985ffe3..879ba1ad99ca 100644
--- a/arch/mips/defconfig
+++ b/arch/mips/defconfig
@@ -41,8 +41,6 @@ CONFIG_MIPS=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set 42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS 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 44# CONFIG_DDB5477 is not set
47# CONFIG_MACH_VR41XX is not set 45# CONFIG_MACH_VR41XX is not set
48# CONFIG_PMC_YOSEMITE is not set 46# CONFIG_PMC_YOSEMITE is not set
@@ -136,6 +134,15 @@ CONFIG_FLATMEM=y
136CONFIG_FLAT_NODE_MEM_MAP=y 134CONFIG_FLAT_NODE_MEM_MAP=y
137# CONFIG_SPARSEMEM_STATIC is not set 135# CONFIG_SPARSEMEM_STATIC is not set
138CONFIG_SPLIT_PTLOCK_CPUS=4 136CONFIG_SPLIT_PTLOCK_CPUS=4
137# CONFIG_HZ_48 is not set
138# CONFIG_HZ_100 is not set
139# CONFIG_HZ_128 is not set
140# CONFIG_HZ_250 is not set
141# CONFIG_HZ_256 is not set
142CONFIG_HZ_1000=y
143# CONFIG_HZ_1024 is not set
144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
145CONFIG_HZ=1000
139# CONFIG_PREEMPT_NONE is not set 146# CONFIG_PREEMPT_NONE is not set
140CONFIG_PREEMPT_VOLUNTARY=y 147CONFIG_PREEMPT_VOLUNTARY=y
141# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
diff --git a/arch/mips/emma2rh/common/Makefile b/arch/mips/emma2rh/common/Makefile
new file mode 100644
index 000000000000..859121b3867d
--- /dev/null
+++ b/arch/mips/emma2rh/common/Makefile
@@ -0,0 +1,13 @@
1#
2# arch/mips/emma2rh/common/Makefile
3# Makefile for the common code of NEC EMMA2RH based board.
4#
5# Copyright (C) NEC Electronics Corporation 2005-2006
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12
13obj-$(CONFIG_MARKEINS) += irq.o irq_emma2rh.o prom.o
diff --git a/arch/mips/emma2rh/common/irq.c b/arch/mips/emma2rh/common/irq.c
new file mode 100644
index 000000000000..b075281e50e9
--- /dev/null
+++ b/arch/mips/emma2rh/common/irq.c
@@ -0,0 +1,108 @@
1/*
2 * arch/mips/emma2rh/common/irq.c
3 * This file is common irq dispatcher.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/config.h>
26#include <linux/init.h>
27#include <linux/interrupt.h>
28#include <linux/irq.h>
29#include <linux/types.h>
30
31#include <asm/i8259.h>
32#include <asm/system.h>
33#include <asm/mipsregs.h>
34#include <asm/debug.h>
35#include <asm/addrspace.h>
36#include <asm/bootinfo.h>
37
38#include <asm/emma2rh/emma2rh.h>
39
40/*
41 * the first level int-handler will jump here if it is a emma2rh irq
42 */
43asmlinkage void emma2rh_irq_dispatch(struct pt_regs *regs)
44{
45 u32 intStatus;
46 u32 bitmask;
47 u32 i;
48
49 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_0)
50 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_0);
51
52#ifdef EMMA2RH_SW_CASCADE
53 if (intStatus &
54 (1 << ((EMMA2RH_SW_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) {
55 u32 swIntStatus;
56 swIntStatus = emma2rh_in32(EMMA2RH_BHIF_SW_INT)
57 & emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
58 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
59 if (swIntStatus & bitmask) {
60 do_IRQ(EMMA2RH_SW_IRQ_BASE + i, regs);
61 return;
62 }
63 }
64 }
65#endif
66
67 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
68 if (intStatus & bitmask) {
69 do_IRQ(EMMA2RH_IRQ_BASE + i, regs);
70 return;
71 }
72 }
73
74 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_1)
75 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_1);
76
77#ifdef EMMA2RH_GPIO_CASCADE
78 if (intStatus &
79 (1 << ((EMMA2RH_GPIO_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) {
80 u32 gpioIntStatus;
81 gpioIntStatus = emma2rh_in32(EMMA2RH_GPIO_INT_ST)
82 & emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
83 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
84 if (gpioIntStatus & bitmask) {
85 do_IRQ(EMMA2RH_GPIO_IRQ_BASE + i, regs);
86 return;
87 }
88 }
89 }
90#endif
91
92 for (i = 32, bitmask = 1; i < 64; i++, bitmask <<= 1) {
93 if (intStatus & bitmask) {
94 do_IRQ(EMMA2RH_IRQ_BASE + i, regs);
95 return;
96 }
97 }
98
99 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_2)
100 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_2);
101
102 for (i = 64, bitmask = 1; i < 96; i++, bitmask <<= 1) {
103 if (intStatus & bitmask) {
104 do_IRQ(EMMA2RH_IRQ_BASE + i, regs);
105 return;
106 }
107 }
108}
diff --git a/arch/mips/emma2rh/common/irq_emma2rh.c b/arch/mips/emma2rh/common/irq_emma2rh.c
new file mode 100644
index 000000000000..b886aa94ca90
--- /dev/null
+++ b/arch/mips/emma2rh/common/irq_emma2rh.c
@@ -0,0 +1,134 @@
1/*
2 * arch/mips/emma2rh/common/irq_emma2rh.c
3 * This file defines the irq handler for EMMA2RH.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq_5477.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26/*
27 * EMMA2RH defines 64 IRQs.
28 *
29 * This file exports one function:
30 * emma2rh_irq_init(u32 irq_base);
31 */
32
33#include <linux/interrupt.h>
34#include <linux/types.h>
35#include <linux/ptrace.h>
36
37#include <asm/debug.h>
38
39#include <asm/emma2rh/emma2rh.h>
40
41/* number of total irqs supported by EMMA2RH */
42#define NUM_EMMA2RH_IRQ 96
43
44static int emma2rh_irq_base = -1;
45
46void ll_emma2rh_irq_enable(int);
47void ll_emma2rh_irq_disable(int);
48
49static void emma2rh_irq_enable(unsigned int irq)
50{
51 ll_emma2rh_irq_enable(irq - emma2rh_irq_base);
52}
53
54static void emma2rh_irq_disable(unsigned int irq)
55{
56 ll_emma2rh_irq_disable(irq - emma2rh_irq_base);
57}
58
59static unsigned int emma2rh_irq_startup(unsigned int irq)
60{
61 emma2rh_irq_enable(irq);
62 return 0;
63}
64
65#define emma2rh_irq_shutdown emma2rh_irq_disable
66
67static void emma2rh_irq_ack(unsigned int irq)
68{
69 /* disable interrupt - some handler will re-enable the irq
70 * and if the interrupt is leveled, we will have infinite loop
71 */
72 ll_emma2rh_irq_disable(irq - emma2rh_irq_base);
73}
74
75static void emma2rh_irq_end(unsigned int irq)
76{
77 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
78 ll_emma2rh_irq_enable(irq - emma2rh_irq_base);
79}
80
81hw_irq_controller emma2rh_irq_controller = {
82 .typename = "emma2rh_irq",
83 .startup = emma2rh_irq_startup,
84 .shutdown = emma2rh_irq_shutdown,
85 .enable = emma2rh_irq_enable,
86 .disable = emma2rh_irq_disable,
87 .ack = emma2rh_irq_ack,
88 .end = emma2rh_irq_end,
89 .set_affinity = NULL /* no affinity stuff for UP */
90};
91
92void emma2rh_irq_init(u32 irq_base)
93{
94 u32 i;
95
96 for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ; i++) {
97 irq_desc[i].status = IRQ_DISABLED;
98 irq_desc[i].action = NULL;
99 irq_desc[i].depth = 1;
100 irq_desc[i].handler = &emma2rh_irq_controller;
101 }
102
103 emma2rh_irq_base = irq_base;
104}
105
106void ll_emma2rh_irq_enable(int emma2rh_irq)
107{
108 u32 reg_value;
109 u32 reg_bitmask;
110 u32 reg_index;
111
112 reg_index = EMMA2RH_BHIF_INT_EN_0
113 + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0)
114 * (emma2rh_irq / 32);
115 reg_value = emma2rh_in32(reg_index);
116 reg_bitmask = 0x1 << (emma2rh_irq % 32);
117 db_assert((reg_value & reg_bitmask) == 0);
118 emma2rh_out32(reg_index, reg_value | reg_bitmask);
119}
120
121void ll_emma2rh_irq_disable(int emma2rh_irq)
122{
123 u32 reg_value;
124 u32 reg_bitmask;
125 u32 reg_index;
126
127 reg_index = EMMA2RH_BHIF_INT_EN_0
128 + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0)
129 * (emma2rh_irq / 32);
130 reg_value = emma2rh_in32(reg_index);
131 reg_bitmask = 0x1 << (emma2rh_irq % 32);
132 db_assert((reg_value & reg_bitmask) != 0);
133 emma2rh_out32(reg_index, reg_value & ~reg_bitmask);
134}
diff --git a/arch/mips/emma2rh/common/prom.c b/arch/mips/emma2rh/common/prom.c
new file mode 100644
index 000000000000..8bba0b02a204
--- /dev/null
+++ b/arch/mips/emma2rh/common/prom.c
@@ -0,0 +1,77 @@
1/*
2 * arch/mips/emma2rh/common/prom.c
3 * This file is prom file.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/common/prom.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/config.h>
26#include <linux/init.h>
27#include <linux/mm.h>
28#include <linux/sched.h>
29#include <linux/bootmem.h>
30
31#include <asm/addrspace.h>
32#include <asm/bootinfo.h>
33#include <asm/emma2rh/emma2rh.h>
34#include <asm/debug.h>
35
36const char *get_system_type(void)
37{
38 switch (mips_machtype) {
39 case MACH_NEC_MARKEINS:
40 return "NEC EMMA2RH Mark-eins";
41 default:
42 return "Unknown NEC board";
43 }
44}
45
46/* [jsun@junsun.net] PMON passes arguments in C main() style */
47void __init prom_init(void)
48{
49 int argc = fw_arg0;
50 char **arg = (char **)fw_arg1;
51 int i;
52
53 /* if user passes kernel args, ignore the default one */
54 if (argc > 1)
55 arcs_cmdline[0] = '\0';
56
57 /* arg[0] is "g", the rest is boot parameters */
58 for (i = 1; i < argc; i++) {
59 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
60 >= sizeof(arcs_cmdline))
61 break;
62 strcat(arcs_cmdline, arg[i]);
63 strcat(arcs_cmdline, " ");
64 }
65
66 mips_machgroup = MACH_GROUP_NEC_EMMA2RH;
67
68#if defined(CONFIG_MARKEINS)
69 mips_machtype = MACH_NEC_MARKEINS;
70 add_memory_region(0, EMMA2RH_RAM_SIZE, BOOT_MEM_RAM);
71#endif
72
73}
74
75void __init prom_free_prom_memory(void)
76{
77}
diff --git a/arch/mips/emma2rh/markeins/Makefile b/arch/mips/emma2rh/markeins/Makefile
new file mode 100644
index 000000000000..14fc268b175c
--- /dev/null
+++ b/arch/mips/emma2rh/markeins/Makefile
@@ -0,0 +1,13 @@
1#
2# arch/mips/emma2rh/markeins/Makefile
3# Makefile for the common code of NEC EMMA2RH based board.
4#
5# Copyright (C) NEC Electronics Corporation 2005-2006
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12
13obj-$(CONFIG_MARKEINS) += irq.o irq_markeins.o setup.o led.o platform.o
diff --git a/arch/mips/emma2rh/markeins/irq.c b/arch/mips/emma2rh/markeins/irq.c
new file mode 100644
index 000000000000..76dc3faeaf4e
--- /dev/null
+++ b/arch/mips/emma2rh/markeins/irq.c
@@ -0,0 +1,134 @@
1/*
2 * arch/mips/emma2rh/markeins/irq.c
3 * This file defines the irq handler for EMMA2RH.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/config.h>
26#include <linux/init.h>
27#include <linux/interrupt.h>
28#include <linux/irq.h>
29#include <linux/types.h>
30#include <linux/ptrace.h>
31#include <linux/delay.h>
32
33#include <asm/i8259.h>
34#include <asm/irq_cpu.h>
35#include <asm/system.h>
36#include <asm/mipsregs.h>
37#include <asm/debug.h>
38#include <asm/addrspace.h>
39#include <asm/bootinfo.h>
40
41#include <asm/emma2rh/emma2rh.h>
42
43/*
44 * IRQ mapping
45 *
46 * 0-7: 8 CPU interrupts
47 * 0 - software interrupt 0
48 * 1 - software interrupt 1
49 * 2 - most Vrc5477 interrupts are routed to this pin
50 * 3 - (optional) some other interrupts routed to this pin for debugg
51 * 4 - not used
52 * 5 - not used
53 * 6 - not used
54 * 7 - cpu timer (used by default)
55 *
56 */
57
58extern void emma2rh_sw_irq_init(u32 base);
59extern void emma2rh_gpio_irq_init(u32 base);
60extern void emma2rh_irq_init(u32 base);
61extern asmlinkage void emma2rh_irq_dispatch(struct pt_regs *regs);
62
63static struct irqaction irq_cascade = {
64 .handler = no_action,
65 .flags = 0,
66 .mask = CPU_MASK_NONE,
67 .name = "cascade",
68 .dev_id = NULL,
69 .next = NULL,
70};
71
72void __init arch_init_irq(void)
73{
74 u32 reg;
75
76 db_run(printk("markeins_irq_setup invoked.\n"));
77
78 /* by default, interrupts are disabled. */
79 emma2rh_out32(EMMA2RH_BHIF_INT_EN_0, 0);
80 emma2rh_out32(EMMA2RH_BHIF_INT_EN_1, 0);
81 emma2rh_out32(EMMA2RH_BHIF_INT_EN_2, 0);
82 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_0, 0);
83 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_1, 0);
84 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_2, 0);
85 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, 0);
86
87 clear_c0_status(0xff00);
88 set_c0_status(0x0400);
89
90#define GPIO_PCI (0xf<<15)
91 /* setup GPIO interrupt for PCI interface */
92 /* direction input */
93 reg = emma2rh_in32(EMMA2RH_GPIO_DIR);
94 emma2rh_out32(EMMA2RH_GPIO_DIR, reg & ~GPIO_PCI);
95 /* disable interrupt */
96 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
97 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg & ~GPIO_PCI);
98 /* level triggerd */
99 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MODE);
100 emma2rh_out32(EMMA2RH_GPIO_INT_MODE, reg | GPIO_PCI);
101 reg = emma2rh_in32(EMMA2RH_GPIO_INT_CND_A);
102 emma2rh_out32(EMMA2RH_GPIO_INT_CND_A, reg & (~GPIO_PCI));
103 /* interrupt clear */
104 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~GPIO_PCI);
105
106 /* init all controllers */
107 emma2rh_irq_init(EMMA2RH_IRQ_BASE);
108 emma2rh_sw_irq_init(EMMA2RH_SW_IRQ_BASE);
109 emma2rh_gpio_irq_init(EMMA2RH_GPIO_IRQ_BASE);
110 mips_cpu_irq_init(CPU_IRQ_BASE);
111
112 /* setup cascade interrupts */
113 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade);
114 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE, &irq_cascade);
115 setup_irq(CPU_IRQ_BASE + CPU_EMMA2RH_CASCADE, &irq_cascade);
116}
117
118asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
119{
120 unsigned int pending = read_c0_status() & read_c0_cause();
121
122 if (pending & STATUSF_IP7)
123 do_IRQ(CPU_IRQ_BASE + 7, regs);
124 else if (pending & STATUSF_IP2)
125 emma2rh_irq_dispatch(regs);
126 else if (pending & STATUSF_IP1)
127 do_IRQ(CPU_IRQ_BASE + 1, regs);
128 else if (pending & STATUSF_IP0)
129 do_IRQ(CPU_IRQ_BASE + 0, regs);
130 else
131 spurious_interrupt(regs);
132}
133
134
diff --git a/arch/mips/emma2rh/markeins/irq_markeins.c b/arch/mips/emma2rh/markeins/irq_markeins.c
new file mode 100644
index 000000000000..1783fdab6459
--- /dev/null
+++ b/arch/mips/emma2rh/markeins/irq_markeins.c
@@ -0,0 +1,197 @@
1/*
2 * arch/mips/emma2rh/markeins/irq_markeins.c
3 * This file defines the irq handler for Mark-eins.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq_5477.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/interrupt.h>
26#include <linux/irq.h>
27#include <linux/types.h>
28#include <linux/ptrace.h>
29
30#include <asm/debug.h>
31#include <asm/emma2rh/emma2rh.h>
32
33static int emma2rh_sw_irq_base = -1;
34static int emma2rh_gpio_irq_base = -1;
35
36void ll_emma2rh_sw_irq_enable(int reg);
37void ll_emma2rh_sw_irq_disable(int reg);
38void ll_emma2rh_gpio_irq_enable(int reg);
39void ll_emma2rh_gpio_irq_disable(int reg);
40
41static void emma2rh_sw_irq_enable(unsigned int irq)
42{
43 ll_emma2rh_sw_irq_enable(irq - emma2rh_sw_irq_base);
44}
45
46static void emma2rh_sw_irq_disable(unsigned int irq)
47{
48 ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base);
49}
50
51static unsigned int emma2rh_sw_irq_startup(unsigned int irq)
52{
53 emma2rh_sw_irq_enable(irq);
54 return 0;
55}
56
57#define emma2rh_sw_irq_shutdown emma2rh_sw_irq_disable
58
59static void emma2rh_sw_irq_ack(unsigned int irq)
60{
61 ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base);
62}
63
64static void emma2rh_sw_irq_end(unsigned int irq)
65{
66 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
67 ll_emma2rh_sw_irq_enable(irq - emma2rh_sw_irq_base);
68}
69
70hw_irq_controller emma2rh_sw_irq_controller = {
71 .typename = "emma2rh_sw_irq",
72 .startup = emma2rh_sw_irq_startup,
73 .shutdown = emma2rh_sw_irq_shutdown,
74 .enable = emma2rh_sw_irq_enable,
75 .disable = emma2rh_sw_irq_disable,
76 .ack = emma2rh_sw_irq_ack,
77 .end = emma2rh_sw_irq_end,
78 .set_affinity = NULL,
79};
80
81void emma2rh_sw_irq_init(u32 irq_base)
82{
83 u32 i;
84
85 for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_SW; i++) {
86 irq_desc[i].status = IRQ_DISABLED;
87 irq_desc[i].action = NULL;
88 irq_desc[i].depth = 2;
89 irq_desc[i].handler = &emma2rh_sw_irq_controller;
90 }
91
92 emma2rh_sw_irq_base = irq_base;
93}
94
95void ll_emma2rh_sw_irq_enable(int irq)
96{
97 u32 reg;
98
99 db_assert(irq >= 0);
100 db_assert(irq < NUM_EMMA2RH_IRQ_SW);
101
102 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
103 reg |= 1 << irq;
104 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg);
105}
106
107void ll_emma2rh_sw_irq_disable(int irq)
108{
109 u32 reg;
110
111 db_assert(irq >= 0);
112 db_assert(irq < 32);
113
114 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
115 reg &= ~(1 << irq);
116 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg);
117}
118
119static void emma2rh_gpio_irq_enable(unsigned int irq)
120{
121 ll_emma2rh_gpio_irq_enable(irq - emma2rh_gpio_irq_base);
122}
123
124static void emma2rh_gpio_irq_disable(unsigned int irq)
125{
126 ll_emma2rh_gpio_irq_disable(irq - emma2rh_gpio_irq_base);
127}
128
129static unsigned int emma2rh_gpio_irq_startup(unsigned int irq)
130{
131 emma2rh_gpio_irq_enable(irq);
132 return 0;
133}
134
135#define emma2rh_gpio_irq_shutdown emma2rh_gpio_irq_disable
136
137static void emma2rh_gpio_irq_ack(unsigned int irq)
138{
139 irq -= emma2rh_gpio_irq_base;
140 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq));
141 ll_emma2rh_gpio_irq_disable(irq);
142}
143
144static void emma2rh_gpio_irq_end(unsigned int irq)
145{
146 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
147 ll_emma2rh_gpio_irq_enable(irq - emma2rh_gpio_irq_base);
148}
149
150hw_irq_controller emma2rh_gpio_irq_controller = {
151 .typename = "emma2rh_gpio_irq",
152 .startup = emma2rh_gpio_irq_startup,
153 .shutdown = emma2rh_gpio_irq_shutdown,
154 .enable = emma2rh_gpio_irq_enable,
155 .disable = emma2rh_gpio_irq_disable,
156 .ack = emma2rh_gpio_irq_ack,
157 .end = emma2rh_gpio_irq_end,
158 .set_affinity = NULL,
159};
160
161void emma2rh_gpio_irq_init(u32 irq_base)
162{
163 u32 i;
164
165 for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_GPIO; i++) {
166 irq_desc[i].status = IRQ_DISABLED;
167 irq_desc[i].action = NULL;
168 irq_desc[i].depth = 2;
169 irq_desc[i].handler = &emma2rh_gpio_irq_controller;
170 }
171
172 emma2rh_gpio_irq_base = irq_base;
173}
174
175void ll_emma2rh_gpio_irq_enable(int irq)
176{
177 u32 reg;
178
179 db_assert(irq >= 0);
180 db_assert(irq < NUM_EMMA2RH_IRQ_GPIO);
181
182 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
183 reg |= 1 << irq;
184 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg);
185}
186
187void ll_emma2rh_gpio_irq_disable(int irq)
188{
189 u32 reg;
190
191 db_assert(irq >= 0);
192 db_assert(irq < NUM_EMMA2RH_IRQ_GPIO);
193
194 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
195 reg &= ~(1 << irq);
196 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg);
197}
diff --git a/arch/mips/emma2rh/markeins/led.c b/arch/mips/emma2rh/markeins/led.c
new file mode 100644
index 000000000000..b65254c1bfe9
--- /dev/null
+++ b/arch/mips/emma2rh/markeins/led.c
@@ -0,0 +1,60 @@
1/*
2 * arch/mips/emma2rh/markeins/led.c
3 * This file defines the led display for Mark-eins.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/kernel.h>
22#include <linux/types.h>
23#include <linux/string.h>
24#include <asm/emma2rh/emma2rh.h>
25
26const unsigned long clear = 0x20202020;
27
28#define LED_BASE 0xb1400038
29
30void markeins_led_clear(void)
31{
32 emma2rh_out32(LED_BASE, clear);
33 emma2rh_out32(LED_BASE + 4, clear);
34}
35
36void markeins_led(const char *str)
37{
38 int i;
39 int len = strlen(str);
40
41 markeins_led_clear();
42 if (len > 8)
43 len = 8;
44
45 if (emma2rh_in32(0xb0000800) & (0x1 << 18))
46 for (i = 0; i < len; i++)
47 emma2rh_out8(LED_BASE + i, str[i]);
48 else
49 for (i = 0; i < len; i++)
50 emma2rh_out8(LED_BASE + (i & 4) + (3 - (i & 3)),
51 str[i]);
52}
53
54void markeins_led_hex(u32 val)
55{
56 char str[10];
57
58 sprintf(str, "%08x", val);
59 markeins_led(str);
60}
diff --git a/arch/mips/emma2rh/markeins/platform.c b/arch/mips/emma2rh/markeins/platform.c
new file mode 100644
index 000000000000..6c1eeae1a898
--- /dev/null
+++ b/arch/mips/emma2rh/markeins/platform.c
@@ -0,0 +1,170 @@
1/*
2 * arch/mips/emma2rh/markeins/platofrm.c
3 * This file sets up platform devices for EMMA2RH Mark-eins.
4 *
5 * Copyright(C) MontaVista Software Inc, 2006
6 *
7 * Author: dmitry pervushin <dpervushin@ru.mvista.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#include <linux/config.h>
24#include <linux/init.h>
25#include <linux/kernel.h>
26#include <linux/types.h>
27#include <linux/ioport.h>
28#include <linux/serial_8250.h>
29#include <linux/mtd/physmap.h>
30
31#include <asm/cpu.h>
32#include <asm/bootinfo.h>
33#include <asm/addrspace.h>
34#include <asm/time.h>
35#include <asm/bcache.h>
36#include <asm/irq.h>
37#include <asm/reboot.h>
38#include <asm/gdb-stub.h>
39#include <asm/traps.h>
40#include <asm/debug.h>
41
42#include <asm/emma2rh/emma2rh.h>
43
44
45#define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */
46
47static struct resource i2c_emma_resources_0[] = {
48 { NULL, EMMA2RH_IRQ_PIIC0, EMMA2RH_IRQ_PIIC0, IORESOURCE_IRQ },
49 { NULL, KSEG1ADDR(EMMA2RH_PIIC0_BASE), KSEG1ADDR(EMMA2RH_PIIC0_BASE + 0x1000), 0 },
50};
51
52struct resource i2c_emma_resources_1[] = {
53 { NULL, EMMA2RH_IRQ_PIIC1, EMMA2RH_IRQ_PIIC1, IORESOURCE_IRQ },
54 { NULL, KSEG1ADDR(EMMA2RH_PIIC1_BASE), KSEG1ADDR(EMMA2RH_PIIC1_BASE + 0x1000), 0 },
55};
56
57struct resource i2c_emma_resources_2[] = {
58 { NULL, EMMA2RH_IRQ_PIIC2, EMMA2RH_IRQ_PIIC2, IORESOURCE_IRQ },
59 { NULL, KSEG1ADDR(EMMA2RH_PIIC2_BASE), KSEG1ADDR(EMMA2RH_PIIC2_BASE + 0x1000), 0 },
60};
61
62struct platform_device i2c_emma_devices[] = {
63 [0] = {
64 .name = I2C_EMMA2RH,
65 .id = 0,
66 .resource = i2c_emma_resources_0,
67 .num_resources = ARRAY_SIZE(i2c_emma_resources_0),
68 },
69 [1] = {
70 .name = I2C_EMMA2RH,
71 .id = 1,
72 .resource = i2c_emma_resources_1,
73 .num_resources = ARRAY_SIZE(i2c_emma_resources_1),
74 },
75 [2] = {
76 .name = I2C_EMMA2RH,
77 .id = 2,
78 .resource = i2c_emma_resources_2,
79 .num_resources = ARRAY_SIZE(i2c_emma_resources_2),
80 },
81};
82
83#define EMMA2RH_SERIAL_CLOCK 18544000
84#define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
85
86static struct plat_serial8250_port platform_serial_ports[] = {
87 [0] = {
88 .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3),
89 .irq = EMMA2RH_IRQ_PFUR0,
90 .uartclk = EMMA2RH_SERIAL_CLOCK,
91 .regshift = 4,
92 .iotype = UPIO_MEM,
93 .flags = EMMA2RH_SERIAL_FLAGS,
94 },
95 [1] = {
96 .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3),
97 .irq = EMMA2RH_IRQ_PFUR1,
98 .uartclk = EMMA2RH_SERIAL_CLOCK,
99 .regshift = 4,
100 .iotype = UPIO_MEM,
101 .flags = EMMA2RH_SERIAL_FLAGS,
102 },
103 [2] = {
104 .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3),
105 .irq = EMMA2RH_IRQ_PFUR2,
106 .uartclk = EMMA2RH_SERIAL_CLOCK,
107 .regshift = 4,
108 .iotype = UPIO_MEM,
109 .flags = EMMA2RH_SERIAL_FLAGS,
110 },
111 [3] = {
112 .flags = 0,
113 },
114};
115
116static struct platform_device serial_emma = {
117 .name = "serial8250",
118 .dev = {
119 .platform_data = &platform_serial_ports,
120 },
121};
122
123static struct platform_device *devices[] = {
124 &i2c_emma_devices[0],
125 &i2c_emma_devices[1],
126 &i2c_emma_devices[2],
127 &serial_emma,
128};
129
130static struct mtd_partition markeins_parts[] = {
131 [0] = {
132 .name = "RootFS",
133 .offset = 0x00000000,
134 .size = 0x00c00000,
135 },
136 [1] = {
137 .name = "boot code area",
138 .offset = MTDPART_OFS_APPEND,
139 .size = 0x00100000,
140 },
141 [2] = {
142 .name = "kernel image",
143 .offset = MTDPART_OFS_APPEND,
144 .size = 0x00300000,
145 },
146 [3] = {
147 .name = "RootFS2",
148 .offset = MTDPART_OFS_APPEND,
149 .size = 0x00c00000,
150 },
151 [4] = {
152 .name = "boot code area2",
153 .offset = MTDPART_OFS_APPEND,
154 .size = 0x00100000,
155 },
156 [5] = {
157 .name = "kernel image2",
158 .offset = MTDPART_OFS_APPEND,
159 .size = MTDPART_SIZ_FULL,
160 },
161};
162
163static int __init platform_devices_setup(void)
164{
165 physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts));
166 return platform_add_devices(devices, ARRAY_SIZE(devices));
167}
168
169arch_initcall(platform_devices_setup);
170
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
new file mode 100644
index 000000000000..7d98fdbf8390
--- /dev/null
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -0,0 +1,182 @@
1/*
2 * arch/mips/emma2rh/markeins/setup.c
3 * This file is setup for EMMA2RH Mark-eins.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/setup.c.
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/config.h>
26#include <linux/init.h>
27#include <linux/kernel.h>
28#include <linux/types.h>
29#include <linux/initrd.h>
30#include <linux/irq.h>
31#include <linux/ide.h>
32#include <linux/ioport.h>
33#include <linux/param.h> /* for HZ */
34#include <linux/root_dev.h>
35#include <linux/serial.h>
36#include <linux/serial_core.h>
37
38#include <asm/cpu.h>
39#include <asm/bootinfo.h>
40#include <asm/addrspace.h>
41#include <asm/time.h>
42#include <asm/bcache.h>
43#include <asm/irq.h>
44#include <asm/reboot.h>
45#include <asm/gdb-stub.h>
46#include <asm/traps.h>
47#include <asm/debug.h>
48
49#include <asm/emma2rh/emma2rh.h>
50
51#define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */
52
53extern void markeins_led(const char *);
54
55static int bus_frequency = 0;
56
57static void markeins_machine_restart(char *command)
58{
59 static void (*back_to_prom) (void) = (void (*)(void))0xbfc00000;
60
61 printk("cannot EMMA2RH Mark-eins restart.\n");
62 markeins_led("restart.");
63 back_to_prom();
64}
65
66static void markeins_machine_halt(void)
67{
68 printk("EMMA2RH Mark-eins halted.\n");
69 markeins_led("halted.");
70 while (1) ;
71}
72
73static void markeins_machine_power_off(void)
74{
75 printk("EMMA2RH Mark-eins halted. Please turn off the power.\n");
76 markeins_led("poweroff.");
77 while (1) ;
78}
79
80static unsigned long clock[4] = { 166500000, 187312500, 199800000, 210600000 };
81
82static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
83{
84 u32 reg;
85
86 /* detect from boot strap */
87 reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0);
88 reg = (reg >> 4) & 0x3;
89 return clock[reg];
90}
91
92static void __init emma2rh_time_init(void)
93{
94 u32 reg;
95 if (bus_frequency == 0)
96 bus_frequency = detect_bus_frequency(0);
97
98 reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0);
99 if ((reg & 0x3) == 0)
100 reg = (reg >> 6) & 0x3;
101 else {
102 reg = emma2rh_in32(EMMA2RH_BHIF_MAIN_CTRL);
103 reg = (reg >> 4) & 0x3;
104 }
105 mips_hpt_frequency = (bus_frequency * (4 + reg)) / 4 / 2;
106}
107
108static void __init emma2rh_timer_setup(struct irqaction *irq)
109{
110 /* we are using the cpu counter for timer interrupts */
111 setup_irq(CPU_IRQ_BASE + 7, irq);
112}
113
114static void markeins_board_init(void);
115extern void markeins_irq_setup(void);
116
117static void inline __init markeins_sio_setup(void)
118{
119#ifdef CONFIG_KGDB_8250
120 struct uart_port emma_port;
121
122 memset(&emma_port, 0, sizeof(emma_port));
123
124 emma_port.flags =
125 UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
126 emma_port.iotype = UPIO_MEM;
127 emma_port.regshift = 4; /* I/O addresses are every 8 bytes */
128 emma_port.uartclk = 18544000; /* Clock rate of the chip */
129
130 emma_port.line = 0;
131 emma_port.mapbase = KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3);
132 emma_port.membase = (u8*)emma_port.mapbase;
133 early_serial_setup(&emma_port);
134
135 emma_port.line = 1;
136 emma_port.mapbase = KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3);
137 emma_port.membase = (u8*)emma_port.mapbase;
138 early_serial_setup(&emma_port);
139
140 emma_port.irq = EMMA2RH_IRQ_PFUR1;
141 kgdb8250_add_port(1, &emma_port);
142#endif
143}
144
145void __init plat_mem_setup(void)
146{
147 /* initialize board - we don't trust the loader */
148 markeins_board_init();
149
150 set_io_port_base(KSEG1ADDR(EMMA2RH_PCI_IO_BASE));
151
152 board_time_init = emma2rh_time_init;
153 board_timer_setup = emma2rh_timer_setup;
154
155 _machine_restart = markeins_machine_restart;
156 _machine_halt = markeins_machine_halt;
157 pm_power_off = markeins_machine_power_off;
158
159 /* setup resource limits */
160 ioport_resource.start = EMMA2RH_PCI_IO_BASE;
161 ioport_resource.end = EMMA2RH_PCI_IO_BASE + EMMA2RH_PCI_IO_SIZE - 1;
162 iomem_resource.start = EMMA2RH_IO_BASE;
163 iomem_resource.end = EMMA2RH_ROM_BASE - 1;
164
165 /* Reboot on panic */
166 panic_timeout = 180;
167
168 markeins_sio_setup();
169}
170
171static void __init markeins_board_init(void)
172{
173 u32 val;
174
175 val = emma2rh_in32(EMMA2RH_PBRD_INT_EN); /* open serial interrupts. */
176 emma2rh_out32(EMMA2RH_PBRD_INT_EN, val | 0xaa);
177 val = emma2rh_in32(EMMA2RH_PBRD_CLKSEL); /* set serial clocks. */
178 emma2rh_out32(EMMA2RH_PBRD_CLKSEL, val | 0x5); /* 18MHz */
179 emma2rh_out32(EMMA2RH_PCI_CONTROL, 0);
180
181 markeins_led("MVL E2RH");
182}
diff --git a/arch/mips/galileo-boards/ev96100/setup.c b/arch/mips/galileo-boards/ev96100/setup.c
index 78dbb18edeb8..a04aea6123da 100644
--- a/arch/mips/galileo-boards/ev96100/setup.c
+++ b/arch/mips/galileo-boards/ev96100/setup.c
@@ -55,7 +55,7 @@ extern void mips_reboot_setup(void);
55 55
56unsigned char mac_0_1[12]; 56unsigned char mac_0_1[12];
57 57
58void __init plat_setup(void) 58void __init plat_mem_setup(void)
59{ 59{
60 unsigned int config = read_c0_config(); 60 unsigned int config = read_c0_config();
61 unsigned int status = read_c0_status(); 61 unsigned int status = read_c0_status();
diff --git a/arch/mips/gt64120/ev64120/setup.c b/arch/mips/gt64120/ev64120/setup.c
index 6d859d1e7a2d..4236da31ecc6 100644
--- a/arch/mips/gt64120/ev64120/setup.c
+++ b/arch/mips/gt64120/ev64120/setup.c
@@ -71,7 +71,7 @@ unsigned long __init prom_free_prom_memory(void)
71 */ 71 */
72extern void gt64120_time_init(void); 72extern void gt64120_time_init(void);
73 73
74void __init plat_setup(void) 74void __init plat_mem_setup(void)
75{ 75{
76 _machine_restart = galileo_machine_restart; 76 _machine_restart = galileo_machine_restart;
77 _machine_halt = galileo_machine_halt; 77 _machine_halt = galileo_machine_halt;
diff --git a/arch/mips/gt64120/momenco_ocelot/setup.c b/arch/mips/gt64120/momenco_ocelot/setup.c
index 20b65d3d2151..1193a22c4693 100644
--- a/arch/mips/gt64120/momenco_ocelot/setup.c
+++ b/arch/mips/gt64120/momenco_ocelot/setup.c
@@ -152,7 +152,7 @@ void PMON_v2_setup()
152 gt64120_base = 0xe0000000; 152 gt64120_base = 0xe0000000;
153} 153}
154 154
155void __init plat_setup(void) 155void __init plat_mem_setup(void)
156{ 156{
157 void (*l3func)(unsigned long)=KSEG1ADDR(&setup_l3cache); 157 void (*l3func)(unsigned long)=KSEG1ADDR(&setup_l3cache);
158 unsigned int tmpword; 158 unsigned int tmpword;
diff --git a/arch/mips/gt64120/wrppmc/Makefile b/arch/mips/gt64120/wrppmc/Makefile
new file mode 100644
index 000000000000..72606b9af12a
--- /dev/null
+++ b/arch/mips/gt64120/wrppmc/Makefile
@@ -0,0 +1,14 @@
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License. See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6# Copyright 2006 Wind River System, Inc.
7# Author: Rongkai.Zhan <rongkai.zhan@windriver.com>
8#
9# Makefile for the Wind River MIPS 4KC PPMC Eval Board
10#
11
12obj-y += int-handler.o irq.o reset.o setup.o time.o pci.o
13
14EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/gt64120/wrppmc/int-handler.S b/arch/mips/gt64120/wrppmc/int-handler.S
new file mode 100644
index 000000000000..edee7b394175
--- /dev/null
+++ b/arch/mips/gt64120/wrppmc/int-handler.S
@@ -0,0 +1,59 @@
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) Wind River System Inc. Rongkai.Zhan <rongkai.zhan@windriver.com>
8 */
9#include <asm/asm.h>
10#include <asm/mipsregs.h>
11#include <asm/addrspace.h>
12#include <asm/regdef.h>
13#include <asm/stackframe.h>
14#include <asm/mach-wrppmc/mach-gt64120.h>
15
16 .align 5
17 .set noat
18NESTED(handle_IRQ, PT_SIZE, sp)
19 SAVE_ALL
20 CLI # Important: mark KERNEL mode !
21 .set at
22
23 mfc0 t0, CP0_CAUSE # get pending interrupts
24 mfc0 t1, CP0_STATUS # get enabled interrupts
25 and t0, t0, t1 # get allowed interrupts
26 andi t0, t0, 0xFF00
27 beqz t0, 1f
28 move a1, sp # Prepare 'struct pt_regs *regs' pointer
29
30 andi t1, t0, CAUSEF_IP7 # CPU Compare/Count internal timer
31 bnez t1, handle_cputimer_irq
32 andi t1, t0, CAUSEF_IP6 # UART 16550 port
33 bnez t1, handle_uart_irq
34 andi t1, t0, CAUSEF_IP3 # PCI INT_A
35 bnez t1, handle_pci_intA_irq
36
37 /* wrong alarm or masked ... */
381: j spurious_interrupt
39 nop
40END(handle_IRQ)
41
42 .align 5
43handle_cputimer_irq:
44 li a0, WRPPMC_MIPS_TIMER_IRQ
45 jal do_IRQ
46 j ret_from_irq
47
48 .align 5
49handle_uart_irq:
50 li a0, WRPPMC_UART16550_IRQ
51 jal do_IRQ
52 j ret_from_irq
53
54 .align 5
55handle_pci_intA_irq:
56 li a0, WRPPMC_PCI_INTA_IRQ
57 jal do_IRQ
58 j ret_from_irq
59
diff --git a/arch/mips/gt64120/wrppmc/irq.c b/arch/mips/gt64120/wrppmc/irq.c
new file mode 100644
index 000000000000..8605687e24ed
--- /dev/null
+++ b/arch/mips/gt64120/wrppmc/irq.c
@@ -0,0 +1,63 @@
1/*
2 * irq.c: GT64120 Interrupt Controller
3 *
4 * Copyright (C) 2006, Wind River System Inc.
5 * Author: Rongkai.Zhan, <rongkai.zhan@windriver.com>
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 <linux/errno.h>
13#include <linux/init.h>
14#include <linux/kernel_stat.h>
15#include <linux/module.h>
16#include <linux/signal.h>
17#include <linux/sched.h>
18#include <linux/types.h>
19#include <linux/interrupt.h>
20#include <linux/ioport.h>
21#include <linux/timex.h>
22#include <linux/slab.h>
23#include <linux/random.h>
24#include <linux/bitops.h>
25#include <asm/bootinfo.h>
26#include <asm/io.h>
27#include <asm/bitops.h>
28#include <asm/mipsregs.h>
29#include <asm/system.h>
30#include <asm/irq_cpu.h>
31#include <asm/gt64120.h>
32
33extern asmlinkage void handle_IRQ(void);
34
35/**
36 * Initialize GT64120 Interrupt Controller
37 */
38void gt64120_init_pic(void)
39{
40 /* clear CPU Interrupt Cause Registers */
41 GT_WRITE(GT_INTRCAUSE_OFS, (0x1F << 21));
42 GT_WRITE(GT_HINTRCAUSE_OFS, 0x00);
43
44 /* Disable all interrupts from GT64120 bridge chip */
45 GT_WRITE(GT_INTRMASK_OFS, 0x00);
46 GT_WRITE(GT_HINTRMASK_OFS, 0x00);
47 GT_WRITE(GT_PCI0_ICMASK_OFS, 0x00);
48 GT_WRITE(GT_PCI0_HICMASK_OFS, 0x00);
49}
50
51void __init arch_init_irq(void)
52{
53 /* enable all CPU interrupt bits. */
54 set_c0_status(ST0_IM); /* IE bit is still 0 */
55
56 /* Install MIPS Interrupt Trap Vector */
57 set_except_vector(0, handle_IRQ);
58
59 /* IRQ 0 - 7 are for MIPS common irq_cpu controller */
60 mips_cpu_irq_init(0);
61
62 gt64120_init_pic();
63}
diff --git a/arch/mips/gt64120/wrppmc/pci.c b/arch/mips/gt64120/wrppmc/pci.c
new file mode 100644
index 000000000000..2fbe93467f78
--- /dev/null
+++ b/arch/mips/gt64120/wrppmc/pci.c
@@ -0,0 +1,53 @@
1/*
2 * pci.c: GT64120 PCI support.
3 *
4 * Copyright (C) 2006, Wind River System Inc. Rongkai.Zhan <rongkai.zhan@windriver.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/types.h>
12#include <linux/pci.h>
13#include <linux/kernel.h>
14#include <asm/gt64120.h>
15
16extern struct pci_ops gt64120_pci_ops;
17
18static struct resource pci0_io_resource = {
19 .name = "pci_0 io",
20 .start = GT_PCI_IO_BASE,
21 .end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1,
22 .flags = IORESOURCE_IO,
23};
24
25static struct resource pci0_mem_resource = {
26 .name = "pci_0 memory",
27 .start = GT_PCI_MEM_BASE,
28 .end = GT_PCI_MEM_BASE + GT_PCI_MEM_SIZE - 1,
29 .flags = IORESOURCE_MEM,
30};
31
32static struct pci_controller hose_0 = {
33 .pci_ops = &gt64120_pci_ops,
34 .io_resource = &pci0_io_resource,
35 .mem_resource = &pci0_mem_resource,
36};
37
38static int __init gt64120_pci_init(void)
39{
40 u32 tmp;
41
42 tmp = GT_READ(GT_PCI0_CMD_OFS); /* Huh??? -- Ralf */
43 tmp = GT_READ(GT_PCI0_BARE_OFS);
44
45 /* reset the whole PCI I/O space range */
46 ioport_resource.start = GT_PCI_IO_BASE;
47 ioport_resource.end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1;
48
49 register_pci_controller(&hose_0);
50 return 0;
51}
52
53arch_initcall(gt64120_pci_init);
diff --git a/arch/mips/gt64120/wrppmc/reset.c b/arch/mips/gt64120/wrppmc/reset.c
new file mode 100644
index 000000000000..b97039c6d3db
--- /dev/null
+++ b/arch/mips/gt64120/wrppmc/reset.c
@@ -0,0 +1,50 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1997 Ralf Baechle
7 */
8#include <linux/sched.h>
9#include <linux/mm.h>
10#include <asm/io.h>
11#include <asm/pgtable.h>
12#include <asm/processor.h>
13#include <asm/reboot.h>
14#include <asm/system.h>
15#include <asm/cacheflush.h>
16
17void wrppmc_machine_restart(char *command)
18{
19 /*
20 * Ouch, we're still alive ... This time we take the silver bullet ...
21 * ... and find that we leave the hardware in a state in which the
22 * kernel in the flush locks up somewhen during of after the PCI
23 * detection stuff.
24 */
25 local_irq_disable();
26 set_c0_status(ST0_BEV | ST0_ERL);
27 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
28 flush_cache_all();
29 write_c0_wired(0);
30 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
31}
32
33void wrppmc_machine_halt(void)
34{
35 local_irq_disable();
36
37 printk(KERN_NOTICE "You can safely turn off the power\n");
38 while (1) {
39 __asm__(
40 ".set\tmips3\n\t"
41 "wait\n\t"
42 ".set\tmips0"
43 );
44 }
45}
46
47void wrppmc_machine_power_off(void)
48{
49 wrppmc_machine_halt();
50}
diff --git a/arch/mips/gt64120/wrppmc/setup.c b/arch/mips/gt64120/wrppmc/setup.c
new file mode 100644
index 000000000000..20c591e49dae
--- /dev/null
+++ b/arch/mips/gt64120/wrppmc/setup.c
@@ -0,0 +1,173 @@
1/*
2 * setup.c: Setup pointers to hardware dependent routines.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2006, Wind River System Inc. Rongkai.zhan <rongkai.zhan@windriver.com>
10 */
11#include <linux/config.h>
12#include <linux/init.h>
13#include <linux/string.h>
14#include <linux/kernel.h>
15#include <linux/tty.h>
16#include <linux/serial.h>
17#include <linux/serial_core.h>
18#include <linux/pm.h>
19
20#include <asm/io.h>
21#include <asm/bootinfo.h>
22#include <asm/reboot.h>
23#include <asm/time.h>
24#include <asm/gt64120.h>
25
26unsigned long gt64120_base = KSEG1ADDR(0x14000000);
27
28#ifdef WRPPMC_EARLY_DEBUG
29
30static volatile unsigned char * wrppmc_led = \
31 (volatile unsigned char *)KSEG1ADDR(WRPPMC_LED_BASE);
32
33/*
34 * PPMC LED control register:
35 * -) bit[0] controls DS1 LED (1 - OFF, 0 - ON)
36 * -) bit[1] controls DS2 LED (1 - OFF, 0 - ON)
37 * -) bit[2] controls DS4 LED (1 - OFF, 0 - ON)
38 */
39void wrppmc_led_on(int mask)
40{
41 unsigned char value = *wrppmc_led;
42
43 value &= (0xF8 | mask);
44 *wrppmc_led = value;
45}
46
47/* If mask = 0, turn off all LEDs */
48void wrppmc_led_off(int mask)
49{
50 unsigned char value = *wrppmc_led;
51
52 value |= (0x7 & mask);
53 *wrppmc_led = value;
54}
55
56/*
57 * We assume that bootloader has initialized UART16550 correctly
58 */
59void __init wrppmc_early_putc(char ch)
60{
61 static volatile unsigned char *wrppmc_uart = \
62 (volatile unsigned char *)KSEG1ADDR(WRPPMC_UART16550_BASE);
63 unsigned char value;
64
65 /* Wait until Transmit-Holding-Register is empty */
66 while (1) {
67 value = *(wrppmc_uart + 5);
68 if (value & 0x20)
69 break;
70 }
71
72 *wrppmc_uart = ch;
73}
74
75void __init wrppmc_early_printk(const char *fmt, ...)
76{
77 static char pbuf[256] = {'\0', };
78 char *ch = pbuf;
79 va_list args;
80 unsigned int i;
81
82 memset(pbuf, 0, 256);
83 va_start(args, fmt);
84 i = vsprintf(pbuf, fmt, args);
85 va_end(args);
86
87 /* Print the string */
88 while (*ch != '\0') {
89 wrppmc_early_putc(*ch);
90 /* if print '\n', also print '\r' */
91 if (*ch++ == '\n')
92 wrppmc_early_putc('\r');
93 }
94}
95#endif /* WRPPMC_EARLY_DEBUG */
96
97unsigned long __init prom_free_prom_memory(void)
98{
99 return 0;
100}
101
102#ifdef CONFIG_SERIAL_8250
103static void wrppmc_setup_serial(void)
104{
105 struct uart_port up;
106
107 memset(&up, 0x00, sizeof(struct uart_port));
108
109 /*
110 * A note about mapbase/membase
111 * -) mapbase is the physical address of the IO port.
112 * -) membase is an 'ioremapped' cookie.
113 */
114 up.line = 0;
115 up.type = PORT_16550;
116 up.iotype = UPIO_MEM;
117 up.mapbase = WRPPMC_UART16550_BASE;
118 up.membase = ioremap(up.mapbase, 8);
119 up.irq = WRPPMC_UART16550_IRQ;
120 up.uartclk = WRPPMC_UART16550_CLOCK;
121 up.flags = UPF_SKIP_TEST/* | UPF_BOOT_AUTOCONF */;
122 up.regshift = 0;
123
124 early_serial_setup(&up);
125}
126#endif
127
128void __init plat_setup(void)
129{
130 extern void wrppmc_time_init(void);
131 extern void wrppmc_timer_setup(struct irqaction *);
132 extern void wrppmc_machine_restart(char *command);
133 extern void wrppmc_machine_halt(void);
134 extern void wrppmc_machine_power_off(void);
135
136 _machine_restart = wrppmc_machine_restart;
137 _machine_halt = wrppmc_machine_halt;
138 pm_power_off = wrppmc_machine_power_off;
139
140 /* Use MIPS Count/Compare Timer */
141 board_time_init = wrppmc_time_init;
142 board_timer_setup = wrppmc_timer_setup;
143
144 /* This makes the operations of 'in/out[bwl]' to the
145 * physical address ( < KSEG0) can work via KSEG1
146 */
147 set_io_port_base(KSEG1);
148
149#ifdef CONFIG_SERIAL_8250
150 wrppmc_setup_serial();
151#endif
152}
153
154const char *get_system_type(void)
155{
156 return "Wind River PPMC (GT64120)";
157}
158
159/*
160 * Initializes basic routines and structures pointers, memory size (as
161 * given by the bios and saves the command line.
162 */
163void __init prom_init(void)
164{
165 mips_machgroup = MACH_GROUP_GALILEO;
166 mips_machtype = MACH_EV64120A;
167
168 add_memory_region(WRPPMC_SDRAM_SCS0_BASE, WRPPMC_SDRAM_SCS0_SIZE, BOOT_MEM_RAM);
169 add_memory_region(WRPPMC_BOOTROM_BASE, WRPPMC_BOOTROM_SIZE, BOOT_MEM_ROM_DATA);
170
171 wrppmc_early_printk("prom_init: GT64120 SDRAM Bank 0: 0x%x - 0x%08lx\n",
172 WRPPMC_SDRAM_SCS0_BASE, (WRPPMC_SDRAM_SCS0_BASE + WRPPMC_SDRAM_SCS0_SIZE));
173}
diff --git a/arch/mips/gt64120/wrppmc/time.c b/arch/mips/gt64120/wrppmc/time.c
new file mode 100644
index 000000000000..175d22adb450
--- /dev/null
+++ b/arch/mips/gt64120/wrppmc/time.c
@@ -0,0 +1,57 @@
1/*
2 * time.c: MIPS CPU Count/Compare timer hookup
3 *
4 * Author: Mark.Zhan, <rongkai.zhan@windriver.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
11 * Copyright (C) 2006, Wind River System Inc.
12 */
13#include <linux/config.h>
14#include <linux/init.h>
15#include <linux/string.h>
16#include <linux/kernel.h>
17#include <linux/param.h> /* for HZ */
18#include <linux/irq.h>
19#include <linux/timex.h>
20#include <linux/interrupt.h>
21
22#include <asm/reboot.h>
23#include <asm/time.h>
24#include <asm/io.h>
25#include <asm/bootinfo.h>
26#include <asm/gt64120.h>
27
28#define WRPPMC_CPU_CLK_FREQ 40000000 /* 40MHZ */
29
30void __init wrppmc_timer_setup(struct irqaction *irq)
31{
32 /* Install ISR for timer interrupt */
33 setup_irq(WRPPMC_MIPS_TIMER_IRQ, irq);
34
35 /* to generate the first timer interrupt */
36 write_c0_compare(mips_hpt_frequency/HZ);
37 write_c0_count(0);
38}
39
40/*
41 * Estimate CPU frequency. Sets mips_hpt_frequency as a side-effect
42 *
43 * NOTE: We disable all GT64120 timers, and use MIPS processor internal
44 * timer as the source of kernel clock tick.
45 */
46void __init wrppmc_time_init(void)
47{
48 /* Disable GT64120 timers */
49 GT_WRITE(GT_TC_CONTROL_OFS, 0x00);
50 GT_WRITE(GT_TC0_OFS, 0x00);
51 GT_WRITE(GT_TC1_OFS, 0x00);
52 GT_WRITE(GT_TC2_OFS, 0x00);
53 GT_WRITE(GT_TC3_OFS, 0x00);
54
55 /* Use MIPS compare/count internal timer */
56 mips_hpt_frequency = WRPPMC_CPU_CLK_FREQ;
57}
diff --git a/arch/mips/ite-boards/generic/it8172_setup.c b/arch/mips/ite-boards/generic/it8172_setup.c
index fc73c8d69df7..da6ae0991199 100644
--- a/arch/mips/ite-boards/generic/it8172_setup.c
+++ b/arch/mips/ite-boards/generic/it8172_setup.c
@@ -72,11 +72,29 @@ struct {
72 struct resource flash; 72 struct resource flash;
73 struct resource boot; 73 struct resource boot;
74} it8172_resources = { 74} it8172_resources = {
75 { "RAM", 0, 0, IORESOURCE_MEM }, /* to be initted */ 75 {
76 { "PCI Mem", 0x10000000, 0x13FFFFFF, IORESOURCE_MEM }, 76 .start = 0, /* to be initted */
77 { "PCI I/O", 0x14000000, 0x17FFFFFF }, 77 .end = 0,
78 { "Flash", 0x08000000, 0x0CFFFFFF }, 78 .name = "RAM",
79 { "Boot ROM", 0x1FC00000, 0x1FFFFFFF } 79 .flags = IORESOURCE_MEM
80 }, {
81 .start = 0x10000000,
82 .end = 0x13FFFFFF,
83 .name = "PCI Mem",
84 .flags = IORESOURCE_MEM
85 }, {
86 .start = 0x14000000,
87 .end = 0x17FFFFFF
88 .name = "PCI I/O",
89 }, {
90 .start = 0x08000000,
91 .end = 0x0CFFFFFF
92 .name = "Flash",
93 }, {
94 .start = 0x1FC00000,
95 .end = 0x1FFFFFFF
96 .name = "Boot ROM",
97 }
80}; 98};
81#else 99#else
82struct { 100struct {
@@ -89,14 +107,44 @@ struct {
89 struct resource flash; 107 struct resource flash;
90 struct resource boot; 108 struct resource boot;
91} it8172_resources = { 109} it8172_resources = {
92 { "RAM", 0, 0, IORESOURCE_MEM }, /* to be initted */ 110 {
93 { "PCI Mem0", 0x0C000000, 0x0FFFFFFF, IORESOURCE_MEM }, 111 .start = 0, /* to be initted */
94 { "PCI Mem1", 0x10000000, 0x13FFFFFF, IORESOURCE_MEM }, 112 .end = 0,
95 { "PCI I/O", 0x14000000, 0x17FFFFFF }, 113 .name = "RAM",
96 { "PCI Mem2", 0x1A000000, 0x1BFFFFFF, IORESOURCE_MEM }, 114 .flags = IORESOURCE_MEM
97 { "PCI Mem3", 0x1C000000, 0x1FBFFFFF, IORESOURCE_MEM }, 115 }, {
98 { "Flash", 0x08000000, 0x0CFFFFFF }, 116 .start = 0x0C000000,
99 { "Boot ROM", 0x1FC00000, 0x1FFFFFFF } 117 .end = 0x0FFFFFFF,
118 .name = "PCI Mem0",
119 .flags = IORESOURCE_MEM
120 }, {
121 .start = 0x10000000,
122 .end = 0x13FFFFFF,
123 .name = "PCI Mem1",
124 .flags = IORESOURCE_MEM
125 }, {
126 .start = 0x14000000,
127 .end = 0x17FFFFFF
128 .name = "PCI I/O",
129 }, {
130 .start = 0x1A000000,
131 .end = 0x1BFFFFFF,
132 .name = "PCI Mem2",
133 .flags = IORESOURCE_MEM
134 }, {
135 .start = 0x1C000000,
136 .end = 0x1FBFFFFF,
137 .name = "PCI Mem3",
138 .flags = IORESOURCE_MEM
139 }, {
140 .start = 0x08000000,
141 .end = 0x0CFFFFFF
142 .name = "Flash",
143 }, {
144 .start = 0x1FC00000,
145 .end = 0x1FFFFFFF
146 .name = "Boot ROM",
147 }
100}; 148};
101#endif 149#endif
102 150
@@ -106,7 +154,7 @@ void __init it8172_init_ram_resource(unsigned long memsize)
106 it8172_resources.ram.end = memsize; 154 it8172_resources.ram.end = memsize;
107} 155}
108 156
109void __init plat_setup(void) 157void __init plat_mem_setup(void)
110{ 158{
111 unsigned short dsr; 159 unsigned short dsr;
112 char *argptr; 160 char *argptr;
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index 4036dc434551..c8d0df7d0c36 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -52,7 +52,7 @@ static struct resource jazz_io_resources[] = {
52 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, 52 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
53}; 53};
54 54
55void __init plat_setup(void) 55void __init plat_mem_setup(void)
56{ 56{
57 int i; 57 int i;
58 58
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 9359cc413494..308e6cdcd245 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -82,17 +82,54 @@ struct {
82 struct resource sio0; 82 struct resource sio0;
83 struct resource sio1; 83 struct resource sio1;
84} jmr3927_resources = { 84} jmr3927_resources = {
85 { "RAM0", 0, 0x01FFFFFF, IORESOURCE_MEM }, 85 {
86 { "RAM1", 0x02000000, 0x03FFFFFF, IORESOURCE_MEM }, 86 .start = 0,
87 { "PCIMEM", 0x08000000, 0x07FFFFFF, IORESOURCE_MEM }, 87 .end = 0x01FFFFFF,
88 { "IOB", 0x10000000, 0x13FFFFFF }, 88 .name = "RAM0",
89 { "IOC", 0x14000000, 0x14FFFFFF }, 89 .flags = IORESOURCE_MEM
90 { "PCIIO", 0x15000000, 0x15FFFFFF }, 90 }, {
91 { "JMY1394", 0x1D000000, 0x1D3FFFFF }, 91 .start = 0x02000000,
92 { "ROM1", 0x1E000000, 0x1E3FFFFF }, 92 .end = 0x03FFFFFF,
93 { "ROM0", 0x1FC00000, 0x1FFFFFFF }, 93 .name = "RAM1",
94 { "SIO0", 0xFFFEF300, 0xFFFEF3FF }, 94 .flags = IORESOURCE_MEM
95 { "SIO1", 0xFFFEF400, 0xFFFEF4FF }, 95 }, {
96 .start = 0x08000000,
97 .end = 0x07FFFFFF,
98 .name = "PCIMEM",
99 .flags = IORESOURCE_MEM
100 }, {
101 .start = 0x10000000,
102 .end = 0x13FFFFFF,
103 .name = "IOB"
104 }, {
105 .start = 0x14000000,
106 .end = 0x14FFFFFF,
107 .name = "IOC"
108 }, {
109 .start = 0x15000000,
110 .end = 0x15FFFFFF,
111 .name = "PCIIO"
112 }, {
113 .start = 0x1D000000,
114 .end = 0x1D3FFFFF,
115 .name = "JMY1394"
116 }, {
117 .start = 0x1E000000,
118 .end = 0x1E3FFFFF,
119 .name = "ROM1"
120 }, {
121 .start = 0x1FC00000,
122 .end = 0x1FFFFFFF,
123 .name = "ROM0"
124 }, {
125 .start = 0xFFFEF300,
126 .end = 0xFFFEF3FF,
127 .name = "SIO0"
128 }, {
129 .start = 0xFFFEF400,
130 .end = 0xFFFEF4FF,
131 .name = "SIO1"
132 },
96}; 133};
97 134
98/* don't enable - see errata */ 135/* don't enable - see errata */
@@ -201,7 +238,7 @@ static void jmr3927_board_init(void);
201extern struct resource pci_io_resource; 238extern struct resource pci_io_resource;
202extern struct resource pci_mem_resource; 239extern struct resource pci_mem_resource;
203 240
204void __init plat_setup(void) 241void __init plat_mem_setup(void)
205{ 242{
206 char *argptr; 243 char *argptr;
207 244
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 34e8a256765c..881c467c6982 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -13,6 +13,8 @@ binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
13 13
14obj-$(CONFIG_MODULES) += mips_ksyms.o module.o 14obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
15 15
16obj-$(CONFIG_APM) += apm.o
17
16obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o 18obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o
17obj-$(CONFIG_CPU_TX39XX) += r2300_fpu.o r2300_switch.o 19obj-$(CONFIG_CPU_TX39XX) += r2300_fpu.o r2300_switch.o
18obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o 20obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
diff --git a/arch/mips/kernel/apm.c b/arch/mips/kernel/apm.c
new file mode 100644
index 000000000000..15f46b4471fd
--- /dev/null
+++ b/arch/mips/kernel/apm.c
@@ -0,0 +1,605 @@
1/*
2 * bios-less APM driver for MIPS Linux
3 * Jamey Hicks <jamey@crl.dec.com>
4 * adapted from the APM BIOS driver for Linux by Stephen Rothwell (sfr@linuxcare.com)
5 *
6 * APM 1.2 Reference:
7 * Intel Corporation, Microsoft Corporation. Advanced Power Management
8 * (APM) BIOS Interface Specification, Revision 1.2, February 1996.
9 *
10 * [This document is available from Microsoft at:
11 * http://www.microsoft.com/hwdev/busbios/amp_12.htm]
12 */
13#include <linux/config.h>
14#include <linux/module.h>
15#include <linux/poll.h>
16#include <linux/timer.h>
17#include <linux/slab.h>
18#include <linux/proc_fs.h>
19#include <linux/miscdevice.h>
20#include <linux/apm_bios.h>
21#include <linux/capability.h>
22#include <linux/sched.h>
23#include <linux/pm.h>
24#include <linux/device.h>
25#include <linux/kernel.h>
26#include <linux/list.h>
27#include <linux/init.h>
28#include <linux/completion.h>
29
30#include <asm/apm.h> /* apm_power_info */
31#include <asm/system.h>
32
33/*
34 * The apm_bios device is one of the misc char devices.
35 * This is its minor number.
36 */
37#define APM_MINOR_DEV 134
38
39/*
40 * See Documentation/Config.help for the configuration options.
41 *
42 * Various options can be changed at boot time as follows:
43 * (We allow underscores for compatibility with the modules code)
44 * apm=on/off enable/disable APM
45 */
46
47/*
48 * Maximum number of events stored
49 */
50#define APM_MAX_EVENTS 16
51
52struct apm_queue {
53 unsigned int event_head;
54 unsigned int event_tail;
55 apm_event_t events[APM_MAX_EVENTS];
56};
57
58/*
59 * The per-file APM data
60 */
61struct apm_user {
62 struct list_head list;
63
64 unsigned int suser: 1;
65 unsigned int writer: 1;
66 unsigned int reader: 1;
67
68 int suspend_result;
69 unsigned int suspend_state;
70#define SUSPEND_NONE 0 /* no suspend pending */
71#define SUSPEND_PENDING 1 /* suspend pending read */
72#define SUSPEND_READ 2 /* suspend read, pending ack */
73#define SUSPEND_ACKED 3 /* suspend acked */
74#define SUSPEND_DONE 4 /* suspend completed */
75
76 struct apm_queue queue;
77};
78
79/*
80 * Local variables
81 */
82static int suspends_pending;
83static int apm_disabled;
84static int mips_apm_active;
85
86static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
87static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
88
89/*
90 * This is a list of everyone who has opened /dev/apm_bios
91 */
92static DECLARE_RWSEM(user_list_lock);
93static LIST_HEAD(apm_user_list);
94
95/*
96 * kapmd info. kapmd provides us a process context to handle
97 * "APM" events within - specifically necessary if we're going
98 * to be suspending the system.
99 */
100static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait);
101static DECLARE_COMPLETION(kapmd_exit);
102static DEFINE_SPINLOCK(kapmd_queue_lock);
103static struct apm_queue kapmd_queue;
104
105
106static const char driver_version[] = "1.13"; /* no spaces */
107
108
109
110/*
111 * Compatibility cruft until the IPAQ people move over to the new
112 * interface.
113 */
114static void __apm_get_power_status(struct apm_power_info *info)
115{
116}
117
118/*
119 * This allows machines to provide their own "apm get power status" function.
120 */
121void (*apm_get_power_status)(struct apm_power_info *) = __apm_get_power_status;
122EXPORT_SYMBOL(apm_get_power_status);
123
124
125/*
126 * APM event queue management.
127 */
128static inline int queue_empty(struct apm_queue *q)
129{
130 return q->event_head == q->event_tail;
131}
132
133static inline apm_event_t queue_get_event(struct apm_queue *q)
134{
135 q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS;
136 return q->events[q->event_tail];
137}
138
139static void queue_add_event(struct apm_queue *q, apm_event_t event)
140{
141 q->event_head = (q->event_head + 1) % APM_MAX_EVENTS;
142 if (q->event_head == q->event_tail) {
143 static int notified;
144
145 if (notified++ == 0)
146 printk(KERN_ERR "apm: an event queue overflowed\n");
147 q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS;
148 }
149 q->events[q->event_head] = event;
150}
151
152static void queue_event_one_user(struct apm_user *as, apm_event_t event)
153{
154 if (as->suser && as->writer) {
155 switch (event) {
156 case APM_SYS_SUSPEND:
157 case APM_USER_SUSPEND:
158 /*
159 * If this user already has a suspend pending,
160 * don't queue another one.
161 */
162 if (as->suspend_state != SUSPEND_NONE)
163 return;
164
165 as->suspend_state = SUSPEND_PENDING;
166 suspends_pending++;
167 break;
168 }
169 }
170 queue_add_event(&as->queue, event);
171}
172
173static void queue_event(apm_event_t event, struct apm_user *sender)
174{
175 struct apm_user *as;
176
177 down_read(&user_list_lock);
178 list_for_each_entry(as, &apm_user_list, list) {
179 if (as != sender && as->reader)
180 queue_event_one_user(as, event);
181 }
182 up_read(&user_list_lock);
183 wake_up_interruptible(&apm_waitqueue);
184}
185
186static void apm_suspend(void)
187{
188 struct apm_user *as;
189 int err = pm_suspend(PM_SUSPEND_MEM);
190
191 /*
192 * Anyone on the APM queues will think we're still suspended.
193 * Send a message so everyone knows we're now awake again.
194 */
195 queue_event(APM_NORMAL_RESUME, NULL);
196
197 /*
198 * Finally, wake up anyone who is sleeping on the suspend.
199 */
200 down_read(&user_list_lock);
201 list_for_each_entry(as, &apm_user_list, list) {
202 as->suspend_result = err;
203 as->suspend_state = SUSPEND_DONE;
204 }
205 up_read(&user_list_lock);
206
207 wake_up(&apm_suspend_waitqueue);
208}
209
210static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos)
211{
212 struct apm_user *as = fp->private_data;
213 apm_event_t event;
214 int i = count, ret = 0;
215
216 if (count < sizeof(apm_event_t))
217 return -EINVAL;
218
219 if (queue_empty(&as->queue) && fp->f_flags & O_NONBLOCK)
220 return -EAGAIN;
221
222 wait_event_interruptible(apm_waitqueue, !queue_empty(&as->queue));
223
224 while ((i >= sizeof(event)) && !queue_empty(&as->queue)) {
225 event = queue_get_event(&as->queue);
226
227 ret = -EFAULT;
228 if (copy_to_user(buf, &event, sizeof(event)))
229 break;
230
231 if (event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND)
232 as->suspend_state = SUSPEND_READ;
233
234 buf += sizeof(event);
235 i -= sizeof(event);
236 }
237
238 if (i < count)
239 ret = count - i;
240
241 return ret;
242}
243
244static unsigned int apm_poll(struct file *fp, poll_table * wait)
245{
246 struct apm_user *as = fp->private_data;
247
248 poll_wait(fp, &apm_waitqueue, wait);
249 return queue_empty(&as->queue) ? 0 : POLLIN | POLLRDNORM;
250}
251
252/*
253 * apm_ioctl - handle APM ioctl
254 *
255 * APM_IOC_SUSPEND
256 * This IOCTL is overloaded, and performs two functions. It is used to:
257 * - initiate a suspend
258 * - acknowledge a suspend read from /dev/apm_bios.
259 * Only when everyone who has opened /dev/apm_bios with write permission
260 * has acknowledge does the actual suspend happen.
261 */
262static int
263apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
264{
265 struct apm_user *as = filp->private_data;
266 unsigned long flags;
267 int err = -EINVAL;
268
269 if (!as->suser || !as->writer)
270 return -EPERM;
271
272 switch (cmd) {
273 case APM_IOC_SUSPEND:
274 as->suspend_result = -EINTR;
275
276 if (as->suspend_state == SUSPEND_READ) {
277 /*
278 * If we read a suspend command from /dev/apm_bios,
279 * then the corresponding APM_IOC_SUSPEND ioctl is
280 * interpreted as an acknowledge.
281 */
282 as->suspend_state = SUSPEND_ACKED;
283 suspends_pending--;
284 } else {
285 /*
286 * Otherwise it is a request to suspend the system.
287 * Queue an event for all readers, and expect an
288 * acknowledge from all writers who haven't already
289 * acknowledged.
290 */
291 queue_event(APM_USER_SUSPEND, as);
292 }
293
294 /*
295 * If there are no further acknowledges required, suspend
296 * the system.
297 */
298 if (suspends_pending == 0)
299 apm_suspend();
300
301 /*
302 * Wait for the suspend/resume to complete. If there are
303 * pending acknowledges, we wait here for them.
304 *
305 * Note that we need to ensure that the PM subsystem does
306 * not kick us out of the wait when it suspends the threads.
307 */
308 flags = current->flags;
309 current->flags |= PF_NOFREEZE;
310
311 /*
312 * Note: do not allow a thread which is acking the suspend
313 * to escape until the resume is complete.
314 */
315 if (as->suspend_state == SUSPEND_ACKED)
316 wait_event(apm_suspend_waitqueue,
317 as->suspend_state == SUSPEND_DONE);
318 else
319 wait_event_interruptible(apm_suspend_waitqueue,
320 as->suspend_state == SUSPEND_DONE);
321
322 current->flags = flags;
323 err = as->suspend_result;
324 as->suspend_state = SUSPEND_NONE;
325 break;
326 }
327
328 return err;
329}
330
331static int apm_release(struct inode * inode, struct file * filp)
332{
333 struct apm_user *as = filp->private_data;
334 filp->private_data = NULL;
335
336 down_write(&user_list_lock);
337 list_del(&as->list);
338 up_write(&user_list_lock);
339
340 /*
341 * We are now unhooked from the chain. As far as new
342 * events are concerned, we no longer exist. However, we
343 * need to balance suspends_pending, which means the
344 * possibility of sleeping.
345 */
346 if (as->suspend_state != SUSPEND_NONE) {
347 suspends_pending -= 1;
348 if (suspends_pending == 0)
349 apm_suspend();
350 }
351
352 kfree(as);
353 return 0;
354}
355
356static int apm_open(struct inode * inode, struct file * filp)
357{
358 struct apm_user *as;
359
360 as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL);
361 if (as) {
362 /*
363 * XXX - this is a tiny bit broken, when we consider BSD
364 * process accounting. If the device is opened by root, we
365 * instantly flag that we used superuser privs. Who knows,
366 * we might close the device immediately without doing a
367 * privileged operation -- cevans
368 */
369 as->suser = capable(CAP_SYS_ADMIN);
370 as->writer = (filp->f_mode & FMODE_WRITE) == FMODE_WRITE;
371 as->reader = (filp->f_mode & FMODE_READ) == FMODE_READ;
372
373 down_write(&user_list_lock);
374 list_add(&as->list, &apm_user_list);
375 up_write(&user_list_lock);
376
377 filp->private_data = as;
378 }
379
380 return as ? 0 : -ENOMEM;
381}
382
383static struct file_operations apm_bios_fops = {
384 .owner = THIS_MODULE,
385 .read = apm_read,
386 .poll = apm_poll,
387 .ioctl = apm_ioctl,
388 .open = apm_open,
389 .release = apm_release,
390};
391
392static struct miscdevice apm_device = {
393 .minor = APM_MINOR_DEV,
394 .name = "apm_bios",
395 .fops = &apm_bios_fops
396};
397
398
399#ifdef CONFIG_PROC_FS
400/*
401 * Arguments, with symbols from linux/apm_bios.h.
402 *
403 * 0) Linux driver version (this will change if format changes)
404 * 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
405 * 2) APM flags from APM Installation Check (0x00):
406 * bit 0: APM_16_BIT_SUPPORT
407 * bit 1: APM_32_BIT_SUPPORT
408 * bit 2: APM_IDLE_SLOWS_CLOCK
409 * bit 3: APM_BIOS_DISABLED
410 * bit 4: APM_BIOS_DISENGAGED
411 * 3) AC line status
412 * 0x00: Off-line
413 * 0x01: On-line
414 * 0x02: On backup power (BIOS >= 1.1 only)
415 * 0xff: Unknown
416 * 4) Battery status
417 * 0x00: High
418 * 0x01: Low
419 * 0x02: Critical
420 * 0x03: Charging
421 * 0x04: Selected battery not present (BIOS >= 1.2 only)
422 * 0xff: Unknown
423 * 5) Battery flag
424 * bit 0: High
425 * bit 1: Low
426 * bit 2: Critical
427 * bit 3: Charging
428 * bit 7: No system battery
429 * 0xff: Unknown
430 * 6) Remaining battery life (percentage of charge):
431 * 0-100: valid
432 * -1: Unknown
433 * 7) Remaining battery life (time units):
434 * Number of remaining minutes or seconds
435 * -1: Unknown
436 * 8) min = minutes; sec = seconds
437 */
438static int apm_get_info(char *buf, char **start, off_t fpos, int length)
439{
440 struct apm_power_info info;
441 char *units;
442 int ret;
443
444 info.ac_line_status = 0xff;
445 info.battery_status = 0xff;
446 info.battery_flag = 0xff;
447 info.battery_life = -1;
448 info.time = -1;
449 info.units = -1;
450
451 if (apm_get_power_status)
452 apm_get_power_status(&info);
453
454 switch (info.units) {
455 default: units = "?"; break;
456 case 0: units = "min"; break;
457 case 1: units = "sec"; break;
458 }
459
460 ret = sprintf(buf, "%s 1.2 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
461 driver_version, APM_32_BIT_SUPPORT,
462 info.ac_line_status, info.battery_status,
463 info.battery_flag, info.battery_life,
464 info.time, units);
465
466 return ret;
467}
468#endif
469
470static int kapmd(void *arg)
471{
472 daemonize("kapmd");
473 current->flags |= PF_NOFREEZE;
474
475 do {
476 apm_event_t event;
477
478 wait_event_interruptible(kapmd_wait,
479 !queue_empty(&kapmd_queue) || !mips_apm_active);
480
481 if (!mips_apm_active)
482 break;
483
484 spin_lock_irq(&kapmd_queue_lock);
485 event = 0;
486 if (!queue_empty(&kapmd_queue))
487 event = queue_get_event(&kapmd_queue);
488 spin_unlock_irq(&kapmd_queue_lock);
489
490 switch (event) {
491 case 0:
492 break;
493
494 case APM_LOW_BATTERY:
495 case APM_POWER_STATUS_CHANGE:
496 queue_event(event, NULL);
497 break;
498
499 case APM_USER_SUSPEND:
500 case APM_SYS_SUSPEND:
501 queue_event(event, NULL);
502 if (suspends_pending == 0)
503 apm_suspend();
504 break;
505
506 case APM_CRITICAL_SUSPEND:
507 apm_suspend();
508 break;
509 }
510 } while (1);
511
512 complete_and_exit(&kapmd_exit, 0);
513}
514
515static int __init apm_init(void)
516{
517 int ret;
518
519 if (apm_disabled) {
520 printk(KERN_NOTICE "apm: disabled on user request.\n");
521 return -ENODEV;
522 }
523
524 mips_apm_active = 1;
525
526 ret = kernel_thread(kapmd, NULL, CLONE_KERNEL);
527 if (ret < 0) {
528 mips_apm_active = 0;
529 return ret;
530 }
531
532#ifdef CONFIG_PROC_FS
533 create_proc_info_entry("apm", 0, NULL, apm_get_info);
534#endif
535
536 ret = misc_register(&apm_device);
537 if (ret != 0) {
538 remove_proc_entry("apm", NULL);
539
540 mips_apm_active = 0;
541 wake_up(&kapmd_wait);
542 wait_for_completion(&kapmd_exit);
543 }
544
545 return ret;
546}
547
548static void __exit apm_exit(void)
549{
550 misc_deregister(&apm_device);
551 remove_proc_entry("apm", NULL);
552
553 mips_apm_active = 0;
554 wake_up(&kapmd_wait);
555 wait_for_completion(&kapmd_exit);
556}
557
558module_init(apm_init);
559module_exit(apm_exit);
560
561MODULE_AUTHOR("Stephen Rothwell");
562MODULE_DESCRIPTION("Advanced Power Management");
563MODULE_LICENSE("GPL");
564
565#ifndef MODULE
566static int __init apm_setup(char *str)
567{
568 while ((str != NULL) && (*str != '\0')) {
569 if (strncmp(str, "off", 3) == 0)
570 apm_disabled = 1;
571 if (strncmp(str, "on", 2) == 0)
572 apm_disabled = 0;
573 str = strchr(str, ',');
574 if (str != NULL)
575 str += strspn(str, ", \t");
576 }
577 return 1;
578}
579
580__setup("apm=", apm_setup);
581#endif
582
583/**
584 * apm_queue_event - queue an APM event for kapmd
585 * @event: APM event
586 *
587 * Queue an APM event for kapmd to process and ultimately take the
588 * appropriate action. Only a subset of events are handled:
589 * %APM_LOW_BATTERY
590 * %APM_POWER_STATUS_CHANGE
591 * %APM_USER_SUSPEND
592 * %APM_SYS_SUSPEND
593 * %APM_CRITICAL_SUSPEND
594 */
595void apm_queue_event(apm_event_t event)
596{
597 unsigned long flags;
598
599 spin_lock_irqsave(&kapmd_queue_lock, flags);
600 queue_add_event(&kapmd_queue, event);
601 spin_unlock_irqrestore(&kapmd_queue_lock, flags);
602
603 wake_up_interruptible(&kapmd_wait);
604}
605EXPORT_SYMBOL(apm_queue_event);
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 0facfaf4e950..f1bb6a2dc5fc 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -141,72 +141,72 @@ void output_thread_defines(void)
141void output_thread_fpu_defines(void) 141void output_thread_fpu_defines(void)
142{ 142{
143 offset("#define THREAD_FPR0 ", 143 offset("#define THREAD_FPR0 ",
144 struct task_struct, thread.fpu.hard.fpr[0]); 144 struct task_struct, thread.fpu.fpr[0]);
145 offset("#define THREAD_FPR1 ", 145 offset("#define THREAD_FPR1 ",
146 struct task_struct, thread.fpu.hard.fpr[1]); 146 struct task_struct, thread.fpu.fpr[1]);
147 offset("#define THREAD_FPR2 ", 147 offset("#define THREAD_FPR2 ",
148 struct task_struct, thread.fpu.hard.fpr[2]); 148 struct task_struct, thread.fpu.fpr[2]);
149 offset("#define THREAD_FPR3 ", 149 offset("#define THREAD_FPR3 ",
150 struct task_struct, thread.fpu.hard.fpr[3]); 150 struct task_struct, thread.fpu.fpr[3]);
151 offset("#define THREAD_FPR4 ", 151 offset("#define THREAD_FPR4 ",
152 struct task_struct, thread.fpu.hard.fpr[4]); 152 struct task_struct, thread.fpu.fpr[4]);
153 offset("#define THREAD_FPR5 ", 153 offset("#define THREAD_FPR5 ",
154 struct task_struct, thread.fpu.hard.fpr[5]); 154 struct task_struct, thread.fpu.fpr[5]);
155 offset("#define THREAD_FPR6 ", 155 offset("#define THREAD_FPR6 ",
156 struct task_struct, thread.fpu.hard.fpr[6]); 156 struct task_struct, thread.fpu.fpr[6]);
157 offset("#define THREAD_FPR7 ", 157 offset("#define THREAD_FPR7 ",
158 struct task_struct, thread.fpu.hard.fpr[7]); 158 struct task_struct, thread.fpu.fpr[7]);
159 offset("#define THREAD_FPR8 ", 159 offset("#define THREAD_FPR8 ",
160 struct task_struct, thread.fpu.hard.fpr[8]); 160 struct task_struct, thread.fpu.fpr[8]);
161 offset("#define THREAD_FPR9 ", 161 offset("#define THREAD_FPR9 ",
162 struct task_struct, thread.fpu.hard.fpr[9]); 162 struct task_struct, thread.fpu.fpr[9]);
163 offset("#define THREAD_FPR10 ", 163 offset("#define THREAD_FPR10 ",
164 struct task_struct, thread.fpu.hard.fpr[10]); 164 struct task_struct, thread.fpu.fpr[10]);
165 offset("#define THREAD_FPR11 ", 165 offset("#define THREAD_FPR11 ",
166 struct task_struct, thread.fpu.hard.fpr[11]); 166 struct task_struct, thread.fpu.fpr[11]);
167 offset("#define THREAD_FPR12 ", 167 offset("#define THREAD_FPR12 ",
168 struct task_struct, thread.fpu.hard.fpr[12]); 168 struct task_struct, thread.fpu.fpr[12]);
169 offset("#define THREAD_FPR13 ", 169 offset("#define THREAD_FPR13 ",
170 struct task_struct, thread.fpu.hard.fpr[13]); 170 struct task_struct, thread.fpu.fpr[13]);
171 offset("#define THREAD_FPR14 ", 171 offset("#define THREAD_FPR14 ",
172 struct task_struct, thread.fpu.hard.fpr[14]); 172 struct task_struct, thread.fpu.fpr[14]);
173 offset("#define THREAD_FPR15 ", 173 offset("#define THREAD_FPR15 ",
174 struct task_struct, thread.fpu.hard.fpr[15]); 174 struct task_struct, thread.fpu.fpr[15]);
175 offset("#define THREAD_FPR16 ", 175 offset("#define THREAD_FPR16 ",
176 struct task_struct, thread.fpu.hard.fpr[16]); 176 struct task_struct, thread.fpu.fpr[16]);
177 offset("#define THREAD_FPR17 ", 177 offset("#define THREAD_FPR17 ",
178 struct task_struct, thread.fpu.hard.fpr[17]); 178 struct task_struct, thread.fpu.fpr[17]);
179 offset("#define THREAD_FPR18 ", 179 offset("#define THREAD_FPR18 ",
180 struct task_struct, thread.fpu.hard.fpr[18]); 180 struct task_struct, thread.fpu.fpr[18]);
181 offset("#define THREAD_FPR19 ", 181 offset("#define THREAD_FPR19 ",
182 struct task_struct, thread.fpu.hard.fpr[19]); 182 struct task_struct, thread.fpu.fpr[19]);
183 offset("#define THREAD_FPR20 ", 183 offset("#define THREAD_FPR20 ",
184 struct task_struct, thread.fpu.hard.fpr[20]); 184 struct task_struct, thread.fpu.fpr[20]);
185 offset("#define THREAD_FPR21 ", 185 offset("#define THREAD_FPR21 ",
186 struct task_struct, thread.fpu.hard.fpr[21]); 186 struct task_struct, thread.fpu.fpr[21]);
187 offset("#define THREAD_FPR22 ", 187 offset("#define THREAD_FPR22 ",
188 struct task_struct, thread.fpu.hard.fpr[22]); 188 struct task_struct, thread.fpu.fpr[22]);
189 offset("#define THREAD_FPR23 ", 189 offset("#define THREAD_FPR23 ",
190 struct task_struct, thread.fpu.hard.fpr[23]); 190 struct task_struct, thread.fpu.fpr[23]);
191 offset("#define THREAD_FPR24 ", 191 offset("#define THREAD_FPR24 ",
192 struct task_struct, thread.fpu.hard.fpr[24]); 192 struct task_struct, thread.fpu.fpr[24]);
193 offset("#define THREAD_FPR25 ", 193 offset("#define THREAD_FPR25 ",
194 struct task_struct, thread.fpu.hard.fpr[25]); 194 struct task_struct, thread.fpu.fpr[25]);
195 offset("#define THREAD_FPR26 ", 195 offset("#define THREAD_FPR26 ",
196 struct task_struct, thread.fpu.hard.fpr[26]); 196 struct task_struct, thread.fpu.fpr[26]);
197 offset("#define THREAD_FPR27 ", 197 offset("#define THREAD_FPR27 ",
198 struct task_struct, thread.fpu.hard.fpr[27]); 198 struct task_struct, thread.fpu.fpr[27]);
199 offset("#define THREAD_FPR28 ", 199 offset("#define THREAD_FPR28 ",
200 struct task_struct, thread.fpu.hard.fpr[28]); 200 struct task_struct, thread.fpu.fpr[28]);
201 offset("#define THREAD_FPR29 ", 201 offset("#define THREAD_FPR29 ",
202 struct task_struct, thread.fpu.hard.fpr[29]); 202 struct task_struct, thread.fpu.fpr[29]);
203 offset("#define THREAD_FPR30 ", 203 offset("#define THREAD_FPR30 ",
204 struct task_struct, thread.fpu.hard.fpr[30]); 204 struct task_struct, thread.fpu.fpr[30]);
205 offset("#define THREAD_FPR31 ", 205 offset("#define THREAD_FPR31 ",
206 struct task_struct, thread.fpu.hard.fpr[31]); 206 struct task_struct, thread.fpu.fpr[31]);
207 207
208 offset("#define THREAD_FCR31 ", 208 offset("#define THREAD_FCR31 ",
209 struct task_struct, thread.fpu.hard.fcr31); 209 struct task_struct, thread.fpu.fcr31);
210 linefeed; 210 linefeed;
211} 211}
212 212
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index b6232d9033cb..76fd3f22c766 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -178,7 +178,7 @@ int __compute_return_epc(struct pt_regs *regs)
178 if (is_fpu_owner()) 178 if (is_fpu_owner())
179 asm volatile("cfc1\t%0,$31" : "=r" (fcr31)); 179 asm volatile("cfc1\t%0,$31" : "=r" (fcr31));
180 else 180 else
181 fcr31 = current->thread.fpu.hard.fcr31; 181 fcr31 = current->thread.fpu.fcr31;
182 preempt_enable(); 182 preempt_enable();
183 183
184 bit = (insn.i_format.rt >> 2); 184 bit = (insn.i_format.rt >> 2);
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index 2125ba5f1d9b..0cb8ed5662f3 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -302,11 +302,11 @@ static struct irqaction irq2 = {
302}; 302};
303 303
304static struct resource pic1_io_resource = { 304static struct resource pic1_io_resource = {
305 "pic1", 0x20, 0x3f, IORESOURCE_BUSY 305 .name = "pic1", .start = 0x20, .end = 0x3f, .flags = IORESOURCE_BUSY
306}; 306};
307 307
308static struct resource pic2_io_resource = { 308static struct resource pic2_io_resource = {
309 "pic2", 0xa0, 0xbf, IORESOURCE_BUSY 309 .name = "pic2", .start = 0xa0, .end = 0xbf, .flags = IORESOURCE_BUSY
310}; 310};
311 311
312/* 312/*
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 8150f071f80a..a9bf6cc3abd1 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -260,7 +260,7 @@ irix_sigreturn(struct pt_regs *regs)
260 260
261 for(i = 0; i < 32; i++) 261 for(i = 0; i < 32; i++)
262 error |= __get_user(fregs[i], &context->fpregs[i]); 262 error |= __get_user(fregs[i], &context->fpregs[i]);
263 error |= __get_user(current->thread.fpu.hard.fcr31, &context->fpcsr); 263 error |= __get_user(current->thread.fpu.fcr31, &context->fpcsr);
264 } 264 }
265 265
266 /* XXX do sigstack crapola here... XXX */ 266 /* XXX do sigstack crapola here... XXX */
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 9b4733c12395..1d44025188d8 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -120,11 +120,11 @@ int ptrace_getfpregs (struct task_struct *child, __u32 __user *data)
120 __put_user ((__u64) -1, i + (__u64 __user *) data); 120 __put_user ((__u64) -1, i + (__u64 __user *) data);
121 } 121 }
122 122
123 __put_user (child->thread.fpu.fcr31, data + 64);
124
123 if (cpu_has_fpu) { 125 if (cpu_has_fpu) {
124 unsigned int flags, tmp; 126 unsigned int flags, tmp;
125 127
126 __put_user (child->thread.fpu.hard.fcr31, data + 64);
127
128 preempt_disable(); 128 preempt_disable();
129 if (cpu_has_mipsmt) { 129 if (cpu_has_mipsmt) {
130 unsigned int vpflags = dvpe(); 130 unsigned int vpflags = dvpe();
@@ -142,7 +142,6 @@ int ptrace_getfpregs (struct task_struct *child, __u32 __user *data)
142 preempt_enable(); 142 preempt_enable();
143 __put_user (tmp, data + 65); 143 __put_user (tmp, data + 65);
144 } else { 144 } else {
145 __put_user (child->thread.fpu.soft.fcr31, data + 64);
146 __put_user ((__u32) 0, data + 65); 145 __put_user ((__u32) 0, data + 65);
147 } 146 }
148 147
@@ -162,10 +161,7 @@ int ptrace_setfpregs (struct task_struct *child, __u32 __user *data)
162 for (i = 0; i < 32; i++) 161 for (i = 0; i < 32; i++)
163 __get_user (fregs[i], i + (__u64 __user *) data); 162 __get_user (fregs[i], i + (__u64 __user *) data);
164 163
165 if (cpu_has_fpu) 164 __get_user (child->thread.fpu.fcr31, data + 64);
166 __get_user (child->thread.fpu.hard.fcr31, data + 64);
167 else
168 __get_user (child->thread.fpu.soft.fcr31, data + 64);
169 165
170 /* FIR may not be written. */ 166 /* FIR may not be written. */
171 167
@@ -241,10 +237,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
241 tmp = regs->lo; 237 tmp = regs->lo;
242 break; 238 break;
243 case FPC_CSR: 239 case FPC_CSR:
244 if (cpu_has_fpu) 240 tmp = child->thread.fpu.fcr31;
245 tmp = child->thread.fpu.hard.fcr31;
246 else
247 tmp = child->thread.fpu.soft.fcr31;
248 break; 241 break;
249 case FPC_EIR: { /* implementation / version register */ 242 case FPC_EIR: { /* implementation / version register */
250 unsigned int flags; 243 unsigned int flags;
@@ -336,9 +329,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
336 329
337 if (!tsk_used_math(child)) { 330 if (!tsk_used_math(child)) {
338 /* FP not yet used */ 331 /* FP not yet used */
339 memset(&child->thread.fpu.hard, ~0, 332 memset(&child->thread.fpu, ~0,
340 sizeof(child->thread.fpu.hard)); 333 sizeof(child->thread.fpu));
341 child->thread.fpu.hard.fcr31 = 0; 334 child->thread.fpu.fcr31 = 0;
342 } 335 }
343#ifdef CONFIG_32BIT 336#ifdef CONFIG_32BIT
344 /* 337 /*
@@ -369,10 +362,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
369 regs->lo = data; 362 regs->lo = data;
370 break; 363 break;
371 case FPC_CSR: 364 case FPC_CSR:
372 if (cpu_has_fpu) 365 child->thread.fpu.fcr31 = data;
373 child->thread.fpu.hard.fcr31 = data;
374 else
375 child->thread.fpu.soft.fcr31 = data;
376 break; 366 break;
377 case DSP_BASE ... DSP_BASE + 5: { 367 case DSP_BASE ... DSP_BASE + 5: {
378 dspreg_t *dregs; 368 dspreg_t *dregs;
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 8704dc0496ea..f40ecd8be05f 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -166,10 +166,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
166 tmp = regs->lo; 166 tmp = regs->lo;
167 break; 167 break;
168 case FPC_CSR: 168 case FPC_CSR:
169 if (cpu_has_fpu) 169 tmp = child->thread.fpu.fcr31;
170 tmp = child->thread.fpu.hard.fcr31;
171 else
172 tmp = child->thread.fpu.soft.fcr31;
173 break; 170 break;
174 case FPC_EIR: { /* implementation / version register */ 171 case FPC_EIR: { /* implementation / version register */
175 unsigned int flags; 172 unsigned int flags;
@@ -288,9 +285,9 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
288 285
289 if (!tsk_used_math(child)) { 286 if (!tsk_used_math(child)) {
290 /* FP not yet used */ 287 /* FP not yet used */
291 memset(&child->thread.fpu.hard, ~0, 288 memset(&child->thread.fpu, ~0,
292 sizeof(child->thread.fpu.hard)); 289 sizeof(child->thread.fpu));
293 child->thread.fpu.hard.fcr31 = 0; 290 child->thread.fpu.fcr31 = 0;
294 } 291 }
295 /* 292 /*
296 * The odd registers are actually the high order bits 293 * The odd registers are actually the high order bits
@@ -318,10 +315,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
318 regs->lo = data; 315 regs->lo = data;
319 break; 316 break;
320 case FPC_CSR: 317 case FPC_CSR:
321 if (cpu_has_fpu) 318 child->thread.fpu.fcr31 = data;
322 child->thread.fpu.hard.fcr31 = data;
323 else
324 child->thread.fpu.soft.fcr31 = data;
325 break; 319 break;
326 case DSP_BASE ... DSP_BASE + 5: { 320 case DSP_BASE ... DSP_BASE + 5: {
327 dspreg_t *dregs; 321 dspreg_t *dregs;
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 0b1b54acee9f..db94e556fc97 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -75,8 +75,8 @@
75 and t0, t0, t1 75 and t0, t0, t1
76 LONG_S t0, ST_OFF(t3) 76 LONG_S t0, ST_OFF(t3)
77 77
78 fpu_save_double a0 t1 t0 t2 # c0_status passed in t1 78 fpu_save_double a0 t0 t1 # c0_status passed in t0
79 # clobbers t0 and t2 79 # clobbers t1
801: 801:
81 81
82 /* 82 /*
@@ -129,9 +129,9 @@
129 */ 129 */
130LEAF(_save_fp) 130LEAF(_save_fp)
131#ifdef CONFIG_64BIT 131#ifdef CONFIG_64BIT
132 mfc0 t1, CP0_STATUS 132 mfc0 t0, CP0_STATUS
133#endif 133#endif
134 fpu_save_double a0 t1 t0 t2 # clobbers t1 134 fpu_save_double a0 t0 t1 # clobbers t1
135 jr ra 135 jr ra
136 END(_save_fp) 136 END(_save_fp)
137 137
@@ -139,7 +139,10 @@ LEAF(_save_fp)
139 * Restore a thread's fp context. 139 * Restore a thread's fp context.
140 */ 140 */
141LEAF(_restore_fp) 141LEAF(_restore_fp)
142 fpu_restore_double a0, t1 # clobbers t1 142#ifdef CONFIG_64BIT
143 mfc0 t0, CP0_STATUS
144#endif
145 fpu_restore_double a0 t0 t1 # clobbers t1
143 jr ra 146 jr ra
144 END(_restore_fp) 147 END(_restore_fp)
145 148
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 397a70e651b5..bfcec8d9bfe4 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -442,6 +442,48 @@ static inline void bootmem_init(void)
442#endif /* CONFIG_BLK_DEV_INITRD */ 442#endif /* CONFIG_BLK_DEV_INITRD */
443} 443}
444 444
445/*
446 * arch_mem_init - initialize memory managment subsystem
447 *
448 * o plat_mem_setup() detects the memory configuration and will record detected
449 * memory areas using add_memory_region.
450 * o parse_cmdline_early() parses the command line for mem= options which,
451 * iff detected, will override the results of the automatic detection.
452 *
453 * At this stage the memory configuration of the system is known to the
454 * kernel but generic memory managment system is still entirely uninitialized.
455 *
456 * o bootmem_init()
457 * o sparse_init()
458 * o paging_init()
459 *
460 * At this stage the bootmem allocator is ready to use.
461 *
462 * NOTE: historically plat_mem_setup did the entire platform initialization.
463 * This was rather impractical because it meant plat_mem_setup had to
464 * get away without any kind of memory allocator. To keep old code from
465 * breaking plat_setup was just renamed to plat_setup and a second platform
466 * initialization hook for anything else was introduced.
467 */
468
469extern void plat_mem_setup(void);
470
471static void __init arch_mem_init(char **cmdline_p)
472{
473 /* call board setup routine */
474 plat_mem_setup();
475
476 strlcpy(command_line, arcs_cmdline, sizeof(command_line));
477 strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
478
479 *cmdline_p = command_line;
480
481 parse_cmdline_early();
482 bootmem_init();
483 sparse_init();
484 paging_init();
485}
486
445static inline void resource_init(void) 487static inline void resource_init(void)
446{ 488{
447 int i; 489 int i;
@@ -495,8 +537,6 @@ static inline void resource_init(void)
495#undef MAXMEM 537#undef MAXMEM
496#undef MAXMEM_PFN 538#undef MAXMEM_PFN
497 539
498extern void plat_setup(void);
499
500void __init setup_arch(char **cmdline_p) 540void __init setup_arch(char **cmdline_p)
501{ 541{
502 cpu_probe(); 542 cpu_probe();
@@ -511,18 +551,8 @@ void __init setup_arch(char **cmdline_p)
511#endif 551#endif
512#endif 552#endif
513 553
514 /* call board setup routine */ 554 arch_mem_init(cmdline_p);
515 plat_setup();
516 555
517 strlcpy(command_line, arcs_cmdline, sizeof(command_line));
518 strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
519
520 *cmdline_p = command_line;
521
522 parse_cmdline_early();
523 bootmem_init();
524 sparse_init();
525 paging_init();
526 resource_init(); 556 resource_init();
527#ifdef CONFIG_SMP 557#ifdef CONFIG_SMP
528 plat_smp_setup(); 558 plat_smp_setup();
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index a7564b08eb4d..ad16eceb24dd 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -65,7 +65,7 @@ extern asmlinkage void handle_mcheck(void);
65extern asmlinkage void handle_reserved(void); 65extern asmlinkage void handle_reserved(void);
66 66
67extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, 67extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
68 struct mips_fpu_soft_struct *ctx); 68 struct mips_fpu_struct *ctx);
69 69
70void (*board_be_init)(void); 70void (*board_be_init)(void);
71int (*board_be_handler)(struct pt_regs *regs, int is_fixup); 71int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
@@ -600,8 +600,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
600 preempt_enable(); 600 preempt_enable();
601 601
602 /* Run the emulator */ 602 /* Run the emulator */
603 sig = fpu_emulator_cop1Handler (regs, 603 sig = fpu_emulator_cop1Handler (regs, &current->thread.fpu);
604 &current->thread.fpu.soft);
605 604
606 preempt_disable(); 605 preempt_disable();
607 606
@@ -610,7 +609,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
610 * We can't allow the emulated instruction to leave any of 609 * We can't allow the emulated instruction to leave any of
611 * the cause bit set in $fcr31. 610 * the cause bit set in $fcr31.
612 */ 611 */
613 current->thread.fpu.soft.fcr31 &= ~FPU_CSR_ALL_X; 612 current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
614 613
615 /* Restore the hardware register state */ 614 /* Restore the hardware register state */
616 restore_fp(current); 615 restore_fp(current);
@@ -755,7 +754,7 @@ asmlinkage void do_cpu(struct pt_regs *regs)
755 754
756 if (!cpu_has_fpu) { 755 if (!cpu_has_fpu) {
757 int sig = fpu_emulator_cop1Handler(regs, 756 int sig = fpu_emulator_cop1Handler(regs,
758 &current->thread.fpu.soft); 757 &current->thread.fpu);
759 if (sig) 758 if (sig)
760 force_sig(sig, current); 759 force_sig(sig, current);
761#ifdef CONFIG_MIPS_MT_FPAFF 760#ifdef CONFIG_MIPS_MT_FPAFF
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index bb70a8240e61..3f64277429e4 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -155,7 +155,7 @@ void __init serial_init(void)
155} 155}
156#endif 156#endif
157 157
158void __init plat_setup(void) 158void __init plat_mem_setup(void)
159{ 159{
160 int i; 160 int i;
161 lasat_misc = &lasat_misc_info[mips_machtype]; 161 lasat_misc = &lasat_misc_info[mips_machtype];
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index cf12caf80774..b225543f5302 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -7,4 +7,7 @@ lib-y += csum_partial_copy.o memcpy.o promlib.o strlen_user.o strncpy_user.o \
7 7
8obj-y += iomap.o 8obj-y += iomap.o
9 9
10# libgcc-style stuff needed in the kernel
11lib-y += ashldi3.o ashrdi3.o lshrdi3.o
12
10EXTRA_AFLAGS := $(CFLAGS) 13EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c
new file mode 100644
index 000000000000..beb80f316095
--- /dev/null
+++ b/arch/mips/lib/ashldi3.c
@@ -0,0 +1,29 @@
1#include <linux/module.h>
2
3#include "libgcc.h"
4
5long long __ashldi3(long long u, word_type b)
6{
7 DWunion uu, w;
8 word_type bm;
9
10 if (b == 0)
11 return u;
12
13 uu.ll = u;
14 bm = 32 - b;
15
16 if (bm <= 0) {
17 w.s.low = 0;
18 w.s.high = (unsigned int) uu.s.low << -bm;
19 } else {
20 const unsigned int carries = (unsigned int) uu.s.low >> bm;
21
22 w.s.low = (unsigned int) uu.s.low << b;
23 w.s.high = ((unsigned int) uu.s.high << b) | carries;
24 }
25
26 return w.ll;
27}
28
29EXPORT_SYMBOL(__ashldi3);
diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c
new file mode 100644
index 000000000000..c884a912b660
--- /dev/null
+++ b/arch/mips/lib/ashrdi3.c
@@ -0,0 +1,31 @@
1#include <linux/module.h>
2
3#include "libgcc.h"
4
5long long __ashrdi3(long long u, word_type b)
6{
7 DWunion uu, w;
8 word_type bm;
9
10 if (b == 0)
11 return u;
12
13 uu.ll = u;
14 bm = 32 - b;
15
16 if (bm <= 0) {
17 /* w.s.high = 1..1 or 0..0 */
18 w.s.high =
19 uu.s.high >> 31;
20 w.s.low = uu.s.high >> -bm;
21 } else {
22 const unsigned int carries = (unsigned int) uu.s.high << bm;
23
24 w.s.high = uu.s.high >> b;
25 w.s.low = ((unsigned int) uu.s.low >> b) | carries;
26 }
27
28 return w.ll;
29}
30
31EXPORT_SYMBOL(__ashrdi3);
diff --git a/arch/mips/lib/libgcc.h b/arch/mips/lib/libgcc.h
new file mode 100644
index 000000000000..3f19d1c5d942
--- /dev/null
+++ b/arch/mips/lib/libgcc.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_LIBGCC_H
2#define __ASM_LIBGCC_H
3
4#include <asm/byteorder.h>
5
6typedef int word_type __attribute__ ((mode (__word__)));
7
8#ifdef __BIG_ENDIAN
9struct DWstruct {
10 int high, low;
11};
12#elif defined(__LITTLE_ENDIAN)
13struct DWstruct {
14 int low, high;
15};
16#else
17#error I feel sick.
18#endif
19
20typedef union
21{
22 struct DWstruct s;
23 long long ll;
24} DWunion;
25
26#endif /* __ASM_LIBGCC_H */
diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c
new file mode 100644
index 000000000000..dcf8d6810b7c
--- /dev/null
+++ b/arch/mips/lib/lshrdi3.c
@@ -0,0 +1,29 @@
1#include <linux/module.h>
2
3#include "libgcc.h"
4
5long long __lshrdi3(long long u, word_type b)
6{
7 DWunion uu, w;
8 word_type bm;
9
10 if (b == 0)
11 return u;
12
13 uu.ll = u;
14 bm = 32 - b;
15
16 if (bm <= 0) {
17 w.s.high = 0;
18 w.s.low = (unsigned int) uu.s.high >> -bm;
19 } else {
20 const unsigned int carries = (unsigned int) uu.s.high << bm;
21
22 w.s.high = (unsigned int) uu.s.high >> b;
23 w.s.low = ((unsigned int) uu.s.low >> b) | carries;
24 }
25
26 return w.ll;
27}
28
29EXPORT_SYMBOL(__lshrdi3);
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index aa5818a0d884..3f0d5d26d506 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -60,15 +60,15 @@
60 60
61/* Function which emulates a floating point instruction. */ 61/* Function which emulates a floating point instruction. */
62 62
63static int fpu_emu(struct pt_regs *, struct mips_fpu_soft_struct *, 63static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
64 mips_instruction); 64 mips_instruction);
65 65
66#if __mips >= 4 && __mips != 32 66#if __mips >= 4 && __mips != 32
67static int fpux_emu(struct pt_regs *, 67static int fpux_emu(struct pt_regs *,
68 struct mips_fpu_soft_struct *, mips_instruction); 68 struct mips_fpu_struct *, mips_instruction);
69#endif 69#endif
70 70
71/* Further private data for which no space exists in mips_fpu_soft_struct */ 71/* Further private data for which no space exists in mips_fpu_struct */
72 72
73struct mips_fpu_emulator_stats fpuemustats; 73struct mips_fpu_emulator_stats fpuemustats;
74 74
@@ -203,7 +203,7 @@ static int isBranchInstr(mips_instruction * i)
203 * Two instructions if the instruction is in a branch delay slot. 203 * Two instructions if the instruction is in a branch delay slot.
204 */ 204 */
205 205
206static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) 206static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
207{ 207{
208 mips_instruction ir; 208 mips_instruction ir;
209 void * emulpc, *contpc; 209 void * emulpc, *contpc;
@@ -595,7 +595,7 @@ DEF3OP(msub, dp, ieee754dp_mul, ieee754dp_sub,);
595DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg); 595DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg);
596DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg); 596DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg);
597 597
598static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, 598static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
599 mips_instruction ir) 599 mips_instruction ir)
600{ 600{
601 unsigned rcsr = 0; /* resulting csr */ 601 unsigned rcsr = 0; /* resulting csr */
@@ -759,7 +759,7 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
759/* 759/*
760 * Emulate a single COP1 arithmetic instruction. 760 * Emulate a single COP1 arithmetic instruction.
761 */ 761 */
762static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, 762static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
763 mips_instruction ir) 763 mips_instruction ir)
764{ 764{
765 int rfmt; /* resulting format */ 765 int rfmt; /* resulting format */
@@ -1233,8 +1233,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
1233 return 0; 1233 return 0;
1234} 1234}
1235 1235
1236int fpu_emulator_cop1Handler(struct pt_regs *xcp, 1236int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
1237 struct mips_fpu_soft_struct *ctx)
1238{ 1237{
1239 unsigned long oldepc, prevepc; 1238 unsigned long oldepc, prevepc;
1240 mips_instruction insn; 1239 mips_instruction insn;
diff --git a/arch/mips/math-emu/ieee754.h b/arch/mips/math-emu/ieee754.h
index 171f177c0f88..dd917332792c 100644
--- a/arch/mips/math-emu/ieee754.h
+++ b/arch/mips/math-emu/ieee754.h
@@ -329,7 +329,7 @@ struct _ieee754_csr {
329 unsigned pad0:7; 329 unsigned pad0:7;
330#endif 330#endif
331}; 331};
332#define ieee754_csr (*(struct _ieee754_csr *)(&current->thread.fpu.soft.fcr31)) 332#define ieee754_csr (*(struct _ieee754_csr *)(&current->thread.fpu.fcr31))
333 333
334static inline unsigned ieee754_getrm(void) 334static inline unsigned ieee754_getrm(void)
335{ 335{
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c
index d187ab71c2ff..56ca0c6a7178 100644
--- a/arch/mips/math-emu/kernel_linkage.c
+++ b/arch/mips/math-emu/kernel_linkage.c
@@ -39,9 +39,9 @@ void fpu_emulator_init_fpu(void)
39 printk("Algorithmics/MIPS FPU Emulator v1.5\n"); 39 printk("Algorithmics/MIPS FPU Emulator v1.5\n");
40 } 40 }
41 41
42 current->thread.fpu.soft.fcr31 = 0; 42 current->thread.fpu.fcr31 = 0;
43 for (i = 0; i < 32; i++) { 43 for (i = 0; i < 32; i++) {
44 current->thread.fpu.soft.fpr[i] = SIGNALLING_NAN; 44 current->thread.fpu.fpr[i] = SIGNALLING_NAN;
45 } 45 }
46} 46}
47 47
@@ -59,10 +59,9 @@ int fpu_emulator_save_context(struct sigcontext *sc)
59 59
60 for (i = 0; i < 32; i++) { 60 for (i = 0; i < 32; i++) {
61 err |= 61 err |=
62 __put_user(current->thread.fpu.soft.fpr[i], 62 __put_user(current->thread.fpu.fpr[i], &sc->sc_fpregs[i]);
63 &sc->sc_fpregs[i]);
64 } 63 }
65 err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); 64 err |= __put_user(current->thread.fpu.fcr31, &sc->sc_fpc_csr);
66 65
67 return err; 66 return err;
68} 67}
@@ -74,10 +73,9 @@ int fpu_emulator_restore_context(struct sigcontext *sc)
74 73
75 for (i = 0; i < 32; i++) { 74 for (i = 0; i < 32; i++) {
76 err |= 75 err |=
77 __get_user(current->thread.fpu.soft.fpr[i], 76 __get_user(current->thread.fpu.fpr[i], &sc->sc_fpregs[i]);
78 &sc->sc_fpregs[i]);
79 } 77 }
80 err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); 78 err |= __get_user(current->thread.fpu.fcr31, &sc->sc_fpc_csr);
81 79
82 return err; 80 return err;
83} 81}
@@ -94,10 +92,9 @@ int fpu_emulator_save_context32(struct sigcontext32 *sc)
94 92
95 for (i = 0; i < 32; i+=2) { 93 for (i = 0; i < 32; i+=2) {
96 err |= 94 err |=
97 __put_user(current->thread.fpu.soft.fpr[i], 95 __put_user(current->thread.fpu.fpr[i], &sc->sc_fpregs[i]);
98 &sc->sc_fpregs[i]);
99 } 96 }
100 err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); 97 err |= __put_user(current->thread.fpu.fcr31, &sc->sc_fpc_csr);
101 98
102 return err; 99 return err;
103} 100}
@@ -109,10 +106,9 @@ int fpu_emulator_restore_context32(struct sigcontext32 *sc)
109 106
110 for (i = 0; i < 32; i+=2) { 107 for (i = 0; i < 32; i+=2) {
111 err |= 108 err |=
112 __get_user(current->thread.fpu.soft.fpr[i], 109 __get_user(current->thread.fpu.fpr[i], &sc->sc_fpregs[i]);
113 &sc->sc_fpregs[i]);
114 } 110 }
115 err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); 111 err |= __get_user(current->thread.fpu.fcr31, &sc->sc_fpc_csr);
116 112
117 return err; 113 return err;
118} 114}
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index c20d401ecf80..8cc9effcb832 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -50,7 +50,7 @@ const char *get_system_type(void)
50 return "MIPS Atlas"; 50 return "MIPS Atlas";
51} 51}
52 52
53void __init plat_setup(void) 53void __init plat_mem_setup(void)
54{ 54{
55 mips_pcibios_init(); 55 mips_pcibios_init();
56 56
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index bc4d093685bb..fd492562584a 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -76,6 +76,15 @@ struct prom_pmemblock * __init prom_getmdesc(void)
76 memsize = simple_strtol(memsize_str, NULL, 0); 76 memsize = simple_strtol(memsize_str, NULL, 0);
77 } 77 }
78 } 78 }
79
80#ifdef CONFIG_CPU_BIG_ENDIAN
81 /*
82 * SOC-it swaps, or perhaps doesn't swap, when DMA'ing the last
83 * word of physical memory
84 */
85 memsize -= PAGE_SIZE;
86#endif
87
79 memset(mdesc, 0, sizeof(mdesc)); 88 memset(mdesc, 0, sizeof(mdesc));
80 89
81 mdesc[0].type = yamon_dontuse; 90 mdesc[0].type = yamon_dontuse;
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index b8488aab6df1..0766e434b6bd 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -53,11 +53,11 @@ extern void kgdb_config(void);
53#endif 53#endif
54 54
55struct resource standard_io_resources[] = { 55struct resource standard_io_resources[] = {
56 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY }, 56 { .name = "dma1", .start = 0x00, .end = 0x1f, .flags = IORESOURCE_BUSY },
57 { "timer", 0x40, 0x5f, IORESOURCE_BUSY }, 57 { .name = "timer", .start = 0x40, .end = 0x5f, .flags = IORESOURCE_BUSY },
58 { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY }, 58 { .name = "keyboard", .start = 0x60, .end = 0x6f, .flags = IORESOURCE_BUSY },
59 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY }, 59 { .name = "dma page reg", .start = 0x80, .end = 0x8f, .flags = IORESOURCE_BUSY },
60 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, 60 { .name = "dma2", .start = 0xc0, .end = 0xdf, .flags = IORESOURCE_BUSY },
61}; 61};
62 62
63#ifdef CONFIG_MTD 63#ifdef CONFIG_MTD
@@ -111,7 +111,7 @@ void __init fd_activate(void)
111} 111}
112#endif 112#endif
113 113
114void __init plat_setup(void) 114void __init plat_mem_setup(void)
115{ 115{
116 unsigned int i; 116 unsigned int i;
117 117
diff --git a/arch/mips/mips-boards/malta/malta_smp.c b/arch/mips/mips-boards/malta/malta_smp.c
index 6c6c8eeedbce..cf967170fe29 100644
--- a/arch/mips/mips-boards/malta/malta_smp.c
+++ b/arch/mips/mips-boards/malta/malta_smp.c
@@ -34,25 +34,6 @@ void core_send_ipi(int cpu, unsigned int action)
34} 34}
35 35
36/* 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 37 * Platform "CPU" startup hook
57 */ 38 */
58 39
diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
index 4266ce445174..6430f11f3a95 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -45,7 +45,7 @@ const char *get_system_type(void)
45 return "MIPS SEAD"; 45 return "MIPS SEAD";
46} 46}
47 47
48void __init plat_setup(void) 48void __init plat_mem_setup(void)
49{ 49{
50 ioport_resource.end = 0x7fffffff; 50 ioport_resource.end = 0x7fffffff;
51 51
diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
index a2fd62997ca3..15a5dac4ae19 100644
--- a/arch/mips/mips-boards/sim/sim_setup.c
+++ b/arch/mips/mips-boards/sim/sim_setup.c
@@ -50,7 +50,7 @@ const char *get_system_type(void)
50 return "MIPSsim"; 50 return "MIPSsim";
51} 51}
52 52
53void __init plat_setup(void) 53void __init plat_mem_setup(void)
54{ 54{
55 set_io_port_base(0xbfd00000); 55 set_io_port_base(0xbfd00000);
56 56
diff --git a/arch/mips/mips-boards/sim/sim_smp.c b/arch/mips/mips-boards/sim/sim_smp.c
index b7084e7c4bf9..004070956cca 100644
--- a/arch/mips/mips-boards/sim/sim_smp.c
+++ b/arch/mips/mips-boards/sim/sim_smp.c
@@ -51,27 +51,6 @@ void core_send_ipi(int cpu, unsigned int action)
51} 51}
52 52
53/* 53/*
54 * Detect available CPUs/VPEs/TCs and populate phys_cpu_present_map
55 */
56
57void __init prom_build_cpu_map(void)
58{
59#ifdef CONFIG_MIPS_MT_SMTC
60 int nextslot;
61
62 /*
63 * As of November, 2004, MIPSsim only simulates one core
64 * at a time. However, that core may be a MIPS MT core
65 * with multiple virtual processors and thread contexts.
66 */
67
68 if (read_c0_config3() & (1<<2)) {
69 nextslot = mipsmt_build_cpu_map(1);
70 }
71#endif /* CONFIG_MIPS_MT_SMTC */
72}
73
74/*
75 * Platform "CPU" startup hook 54 * Platform "CPU" startup hook
76 */ 55 */
77 56
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 9dca099ba16b..965cb4c4359d 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -413,7 +413,6 @@ out:
413 return ret; 413 return ret;
414} 414}
415 415
416extern void __init sanitize_tlb_entries(void);
417static void __init probe_tlb(unsigned long config) 416static void __init probe_tlb(unsigned long config)
418{ 417{
419 struct cpuinfo_mips *c = &current_cpu_data; 418 struct cpuinfo_mips *c = &current_cpu_data;
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c
index 1379c76845dc..df1485501ce6 100644
--- a/arch/mips/momentum/jaguar_atx/setup.c
+++ b/arch/mips/momentum/jaguar_atx/setup.c
@@ -359,7 +359,7 @@ static __init int __init ja_pci_init(void)
359 359
360arch_initcall(ja_pci_init); 360arch_initcall(ja_pci_init);
361 361
362void __init plat_setup(void) 362void __init plat_mem_setup(void)
363{ 363{
364 unsigned int tmpword; 364 unsigned int tmpword;
365 365
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
index c69195234309..8c53490ba6f1 100644
--- a/arch/mips/momentum/ocelot_3/setup.c
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -313,7 +313,7 @@ static __init int __init ja_pci_init(void)
313 313
314arch_initcall(ja_pci_init); 314arch_initcall(ja_pci_init);
315 315
316void __init plat_setup(void) 316void __init plat_mem_setup(void)
317{ 317{
318 unsigned int tmpword; 318 unsigned int tmpword;
319 319
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c
index a3e6f5575592..257e1d1b72dd 100644
--- a/arch/mips/momentum/ocelot_c/setup.c
+++ b/arch/mips/momentum/ocelot_c/setup.c
@@ -231,7 +231,7 @@ void momenco_time_init(void)
231 rtc_mips_set_time = m48t37y_set_time; 231 rtc_mips_set_time = m48t37y_set_time;
232} 232}
233 233
234void __init plat_setup(void) 234void __init plat_mem_setup(void)
235{ 235{
236 unsigned int tmpword; 236 unsigned int tmpword;
237 237
diff --git a/arch/mips/momentum/ocelot_g/setup.c b/arch/mips/momentum/ocelot_g/setup.c
index fed4e8eee116..72143ab1e900 100644
--- a/arch/mips/momentum/ocelot_g/setup.c
+++ b/arch/mips/momentum/ocelot_g/setup.c
@@ -162,7 +162,7 @@ static void __init setup_l3cache(unsigned long size)
162 printk("Done\n"); 162 printk("Done\n");
163} 163}
164 164
165void __init plat_setup(void) 165void __init plat_mem_setup(void)
166{ 166{
167 void (*l3func)(unsigned long) = (void *) KSEG1ADDR(setup_l3cache); 167 void (*l3func)(unsigned long) = (void *) KSEG1ADDR(setup_l3cache);
168 unsigned int tmpword; 168 unsigned int tmpword;
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 16205b587338..465778c5d816 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -18,12 +18,12 @@ obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o
18obj-$(CONFIG_MIPS_TX3927) += ops-tx3927.o 18obj-$(CONFIG_MIPS_TX3927) += ops-tx3927.o
19obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o 19obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
20obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o 20obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o
21obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
21 22
22# 23#
23# These are still pretty much in the old state, watch, go blind. 24# These are still pretty much in the old state, watch, go blind.
24# 25#
25obj-$(CONFIG_DDB5074) += fixup-ddb5074.o pci-ddb5074.o ops-ddb5074.o 26obj-$(CONFIG_BASLER_EXCITE) = ops-titan.o pci-excite.o fixup-excite.o
26obj-$(CONFIG_DDB5476) += ops-ddb5476.o pci-ddb5476.o
27obj-$(CONFIG_DDB5477) += fixup-ddb5477.o pci-ddb5477.o ops-ddb5477.o 27obj-$(CONFIG_DDB5477) += fixup-ddb5477.o pci-ddb5477.o ops-ddb5477.o
28obj-$(CONFIG_LASAT) += pci-lasat.o 28obj-$(CONFIG_LASAT) += pci-lasat.o
29obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o 29obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o
@@ -43,7 +43,7 @@ obj-$(CONFIG_MOMENCO_OCELOT_C) += fixup-ocelot-c.o pci-ocelot-c.o
43obj-$(CONFIG_MOMENCO_OCELOT_G) += fixup-ocelot-g.o pci-ocelot-g.o 43obj-$(CONFIG_MOMENCO_OCELOT_G) += fixup-ocelot-g.o pci-ocelot-g.o
44obj-$(CONFIG_PMC_YOSEMITE) += fixup-yosemite.o ops-titan.o ops-titan-ht.o \ 44obj-$(CONFIG_PMC_YOSEMITE) += fixup-yosemite.o ops-titan.o ops-titan-ht.o \
45 pci-yosemite.o 45 pci-yosemite.o
46obj-$(CONFIG_SGI_IP27) += pci-ip27.o 46obj-$(CONFIG_SGI_IP27) += ops-bridge.o pci-ip27.o
47obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o 47obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o
48obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o 48obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o
49obj-$(CONFIG_SIBYTE_BCM112X) += fixup-sb1250.o pci-sb1250.o 49obj-$(CONFIG_SIBYTE_BCM112X) += fixup-sb1250.o pci-sb1250.o
@@ -57,3 +57,4 @@ obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o ops-tx4927.o
57obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-tx4938.o ops-tx4938.o 57obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-tx4938.o ops-tx4938.o
58obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o 58obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o
59obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o 59obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o
60obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o
diff --git a/arch/mips/pci/fixup-ddb5074.c b/arch/mips/pci/fixup-ddb5074.c
deleted file mode 100644
index 5a4a7c239c42..000000000000
--- a/arch/mips/pci/fixup-ddb5074.c
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * It's nice to have the LEDs on the GPIO pins available for debugging
3 */
4static void ddb5074_fixup(struct pci_dev *dev)
5{
6 extern struct pci_dev *pci_pmu;
7 u8 t8;
8
9 pci_pmu = dev; /* for LEDs D2 and D3 */
10 /* Program the lines for LEDs D2 and D3 to output */
11 pci_read_config_byte(dev, 0x7d, &t8);
12 t8 |= 0xc0;
13 pci_write_config_byte(dev, 0x7d, t8);
14 /* Turn LEDs D2 and D3 off */
15 pci_read_config_byte(dev, 0x7e, &t8);
16 t8 |= 0xc0;
17 pci_write_config_byte(dev, 0x7e, t8);
18}
19
20DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
21 ddb5074_fixup);
diff --git a/arch/mips/pci/fixup-emma2rh.c b/arch/mips/pci/fixup-emma2rh.c
new file mode 100644
index 000000000000..3a34cd0efd6b
--- /dev/null
+++ b/arch/mips/pci/fixup-emma2rh.c
@@ -0,0 +1,102 @@
1/*
2 * arch/mips/pci/fixup-emma2rh.c
3 * This file defines the PCI configration.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/pci.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#include <linux/config.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/types.h>
30#include <linux/pci.h>
31
32#include <asm/bootinfo.h>
33#include <asm/debug.h>
34
35#include <asm/emma2rh/emma2rh.h>
36
37#define EMMA2RH_PCI_HOST_SLOT 0x09
38#define EMMA2RH_USB_SLOT 0x03
39#define PCI_DEVICE_ID_NEC_EMMA2RH 0x014b /* EMMA2RH PCI Host */
40
41/*
42 * we fix up irqs based on the slot number.
43 * The first entry is at AD:11.
44 * Fortunately this works because, although we have two pci buses,
45 * they all have different slot numbers (except for rockhopper slot 20
46 * which is handled below).
47 *
48 */
49
50#define MAX_SLOT_NUM 10
51static unsigned char irq_map[][5] __initdata = {
52 [3] = {0, MARKEINS_PCI_IRQ_INTB, MARKEINS_PCI_IRQ_INTC,
53 MARKEINS_PCI_IRQ_INTD, 0,},
54 [4] = {0, MARKEINS_PCI_IRQ_INTA, 0, 0, 0,},
55 [5] = {0, 0, 0, 0, 0,},
56 [6] = {0, MARKEINS_PCI_IRQ_INTC, MARKEINS_PCI_IRQ_INTD,
57 MARKEINS_PCI_IRQ_INTA, MARKEINS_PCI_IRQ_INTB,},
58};
59
60static void __devinit nec_usb_controller_fixup(struct pci_dev *dev)
61{
62 if (PCI_SLOT(dev->devfn) == EMMA2RH_USB_SLOT)
63 /* on board USB controller configuration */
64 pci_write_config_dword(dev, 0xe4, 1 << 5);
65}
66
67DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
68 nec_usb_controller_fixup);
69
70/*
71 * Prevent the PCI layer from seeing the resources allocated to this device
72 * if it is the host bridge by marking it as such. These resources are of
73 * no consequence to the PCI layer (they are handled elsewhere).
74 */
75static void __devinit emma2rh_pci_host_fixup(struct pci_dev *dev)
76{
77 int i;
78
79 if (PCI_SLOT(dev->devfn) == EMMA2RH_PCI_HOST_SLOT) {
80 dev->class &= 0xff;
81 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
82 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
83 dev->resource[i].start = 0;
84 dev->resource[i].end = 0;
85 dev->resource[i].flags = 0;
86 }
87 }
88}
89
90DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_EMMA2RH,
91 emma2rh_pci_host_fixup);
92
93int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
94{
95 return irq_map[slot][pin];
96}
97
98/* Do platform specific device initialization at pci_enable_device() time */
99int pcibios_plat_dev_init(struct pci_dev *dev)
100{
101 return 0;
102}
diff --git a/arch/mips/pci/fixup-excite.c b/arch/mips/pci/fixup-excite.c
new file mode 100644
index 000000000000..1da696d43f00
--- /dev/null
+++ b/arch/mips/pci/fixup-excite.c
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/pci.h>
22#include <excite.h>
23
24int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
25{
26 if (pin == 0)
27 return -1;
28
29 return USB_IRQ; /* USB controller is the only PCI device */
30}
31
32/* Do platform specific device initialization at pci_enable_device() time */
33int pcibios_plat_dev_init(struct pci_dev *dev)
34{
35 return 0;
36}
diff --git a/arch/mips/pci/fixup-wrppmc.c b/arch/mips/pci/fixup-wrppmc.c
new file mode 100644
index 000000000000..3357c1300bb1
--- /dev/null
+++ b/arch/mips/pci/fixup-wrppmc.c
@@ -0,0 +1,37 @@
1/*
2 * fixup-wrppmc.c: PPMC board specific PCI fixup
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2006, Wind River Inc. Rongkai.zhan (rongkai.zhan@windriver.com)
9 */
10#include <linux/init.h>
11#include <linux/pci.h>
12#include <asm/gt64120.h>
13
14/* PCI interrupt pins */
15#define PCI_INTA 1
16#define PCI_INTB 2
17#define PCI_INTC 3
18#define PCI_INTD 4
19
20#define PCI_SLOT_MAXNR 32 /* Each PCI bus has 32 physical slots */
21
22static char pci_irq_tab[PCI_SLOT_MAXNR][5] __initdata = {
23 /* 0 INTA INTB INTC INTD */
24 [0] = {0, 0, 0, 0, 0}, /* Slot 0: GT64120 PCI bridge */
25 [6] = {0, WRPPMC_PCI_INTA_IRQ, 0, 0, 0},
26};
27
28int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
29{
30 return pci_irq_tab[slot][pin];
31}
32
33/* Do platform specific device initialization at pci_enable_device() time */
34int pcibios_plat_dev_init(struct pci_dev *dev)
35{
36 return 0;
37}
diff --git a/arch/mips/pci/ops-bridge.c b/arch/mips/pci/ops-bridge.c
new file mode 100644
index 000000000000..1fa09929cd7a
--- /dev/null
+++ b/arch/mips/pci/ops-bridge.c
@@ -0,0 +1,306 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999, 2000, 04, 06 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#include <linux/pci.h>
10#include <asm/paccess.h>
11#include <asm/pci/bridge.h>
12#include <asm/sn/arch.h>
13#include <asm/sn/intr.h>
14#include <asm/sn/sn0/hub.h>
15
16/*
17 * The Bridge ASIC supports both type 0 and type 1 access. Type 1 is
18 * not really documented, so right now I can't write code which uses it.
19 * Therefore we use type 0 accesses for now even though they won't work
20 * correcly for PCI-to-PCI bridges.
21 *
22 * The function is complicated by the ultimate brokeness of the IOC3 chip
23 * which is used in SGI systems. The IOC3 can only handle 32-bit PCI
24 * accesses and does only decode parts of it's address space.
25 */
26
27static int pci_conf0_read_config(struct pci_bus *bus, unsigned int devfn,
28 int where, int size, u32 * value)
29{
30 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
31 bridge_t *bridge = bc->base;
32 int slot = PCI_SLOT(devfn);
33 int fn = PCI_FUNC(devfn);
34 volatile void *addr;
35 u32 cf, shift, mask;
36 int res;
37
38 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
39 if (get_dbe(cf, (u32 *) addr))
40 return PCIBIOS_DEVICE_NOT_FOUND;
41
42 /*
43 * IOC3 is fucked fucked beyond believe ... Don't even give the
44 * generic PCI code a chance to look at it for real ...
45 */
46 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
47 goto oh_my_gawd;
48
49 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
50
51 if (size == 1)
52 res = get_dbe(*value, (u8 *) addr);
53 else if (size == 2)
54 res = get_dbe(*value, (u16 *) addr);
55 else
56 res = get_dbe(*value, (u32 *) addr);
57
58 return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
59
60oh_my_gawd:
61
62 /*
63 * IOC3 is fucked fucked beyond believe ... Don't even give the
64 * generic PCI code a chance to look at the wrong register.
65 */
66 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
67 *value = 0;
68 return PCIBIOS_SUCCESSFUL;
69 }
70
71 /*
72 * IOC3 is fucked fucked beyond believe ... Don't try to access
73 * anything but 32-bit words ...
74 */
75 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
76
77 if (get_dbe(cf, (u32 *) addr))
78 return PCIBIOS_DEVICE_NOT_FOUND;
79
80 shift = ((where & 3) << 3);
81 mask = (0xffffffffU >> ((4 - size) << 3));
82 *value = (cf >> shift) & mask;
83
84 return PCIBIOS_SUCCESSFUL;
85}
86
87static int pci_conf1_read_config(struct pci_bus *bus, unsigned int devfn,
88 int where, int size, u32 * value)
89{
90 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
91 bridge_t *bridge = bc->base;
92 int busno = bus->number;
93 int slot = PCI_SLOT(devfn);
94 int fn = PCI_FUNC(devfn);
95 volatile void *addr;
96 u32 cf, shift, mask;
97 int res;
98
99 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
100 addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
101 if (get_dbe(cf, (u32 *) addr))
102 return PCIBIOS_DEVICE_NOT_FOUND;
103
104 /*
105 * IOC3 is fucked fucked beyond believe ... Don't even give the
106 * generic PCI code a chance to look at it for real ...
107 */
108 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
109 goto oh_my_gawd;
110
111 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
112 addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
113
114 if (size == 1)
115 res = get_dbe(*value, (u8 *) addr);
116 else if (size == 2)
117 res = get_dbe(*value, (u16 *) addr);
118 else
119 res = get_dbe(*value, (u32 *) addr);
120
121 return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
122
123oh_my_gawd:
124
125 /*
126 * IOC3 is fucked fucked beyond believe ... Don't even give the
127 * generic PCI code a chance to look at the wrong register.
128 */
129 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
130 *value = 0;
131 return PCIBIOS_SUCCESSFUL;
132 }
133
134 /*
135 * IOC3 is fucked fucked beyond believe ... Don't try to access
136 * anything but 32-bit words ...
137 */
138 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
139 addr = &bridge->b_type1_cfg.c[(fn << 8) | where];
140
141 if (get_dbe(cf, (u32 *) addr))
142 return PCIBIOS_DEVICE_NOT_FOUND;
143
144 shift = ((where & 3) << 3);
145 mask = (0xffffffffU >> ((4 - size) << 3));
146 *value = (cf >> shift) & mask;
147
148 return PCIBIOS_SUCCESSFUL;
149}
150
151static int pci_read_config(struct pci_bus *bus, unsigned int devfn,
152 int where, int size, u32 * value)
153{
154 if (bus->number > 0)
155 return pci_conf1_read_config(bus, devfn, where, size, value);
156
157 return pci_conf0_read_config(bus, devfn, where, size, value);
158}
159
160static int pci_conf0_write_config(struct pci_bus *bus, unsigned int devfn,
161 int where, int size, u32 value)
162{
163 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
164 bridge_t *bridge = bc->base;
165 int slot = PCI_SLOT(devfn);
166 int fn = PCI_FUNC(devfn);
167 volatile void *addr;
168 u32 cf, shift, mask, smask;
169 int res;
170
171 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
172 if (get_dbe(cf, (u32 *) addr))
173 return PCIBIOS_DEVICE_NOT_FOUND;
174
175 /*
176 * IOC3 is fucked fucked beyond believe ... Don't even give the
177 * generic PCI code a chance to look at it for real ...
178 */
179 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
180 goto oh_my_gawd;
181
182 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
183
184 if (size == 1) {
185 res = put_dbe(value, (u8 *) addr);
186 } else if (size == 2) {
187 res = put_dbe(value, (u16 *) addr);
188 } else {
189 res = put_dbe(value, (u32 *) addr);
190 }
191
192 if (res)
193 return PCIBIOS_DEVICE_NOT_FOUND;
194
195 return PCIBIOS_SUCCESSFUL;
196
197oh_my_gawd:
198
199 /*
200 * IOC3 is fucked fucked beyond believe ... Don't even give the
201 * generic PCI code a chance to touch the wrong register.
202 */
203 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
204 return PCIBIOS_SUCCESSFUL;
205
206 /*
207 * IOC3 is fucked fucked beyond believe ... Don't try to access
208 * anything but 32-bit words ...
209 */
210 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
211
212 if (get_dbe(cf, (u32 *) addr))
213 return PCIBIOS_DEVICE_NOT_FOUND;
214
215 shift = ((where & 3) << 3);
216 mask = (0xffffffffU >> ((4 - size) << 3));
217 smask = mask << shift;
218
219 cf = (cf & ~smask) | ((value & mask) << shift);
220 if (put_dbe(cf, (u32 *) addr))
221 return PCIBIOS_DEVICE_NOT_FOUND;
222
223 return PCIBIOS_SUCCESSFUL;
224}
225
226static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
227 int where, int size, u32 value)
228{
229 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
230 bridge_t *bridge = bc->base;
231 int slot = PCI_SLOT(devfn);
232 int fn = PCI_FUNC(devfn);
233 int busno = bus->number;
234 volatile void *addr;
235 u32 cf, shift, mask, smask;
236 int res;
237
238 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
239 addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
240 if (get_dbe(cf, (u32 *) addr))
241 return PCIBIOS_DEVICE_NOT_FOUND;
242
243 /*
244 * IOC3 is fucked fucked beyond believe ... Don't even give the
245 * generic PCI code a chance to look at it for real ...
246 */
247 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
248 goto oh_my_gawd;
249
250 addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
251
252 if (size == 1) {
253 res = put_dbe(value, (u8 *) addr);
254 } else if (size == 2) {
255 res = put_dbe(value, (u16 *) addr);
256 } else {
257 res = put_dbe(value, (u32 *) addr);
258 }
259
260 if (res)
261 return PCIBIOS_DEVICE_NOT_FOUND;
262
263 return PCIBIOS_SUCCESSFUL;
264
265oh_my_gawd:
266
267 /*
268 * IOC3 is fucked fucked beyond believe ... Don't even give the
269 * generic PCI code a chance to touch the wrong register.
270 */
271 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
272 return PCIBIOS_SUCCESSFUL;
273
274 /*
275 * IOC3 is fucked fucked beyond believe ... Don't try to access
276 * anything but 32-bit words ...
277 */
278 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
279
280 if (get_dbe(cf, (u32 *) addr))
281 return PCIBIOS_DEVICE_NOT_FOUND;
282
283 shift = ((where & 3) << 3);
284 mask = (0xffffffffU >> ((4 - size) << 3));
285 smask = mask << shift;
286
287 cf = (cf & ~smask) | ((value & mask) << shift);
288 if (put_dbe(cf, (u32 *) addr))
289 return PCIBIOS_DEVICE_NOT_FOUND;
290
291 return PCIBIOS_SUCCESSFUL;
292}
293
294static int pci_write_config(struct pci_bus *bus, unsigned int devfn,
295 int where, int size, u32 value)
296{
297 if (bus->number > 0)
298 return pci_conf1_write_config(bus, devfn, where, size, value);
299
300 return pci_conf0_write_config(bus, devfn, where, size, value);
301}
302
303struct pci_ops bridge_pci_ops = {
304 .read = pci_read_config,
305 .write = pci_write_config,
306};
diff --git a/arch/mips/pci/ops-ddb5074.c b/arch/mips/pci/ops-ddb5074.c
deleted file mode 100644
index 89f97bef4fc4..000000000000
--- a/arch/mips/pci/ops-ddb5074.c
+++ /dev/null
@@ -1,271 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/ddb5xxx/ddb5476/pci_ops.c
6 * Define the pci_ops for DB5477.
7 *
8 * Much of the code is derived from the original DDB5074 port by
9 * Geert Uytterhoeven <geert@sonycom.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17#include <linux/pci.h>
18#include <linux/kernel.h>
19#include <linux/types.h>
20
21#include <asm/addrspace.h>
22#include <asm/debug.h>
23
24#include <asm/ddb5xxx/ddb5xxx.h>
25
26/*
27 * config_swap structure records what set of pdar/pmr are used
28 * to access pci config space. It also provides a place hold the
29 * original values for future restoring.
30 */
31struct pci_config_swap {
32 u32 pdar;
33 u32 pmr;
34 u32 config_base;
35 u32 config_size;
36 u32 pdar_backup;
37 u32 pmr_backup;
38};
39
40/*
41 * On DDB5476, we have one set of swap registers
42 */
43struct pci_config_swap ext_pci_swap = {
44 DDB_PCIW0,
45 DDB_PCIINIT0,
46 DDB_PCI_CONFIG_BASE,
47 DDB_PCI_CONFIG_SIZE
48};
49
50static int pci_config_workaround = 1;
51
52/*
53 * access config space
54 */
55static inline u32 ddb_access_config_base(struct pci_config_swap *swap, u32 bus, /* 0 means top level bus */
56 u32 slot_num)
57{
58 u32 pci_addr = 0;
59 u32 pciinit_offset = 0;
60 u32 virt_addr = swap->config_base;
61 u32 option;
62
63 if (pci_config_workaround) {
64 if (slot_num == 5)
65 slot_num = 14;
66 } else {
67 if (slot_num == 5)
68 return DDB_BASE + DDB_PCI_BASE;
69 }
70
71 /* minimum pdar (window) size is 2MB */
72 db_assert(swap->config_size >= (2 << 20));
73
74 db_assert(slot_num < (1 << 5));
75 db_assert(bus < (1 << 8));
76
77 /* backup registers */
78 swap->pdar_backup = ddb_in32(swap->pdar);
79 swap->pmr_backup = ddb_in32(swap->pmr);
80
81 /* set the pdar (pci window) register */
82 ddb_set_pdar(swap->pdar, swap->config_base, swap->config_size, 32, /* 32 bit wide */
83 0, /* not on local memory bus */
84 0); /* not visible from PCI bus (N/A) */
85
86 /*
87 * calcuate the absolute pci config addr;
88 * according to the spec, we start scanning from adr:11 (0x800)
89 */
90 if (bus == 0) {
91 /* type 0 config */
92 pci_addr = 0x00040000 << slot_num;
93 } else {
94 /* type 1 config */
95 pci_addr = 0x00040000 << slot_num;
96 panic
97 ("ddb_access_config_base: we don't support type 1 config Yet");
98 }
99
100 /*
101 * if pci_addr is less than pci config window size, we set
102 * pciinit_offset to 0 and adjust the virt_address.
103 * Otherwise we will try to adjust pciinit_offset.
104 */
105 if (pci_addr < swap->config_size) {
106 virt_addr = KSEG1ADDR(swap->config_base + pci_addr);
107 pciinit_offset = 0;
108 } else {
109 db_assert((pci_addr & (swap->config_size - 1)) == 0);
110 virt_addr = KSEG1ADDR(swap->config_base);
111 pciinit_offset = pci_addr;
112 }
113
114 /* set the pmr register */
115 option = DDB_PCI_ACCESS_32;
116 if (bus != 0)
117 option |= DDB_PCI_CFGTYPE1;
118 ddb_set_pmr(swap->pmr, DDB_PCICMD_CFG, pciinit_offset, option);
119
120 return virt_addr;
121}
122
123static inline void ddb_close_config_base(struct pci_config_swap *swap)
124{
125 ddb_out32(swap->pdar, swap->pdar_backup);
126 ddb_out32(swap->pmr, swap->pmr_backup);
127}
128
129static int read_config_dword(struct pci_config_swap *swap,
130 struct pci_dev *dev, u32 where, u32 * val)
131{
132 u32 bus, slot_num, func_num;
133 u32 base;
134
135 db_assert((where & 3) == 0);
136 db_assert(where < (1 << 8));
137
138 /* check if the bus is top-level */
139 if (dev->bus->parent != NULL) {
140 bus = dev->bus->number;
141 db_assert(bus != 0);
142 } else {
143 bus = 0;
144 }
145
146 slot_num = PCI_SLOT(dev->devfn);
147 func_num = PCI_FUNC(dev->devfn);
148 base = ddb_access_config_base(swap, bus, slot_num);
149 *val = *(volatile u32 *) (base + (func_num << 8) + where);
150 ddb_close_config_base(swap);
151 return PCIBIOS_SUCCESSFUL;
152}
153
154static int read_config_word(struct pci_config_swap *swap,
155 struct pci_dev *dev, u32 where, u16 * val)
156{
157 int status;
158 u32 result;
159
160 db_assert((where & 1) == 0);
161
162 status = read_config_dword(swap, dev, where & ~3, &result);
163 if (where & 2)
164 result >>= 16;
165 *val = result & 0xffff;
166 return status;
167}
168
169static int read_config_byte(struct pci_config_swap *swap,
170 struct pci_dev *dev, u32 where, u8 * val)
171{
172 int status;
173 u32 result;
174
175 status = read_config_dword(swap, dev, where & ~3, &result);
176 if (where & 1)
177 result >>= 8;
178 if (where & 2)
179 result >>= 16;
180 *val = result & 0xff;
181 return status;
182}
183
184static int write_config_dword(struct pci_config_swap *swap,
185 struct pci_dev *dev, u32 where, u32 val)
186{
187 u32 bus, slot_num, func_num;
188 u32 base;
189
190 db_assert((where & 3) == 0);
191 db_assert(where < (1 << 8));
192
193 /* check if the bus is top-level */
194 if (dev->bus->parent != NULL) {
195 bus = dev->bus->number;
196 db_assert(bus != 0);
197 } else {
198 bus = 0;
199 }
200
201 slot_num = PCI_SLOT(dev->devfn);
202 func_num = PCI_FUNC(dev->devfn);
203 base = ddb_access_config_base(swap, bus, slot_num);
204 *(volatile u32 *) (base + (func_num << 8) + where) = val;
205 ddb_close_config_base(swap);
206 return PCIBIOS_SUCCESSFUL;
207}
208
209static int write_config_word(struct pci_config_swap *swap,
210 struct pci_dev *dev, u32 where, u16 val)
211{
212 int status, shift = 0;
213 u32 result;
214
215 db_assert((where & 1) == 0);
216
217 status = read_config_dword(swap, dev, where & ~3, &result);
218 if (status != PCIBIOS_SUCCESSFUL)
219 return status;
220
221 if (where & 2)
222 shift += 16;
223 result &= ~(0xffff << shift);
224 result |= val << shift;
225 return write_config_dword(swap, dev, where & ~3, result);
226}
227
228static int write_config_byte(struct pci_config_swap *swap,
229 struct pci_dev *dev, u32 where, u8 val)
230{
231 int status, shift = 0;
232 u32 result;
233
234 status = read_config_dword(swap, dev, where & ~3, &result);
235 if (status != PCIBIOS_SUCCESSFUL)
236 return status;
237
238 if (where & 2)
239 shift += 16;
240 if (where & 1)
241 shift += 8;
242 result &= ~(0xff << shift);
243 result |= val << shift;
244 return write_config_dword(swap, dev, where & ~3, result);
245}
246
247#define MAKE_PCI_OPS(prefix, rw, unitname, unittype, pciswap) \
248static int prefix##_##rw##_config_##unitname(struct pci_dev *dev, int where, unittype val) \
249{ \
250 return rw##_config_##unitname(pciswap, \
251 dev, \
252 where, \
253 val); \
254}
255
256MAKE_PCI_OPS(extpci, read, byte, u8 *, &ext_pci_swap)
257 MAKE_PCI_OPS(extpci, read, word, u16 *, &ext_pci_swap)
258 MAKE_PCI_OPS(extpci, read, dword, u32 *, &ext_pci_swap)
259
260 MAKE_PCI_OPS(extpci, write, byte, u8, &ext_pci_swap)
261 MAKE_PCI_OPS(extpci, write, word, u16, &ext_pci_swap)
262 MAKE_PCI_OPS(extpci, write, dword, u32, &ext_pci_swap)
263
264struct pci_ops ddb5476_ext_pci_ops = {
265 extpci_read_config_byte,
266 extpci_read_config_word,
267 extpci_read_config_dword,
268 extpci_write_config_byte,
269 extpci_write_config_word,
270 extpci_write_config_dword
271};
diff --git a/arch/mips/pci/ops-ddb5476.c b/arch/mips/pci/ops-ddb5476.c
deleted file mode 100644
index 12da58e75ec7..000000000000
--- a/arch/mips/pci/ops-ddb5476.c
+++ /dev/null
@@ -1,286 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/ddb5xxx/ddb5476/pci_ops.c
6 * Define the pci_ops for DB5477.
7 *
8 * Much of the code is derived from the original DDB5074 port by
9 * Geert Uytterhoeven <geert@sonycom.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17#include <linux/pci.h>
18#include <linux/kernel.h>
19#include <linux/types.h>
20
21#include <asm/addrspace.h>
22#include <asm/debug.h>
23
24#include <asm/ddb5xxx/ddb5xxx.h>
25
26/*
27 * config_swap structure records what set of pdar/pmr are used
28 * to access pci config space. It also provides a place hold the
29 * original values for future restoring.
30 */
31struct pci_config_swap {
32 u32 pdar;
33 u32 pmr;
34 u32 config_base;
35 u32 config_size;
36 u32 pdar_backup;
37 u32 pmr_backup;
38};
39
40/*
41 * On DDB5476, we have one set of swap registers
42 */
43struct pci_config_swap ext_pci_swap = {
44 DDB_PCIW0,
45 DDB_PCIINIT0,
46 DDB_PCI_CONFIG_BASE,
47 DDB_PCI_CONFIG_SIZE
48};
49
50static int pci_config_workaround = 1;
51
52/*
53 * access config space
54 */
55static inline u32 ddb_access_config_base(struct pci_config_swap *swap, u32 bus, /* 0 means top level bus */
56 u32 slot_num)
57{
58 u32 pci_addr = 0;
59 u32 pciinit_offset = 0;
60 u32 virt_addr = swap->config_base;
61 u32 option;
62
63 if (pci_config_workaround) {
64 /* [jsun] work around Vrc5476 controller itself, returnning
65 * slot 0 essentially makes vrc5476 invisible
66 */
67 if (slot_num == 12)
68 slot_num = 0;
69
70#if 0
71 /* BUG : skip P2P bridge for now */
72 if (slot_num == 5)
73 slot_num = 0;
74#endif
75
76 } else {
77 /* now we have to be hornest, returning the true
78 * PCI config headers for vrc5476
79 */
80 if (slot_num == 12) {
81 swap->pdar_backup = ddb_in32(swap->pdar);
82 swap->pmr_backup = ddb_in32(swap->pmr);
83 return DDB_BASE + DDB_PCI_BASE;
84 }
85 }
86
87 /* minimum pdar (window) size is 2MB */
88 db_assert(swap->config_size >= (2 << 20));
89
90 db_assert(slot_num < (1 << 5));
91 db_assert(bus < (1 << 8));
92
93 /* backup registers */
94 swap->pdar_backup = ddb_in32(swap->pdar);
95 swap->pmr_backup = ddb_in32(swap->pmr);
96
97 /* set the pdar (pci window) register */
98 ddb_set_pdar(swap->pdar, swap->config_base, swap->config_size, 32, /* 32 bit wide */
99 0, /* not on local memory bus */
100 0); /* not visible from PCI bus (N/A) */
101
102 /*
103 * calcuate the absolute pci config addr;
104 * according to the spec, we start scanning from adr:11 (0x800)
105 */
106 if (bus == 0) {
107 /* type 0 config */
108 pci_addr = 0x800 << slot_num;
109 } else {
110 /* type 1 config */
111 pci_addr = (bus << 16) | (slot_num << 11);
112 /* panic("ddb_access_config_base: we don't support type 1 config Yet"); */
113 }
114
115 /*
116 * if pci_addr is less than pci config window size, we set
117 * pciinit_offset to 0 and adjust the virt_address.
118 * Otherwise we will try to adjust pciinit_offset.
119 */
120 if (pci_addr < swap->config_size) {
121 virt_addr = KSEG1ADDR(swap->config_base + pci_addr);
122 pciinit_offset = 0;
123 } else {
124 db_assert((pci_addr & (swap->config_size - 1)) == 0);
125 virt_addr = KSEG1ADDR(swap->config_base);
126 pciinit_offset = pci_addr;
127 }
128
129 /* set the pmr register */
130 option = DDB_PCI_ACCESS_32;
131 if (bus != 0)
132 option |= DDB_PCI_CFGTYPE1;
133 ddb_set_pmr(swap->pmr, DDB_PCICMD_CFG, pciinit_offset, option);
134
135 return virt_addr;
136}
137
138static inline void ddb_close_config_base(struct pci_config_swap *swap)
139{
140 ddb_out32(swap->pdar, swap->pdar_backup);
141 ddb_out32(swap->pmr, swap->pmr_backup);
142}
143
144static int read_config_dword(struct pci_config_swap *swap,
145 struct pci_dev *dev, u32 where, u32 * val)
146{
147 u32 bus, slot_num, func_num;
148 u32 base;
149
150 db_assert((where & 3) == 0);
151 db_assert(where < (1 << 8));
152
153 /* check if the bus is top-level */
154 if (dev->bus->parent != NULL) {
155 bus = dev->bus->number;
156 db_assert(bus != 0);
157 } else {
158 bus = 0;
159 }
160
161 slot_num = PCI_SLOT(dev->devfn);
162 func_num = PCI_FUNC(dev->devfn);
163 base = ddb_access_config_base(swap, bus, slot_num);
164 *val = *(volatile u32 *) (base + (func_num << 8) + where);
165 ddb_close_config_base(swap);
166 return PCIBIOS_SUCCESSFUL;
167}
168
169static int read_config_word(struct pci_config_swap *swap,
170 struct pci_dev *dev, u32 where, u16 * val)
171{
172 int status;
173 u32 result;
174
175 db_assert((where & 1) == 0);
176
177 status = read_config_dword(swap, dev, where & ~3, &result);
178 if (where & 2)
179 result >>= 16;
180 *val = result & 0xffff;
181 return status;
182}
183
184static int read_config_byte(struct pci_config_swap *swap,
185 struct pci_dev *dev, u32 where, u8 * val)
186{
187 int status;
188 u32 result;
189
190 status = read_config_dword(swap, dev, where & ~3, &result);
191 if (where & 1)
192 result >>= 8;
193 if (where & 2)
194 result >>= 16;
195 *val = result & 0xff;
196 return status;
197}
198
199static int write_config_dword(struct pci_config_swap *swap,
200 struct pci_dev *dev, u32 where, u32 val)
201{
202 u32 bus, slot_num, func_num;
203 u32 base;
204
205 db_assert((where & 3) == 0);
206 db_assert(where < (1 << 8));
207
208 /* check if the bus is top-level */
209 if (dev->bus->parent != NULL) {
210 bus = dev->bus->number;
211 db_assert(bus != 0);
212 } else {
213 bus = 0;
214 }
215
216 slot_num = PCI_SLOT(dev->devfn);
217 func_num = PCI_FUNC(dev->devfn);
218 base = ddb_access_config_base(swap, bus, slot_num);
219 *(volatile u32 *) (base + (func_num << 8) + where) = val;
220 ddb_close_config_base(swap);
221 return PCIBIOS_SUCCESSFUL;
222}
223
224static int write_config_word(struct pci_config_swap *swap,
225 struct pci_dev *dev, u32 where, u16 val)
226{
227 int status, shift = 0;
228 u32 result;
229
230 db_assert((where & 1) == 0);
231
232 status = read_config_dword(swap, dev, where & ~3, &result);
233 if (status != PCIBIOS_SUCCESSFUL)
234 return status;
235
236 if (where & 2)
237 shift += 16;
238 result &= ~(0xffff << shift);
239 result |= val << shift;
240 return write_config_dword(swap, dev, where & ~3, result);
241}
242
243static int write_config_byte(struct pci_config_swap *swap,
244 struct pci_dev *dev, u32 where, u8 val)
245{
246 int status, shift = 0;
247 u32 result;
248
249 status = read_config_dword(swap, dev, where & ~3, &result);
250 if (status != PCIBIOS_SUCCESSFUL)
251 return status;
252
253 if (where & 2)
254 shift += 16;
255 if (where & 1)
256 shift += 8;
257 result &= ~(0xff << shift);
258 result |= val << shift;
259 return write_config_dword(swap, dev, where & ~3, result);
260}
261
262#define MAKE_PCI_OPS(prefix, rw, unitname, unittype, pciswap) \
263static int prefix##_##rw##_config_##unitname(struct pci_dev *dev, int where, unittype val) \
264{ \
265 return rw##_config_##unitname(pciswap, \
266 dev, \
267 where, \
268 val); \
269}
270
271MAKE_PCI_OPS(extpci, read, byte, u8 *, &ext_pci_swap)
272 MAKE_PCI_OPS(extpci, read, word, u16 *, &ext_pci_swap)
273 MAKE_PCI_OPS(extpci, read, dword, u32 *, &ext_pci_swap)
274
275 MAKE_PCI_OPS(extpci, write, byte, u8, &ext_pci_swap)
276 MAKE_PCI_OPS(extpci, write, word, u16, &ext_pci_swap)
277 MAKE_PCI_OPS(extpci, write, dword, u32, &ext_pci_swap)
278
279struct pci_ops ddb5476_ext_pci_ops = {
280 extpci_read_config_byte,
281 extpci_read_config_word,
282 extpci_read_config_dword,
283 extpci_write_config_byte,
284 extpci_write_config_word,
285 extpci_write_config_dword
286};
diff --git a/arch/mips/pci/ops-emma2rh.c b/arch/mips/pci/ops-emma2rh.c
new file mode 100644
index 000000000000..e21b11bf66bc
--- /dev/null
+++ b/arch/mips/pci/ops-emma2rh.c
@@ -0,0 +1,186 @@
1/*
2 * arch/mips/pci/ops-emma2rh.c
3 * This file defines the PCI operation for EMMA2RH.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/pci/ops-vr41xx.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#include <linux/config.h>
27#include <linux/pci.h>
28#include <linux/kernel.h>
29#include <linux/types.h>
30
31#include <asm/addrspace.h>
32#include <asm/debug.h>
33
34#include <asm/emma2rh/emma2rh.h>
35
36#define RTABORT (0x1<<9)
37#define RMABORT (0x1<<10)
38#define EMMA2RH_PCI_SLOT_NUM 9 /* 0000:09.0 is final PCI device */
39
40/*
41 * access config space
42 */
43
44static int check_args(struct pci_bus *bus, u32 devfn, u32 * bus_num)
45{
46 /* check if the bus is top-level */
47 if (bus->parent != NULL) {
48 *bus_num = bus->number;
49 db_assert(bus_num != 0);
50 } else
51 *bus_num = 0;
52
53 if (*bus_num == 0) {
54 /* Type 0 */
55 if (PCI_SLOT(devfn) >= 10)
56 return PCIBIOS_DEVICE_NOT_FOUND;
57 } else {
58 /* Type 1 */
59 if ((*bus_num >= 64) || (PCI_SLOT(devfn) >= 16))
60 return PCIBIOS_DEVICE_NOT_FOUND;
61 }
62 return 0;
63}
64
65static inline int set_pci_configuration_address(unsigned char bus_num,
66 unsigned int devfn, int where)
67{
68 u32 config_win0;
69
70 emma2rh_out32(EMMA2RH_PCI_INT, ~RMABORT);
71 if (bus_num == 0)
72 /*
73 * Type 0 configuration
74 */
75 config_win0 = (1 << (22 + PCI_SLOT(devfn))) | (5 << 9);
76 else
77 /*
78 * Type 1 configuration
79 */
80 config_win0 = (bus_num << 26) | (PCI_SLOT(devfn) << 22) |
81 (1 << 15) | (5 << 9);
82
83 emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, config_win0);
84
85 return 0;
86}
87
88static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where,
89 int size, uint32_t * val)
90{
91 u32 bus_num;
92 u32 base = KSEG1ADDR(EMMA2RH_PCI_CONFIG_BASE);
93 u32 backup_win0;
94 u32 data;
95
96 *val = 0xffffffffU;
97
98 if (check_args(bus, devfn, &bus_num) == PCIBIOS_DEVICE_NOT_FOUND)
99 return PCIBIOS_DEVICE_NOT_FOUND;
100
101 backup_win0 = emma2rh_in32(EMMA2RH_PCI_IWIN0_CTR);
102
103 if (set_pci_configuration_address(bus_num, devfn, where) < 0)
104 return PCIBIOS_DEVICE_NOT_FOUND;
105
106 data =
107 *(volatile u32 *)(base + (PCI_FUNC(devfn) << 8) +
108 (where & 0xfffffffc));
109
110 switch (size) {
111 case 1:
112 *val = (data >> ((where & 3) << 3)) & 0xffU;
113 break;
114 case 2:
115 *val = (data >> ((where & 2) << 3)) & 0xffffU;
116 break;
117 case 4:
118 *val = data;
119 break;
120 default:
121 emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, backup_win0);
122 return PCIBIOS_FUNC_NOT_SUPPORTED;
123 }
124
125 emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, backup_win0);
126
127 if (emma2rh_in32(EMMA2RH_PCI_INT) & RMABORT)
128 return PCIBIOS_DEVICE_NOT_FOUND;
129
130 return PCIBIOS_SUCCESSFUL;
131}
132
133static int pci_config_write(struct pci_bus *bus, unsigned int devfn, int where,
134 int size, u32 val)
135{
136 u32 bus_num;
137 u32 base = KSEG1ADDR(EMMA2RH_PCI_CONFIG_BASE);
138 u32 backup_win0;
139 u32 data;
140 int shift;
141
142 if (check_args(bus, devfn, &bus_num) == PCIBIOS_DEVICE_NOT_FOUND)
143 return PCIBIOS_DEVICE_NOT_FOUND;
144
145 backup_win0 = emma2rh_in32(EMMA2RH_PCI_IWIN0_CTR);
146
147 if (set_pci_configuration_address(bus_num, devfn, where) < 0)
148 return PCIBIOS_DEVICE_NOT_FOUND;
149
150 /* read modify write */
151 data =
152 *(volatile u32 *)(base + (PCI_FUNC(devfn) << 8) +
153 (where & 0xfffffffc));
154
155 switch (size) {
156 case 1:
157 shift = (where & 3) << 3;
158 data &= ~(0xffU << shift);
159 data |= ((val & 0xffU) << shift);
160 break;
161 case 2:
162 shift = (where & 2) << 3;
163 data &= ~(0xffffU << shift);
164 data |= ((val & 0xffffU) << shift);
165 break;
166 case 4:
167 data = val;
168 break;
169 default:
170 emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, backup_win0);
171 return PCIBIOS_FUNC_NOT_SUPPORTED;
172 }
173 *(volatile u32 *)(base + (PCI_FUNC(devfn) << 8) +
174 (where & 0xfffffffc)) = data;
175
176 emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, backup_win0);
177 if (emma2rh_in32(EMMA2RH_PCI_INT) & RMABORT)
178 return PCIBIOS_DEVICE_NOT_FOUND;
179
180 return PCIBIOS_SUCCESSFUL;
181}
182
183struct pci_ops emma2rh_pci_ops = {
184 .read = pci_config_read,
185 .write = pci_config_write,
186};
diff --git a/arch/mips/pci/ops-it8172.c b/arch/mips/pci/ops-it8172.c
index b7a8b9a6f9db..ba8328505a0a 100644
--- a/arch/mips/pci/ops-it8172.c
+++ b/arch/mips/pci/ops-it8172.c
@@ -50,30 +50,28 @@
50static struct resource pci_mem_resource_1; 50static struct resource pci_mem_resource_1;
51 51
52static struct resource pci_io_resource = { 52static struct resource pci_io_resource = {
53 "io pci IO space", 53 .start = 0x14018000,
54 0x14018000, 54 .end = 0x17FFFFFF,
55 0x17FFFFFF, 55 .name = "io pci IO space",
56 IORESOURCE_IO 56 .flags = IORESOURCE_IO
57}; 57};
58 58
59static struct resource pci_mem_resource_0 = { 59static struct resource pci_mem_resource_0 = {
60 "ext pci memory space 0/1", 60 .start = 0x10101000,
61 0x10101000, 61 .end = 0x13FFFFFF,
62 0x13FFFFFF, 62 .name = "ext pci memory space 0/1",
63 IORESOURCE_MEM, 63 .flags = IORESOURCE_MEM,
64 &pci_mem_resource_0, 64 .parent = &pci_mem_resource_0,
65 NULL, 65 .sibling = NULL,
66 &pci_mem_resource_1 66 .child = &pci_mem_resource_1
67}; 67};
68 68
69static struct resource pci_mem_resource_1 = { 69static struct resource pci_mem_resource_1 = {
70 "ext pci memory space 2/3", 70 .start = 0x1A000000,
71 0x1A000000, 71 .end = 0x1FBFFFFF,
72 0x1FBFFFFF, 72 .name = "ext pci memory space 2/3",
73 IORESOURCE_MEM, 73 .flags = IORESOURCE_MEM,
74 &pci_mem_resource_0, 74 .parent = &pci_mem_resource_0
75 NULL,
76 NULL
77}; 75};
78 76
79extern struct pci_ops it8172_pci_ops; 77extern struct pci_ops it8172_pci_ops;
diff --git a/arch/mips/pci/ops-sni.c b/arch/mips/pci/ops-sni.c
index 62bdd19c7f8e..2b0ccd6d9dcd 100644
--- a/arch/mips/pci/ops-sni.c
+++ b/arch/mips/pci/ops-sni.c
@@ -47,13 +47,13 @@ static int pcimt_read(struct pci_bus *bus, unsigned int devfn, int reg,
47 47
48 switch (size) { 48 switch (size) {
49 case 1: 49 case 1:
50 *val = *(volatile u8 *) (PCIMT_CONFIG_DATA + (reg & 3)); 50 *val = inb(PCIMT_CONFIG_DATA + (reg & 3));
51 break; 51 break;
52 case 2: 52 case 2:
53 *val = *(volatile u16 *) (PCIMT_CONFIG_DATA + (reg & 2)); 53 *val = inw(PCIMT_CONFIG_DATA + (reg & 2));
54 break; 54 break;
55 case 4: 55 case 4:
56 *val = *(volatile u32 *) PCIMT_CONFIG_DATA; 56 *val = inl(PCIMT_CONFIG_DATA);
57 break; 57 break;
58 } 58 }
59 59
@@ -70,13 +70,13 @@ static int pcimt_write(struct pci_bus *bus, unsigned int devfn, int reg,
70 70
71 switch (size) { 71 switch (size) {
72 case 1: 72 case 1:
73 *(volatile u8 *) (PCIMT_CONFIG_DATA + (reg & 3)) = val; 73 outb (val, PCIMT_CONFIG_DATA + (reg & 3));
74 break; 74 break;
75 case 2: 75 case 2:
76 *(volatile u16 *) (PCIMT_CONFIG_DATA + (reg & 2)) = val; 76 outw (val, PCIMT_CONFIG_DATA + (reg & 2));
77 break; 77 break;
78 case 4: 78 case 4:
79 *(volatile u32 *) PCIMT_CONFIG_DATA = val; 79 outl (val, PCIMT_CONFIG_DATA);
80 break; 80 break;
81 } 81 }
82 82
diff --git a/arch/mips/pci/ops-titan.c b/arch/mips/pci/ops-titan.c
index 233ec6f2054d..ebf8fc40e9b2 100644
--- a/arch/mips/pci/ops-titan.c
+++ b/arch/mips/pci/ops-titan.c
@@ -26,8 +26,19 @@
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28 28
29#include <asm/titan_dep.h> 29#include <asm/pci.h>
30#include <asm/io.h>
31#include <asm/rm9k-ocd.h>
30 32
33/*
34 * PCI specific defines
35 */
36#define TITAN_PCI_0_CONFIG_ADDRESS 0x780
37#define TITAN_PCI_0_CONFIG_DATA 0x784
38
39/*
40 * Titan PCI Config Read Byte
41 */
31static int titan_read_config(struct pci_bus *bus, unsigned int devfn, int reg, 42static int titan_read_config(struct pci_bus *bus, unsigned int devfn, int reg,
32 int size, u32 * val) 43 int size, u32 * val)
33{ 44{
@@ -43,8 +54,8 @@ static int titan_read_config(struct pci_bus *bus, unsigned int devfn, int reg,
43 54
44 55
45 /* start the configuration cycle */ 56 /* start the configuration cycle */
46 TITAN_WRITE(TITAN_PCI_0_CONFIG_ADDRESS, address); 57 ocd_writel(address, TITAN_PCI_0_CONFIG_ADDRESS);
47 tmp = TITAN_READ(TITAN_PCI_0_CONFIG_DATA) >> ((reg & 3) << 3); 58 tmp = ocd_readl(TITAN_PCI_0_CONFIG_DATA) >> ((reg & 3) << 3);
48 59
49 switch (size) { 60 switch (size) {
50 case 1: 61 case 1:
@@ -71,20 +82,20 @@ static int titan_write_config(struct pci_bus *bus, unsigned int devfn, int reg,
71 (reg & 0xfc) | 0x80000000; 82 (reg & 0xfc) | 0x80000000;
72 83
73 /* start the configuration cycle */ 84 /* start the configuration cycle */
74 TITAN_WRITE(TITAN_PCI_0_CONFIG_ADDRESS, address); 85 ocd_writel(address, TITAN_PCI_0_CONFIG_ADDRESS);
75 86
76 /* write the data */ 87 /* write the data */
77 switch (size) { 88 switch (size) {
78 case 1: 89 case 1:
79 TITAN_WRITE_8(TITAN_PCI_0_CONFIG_DATA + (~reg & 0x3), val); 90 ocd_writeb(val, TITAN_PCI_0_CONFIG_DATA + (~reg & 0x3));
80 break; 91 break;
81 92
82 case 2: 93 case 2:
83 TITAN_WRITE_16(TITAN_PCI_0_CONFIG_DATA + (~reg & 0x2), val); 94 ocd_writew(val, TITAN_PCI_0_CONFIG_DATA + (~reg & 0x2));
84 break; 95 break;
85 96
86 case 4: 97 case 4:
87 TITAN_WRITE(TITAN_PCI_0_CONFIG_DATA, val); 98 ocd_writel(val, TITAN_PCI_0_CONFIG_DATA);
88 break; 99 break;
89 } 100 }
90 101
diff --git a/arch/mips/pci/pci-ddb5074.c b/arch/mips/pci/pci-ddb5074.c
deleted file mode 100644
index 73f9ceeb2f55..000000000000
--- a/arch/mips/pci/pci-ddb5074.c
+++ /dev/null
@@ -1,79 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/types.h>
4#include <linux/pci.h>
5
6#include <asm/debug.h>
7
8#include <asm/ddb5xxx/ddb5xxx.h>
9
10static struct resource extpci_io_resource = {
11 "pci IO space",
12 0x1000, /* leave some room for ISA bus */
13 DDB_PCI_IO_SIZE - 1,
14 IORESOURCE_IO
15};
16
17static struct resource extpci_mem_resource = {
18 "pci memory space",
19 DDB_PCI_MEM_BASE + 0x00100000, /* leave 1 MB for RTC */
20 DDB_PCI_MEM_BASE + DDB_PCI_MEM_SIZE - 1,
21 IORESOURCE_MEM
22};
23
24extern struct pci_ops ddb5476_ext_pci_ops;
25
26struct pci_controller ddb5476_controller = {
27 .pci_ops = &ddb5476_ext_pci_ops,
28 .io_resource = &extpci_io_resource,
29 .mem_resource = &extpci_mem_resource,
30};
31
32#define PCI_EXT_INTA 8
33#define PCI_EXT_INTB 9
34#define PCI_EXT_INTC 10
35#define PCI_EXT_INTD 11
36#define PCI_EXT_INTE 12
37
38#define MAX_SLOT_NUM 14
39
40static unsigned char irq_map[MAX_SLOT_NUM] = {
41 [ 0] = nile4_to_irq(PCI_EXT_INTE),
42 [ 1] = nile4_to_irq(PCI_EXT_INTA),
43 [ 2] = nile4_to_irq(PCI_EXT_INTA),
44 [ 3] = nile4_to_irq(PCI_EXT_INTB),
45 [ 4] = nile4_to_irq(PCI_EXT_INTC),
46 [ 5] = nile4_to_irq(NILE4_INT_UART),
47 [10] = nile4_to_irq(PCI_EXT_INTE),
48 [13] = nile4_to_irq(PCI_EXT_INTE),
49};
50
51int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
52{
53 return irq_map[slot];
54}
55
56/* Do platform specific device initialization at pci_enable_device() time */
57int pcibios_plat_dev_init(struct pci_dev *dev)
58{
59 return 0;
60}
61
62void __init ddb_pci_reset_bus(void)
63{
64 u32 temp;
65
66 /*
67 * I am not sure about the "official" procedure, the following
68 * steps work as far as I know:
69 * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
70 * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
71 * The same is true for both PCI channels.
72 */
73 temp = ddb_in32(DDB_PCICTRL + 4);
74 temp |= 0x80000000;
75 ddb_out32(DDB_PCICTRL + 4, temp);
76 temp &= ~0xc0000000;
77 ddb_out32(DDB_PCICTRL + 4, temp);
78
79}
diff --git a/arch/mips/pci/pci-ddb5476.c b/arch/mips/pci/pci-ddb5476.c
deleted file mode 100644
index 90dd49509800..000000000000
--- a/arch/mips/pci/pci-ddb5476.c
+++ /dev/null
@@ -1,93 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/types.h>
4#include <linux/pci.h>
5
6#include <asm/debug.h>
7
8#include <asm/ddb5xxx/ddb5xxx.h>
9
10static struct resource extpci_io_resource = {
11 "pci IO space",
12 0x1000, /* leave some room for ISA bus */
13 DDB_PCI_IO_SIZE - 1,
14 IORESOURCE_IO
15};
16
17static struct resource extpci_mem_resource = {
18 "pci memory space",
19 DDB_PCI_MEM_BASE + 0x00100000, /* leave 1 MB for RTC */
20 DDB_PCI_MEM_BASE + DDB_PCI_MEM_SIZE - 1,
21 IORESOURCE_MEM
22};
23
24extern struct pci_ops ddb5476_ext_pci_ops;
25
26struct pci_controller ddb5476_controller = {
27 .pci_ops = &ddb5476_ext_pci_ops,
28 .io_resource = &extpci_io_resource,
29 .mem_resource = &extpci_mem_resource
30};
31
32
33/*
34 * we fix up irqs based on the slot number.
35 * The first entry is at AD:11.
36 *
37 * This does not work for devices on sub-buses yet.
38 */
39
40/*
41 * temporary
42 */
43
44#define PCI_EXT_INTA 8
45#define PCI_EXT_INTB 9
46#define PCI_EXT_INTC 10
47#define PCI_EXT_INTD 11
48#define PCI_EXT_INTE 12
49
50/*
51 * based on ddb5477 manual page 11
52 */
53#define MAX_SLOT_NUM 21
54static unsigned char irq_map[MAX_SLOT_NUM] = {
55 [ 2] = 9, /* AD:13 USB */
56 [ 3] = 10, /* AD:14 PMU */
57 [ 5] = 0, /* AD:16 P2P bridge */
58 [ 6] = nile4_to_irq(PCI_EXT_INTB), /* AD:17 */
59 [ 7] = nile4_to_irq(PCI_EXT_INTC), /* AD:18 */
60 [ 8] = nile4_to_irq(PCI_EXT_INTD), /* AD:19 */
61 [ 9] = nile4_to_irq(PCI_EXT_INTA), /* AD:20 */
62 [13] = 14, /* AD:24 HD controller, M5229 */
63};
64
65int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
66{
67 return irq_map[slot];
68}
69
70/* Do platform specific device initialization at pci_enable_device() time */
71int pcibios_plat_dev_init(struct pci_dev *dev)
72{
73 return 0;
74}
75
76void __init ddb_pci_reset_bus(void)
77{
78 u32 temp;
79
80 /*
81 * I am not sure about the "official" procedure, the following
82 * steps work as far as I know:
83 * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
84 * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
85 * The same is true for both PCI channels.
86 */
87 temp = ddb_in32(DDB_PCICTRL + 4);
88 temp |= 0x80000000;
89 ddb_out32(DDB_PCICTRL + 4, temp);
90 temp &= ~0xc0000000;
91 ddb_out32(DDB_PCICTRL + 4, temp);
92
93}
diff --git a/arch/mips/pci/pci-ddb5477.c b/arch/mips/pci/pci-ddb5477.c
index 826d653184e5..d071bc375b11 100644
--- a/arch/mips/pci/pci-ddb5477.c
+++ b/arch/mips/pci/pci-ddb5477.c
@@ -22,31 +22,31 @@
22#include <asm/ddb5xxx/ddb5xxx.h> 22#include <asm/ddb5xxx/ddb5xxx.h>
23 23
24static struct resource extpci_io_resource = { 24static struct resource extpci_io_resource = {
25 "ext pci IO space", 25 .start = DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + 0x4000,
26 DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + 0x4000, 26 .end = DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI0_IO_SIZE - 1,
27 DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI0_IO_SIZE - 1, 27 .name = "ext pci IO space",
28 IORESOURCE_IO 28 .flags = IORESOURCE_IO
29}; 29};
30 30
31static struct resource extpci_mem_resource = { 31static struct resource extpci_mem_resource = {
32 "ext pci memory space", 32 .start = DDB_PCI0_MEM_BASE + 0x100000,
33 DDB_PCI0_MEM_BASE + 0x100000, 33 .end = DDB_PCI0_MEM_BASE + DDB_PCI0_MEM_SIZE - 1,
34 DDB_PCI0_MEM_BASE + DDB_PCI0_MEM_SIZE - 1, 34 .name = "ext pci memory space",
35 IORESOURCE_MEM 35 .flags = IORESOURCE_MEM
36}; 36};
37 37
38static struct resource iopci_io_resource = { 38static struct resource iopci_io_resource = {
39 "io pci IO space", 39 .start = DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE,
40 DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE, 40 .end = DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI1_IO_SIZE - 1,
41 DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI1_IO_SIZE - 1, 41 .name = "io pci IO space",
42 IORESOURCE_IO 42 .flags = IORESOURCE_IO
43}; 43};
44 44
45static struct resource iopci_mem_resource = { 45static struct resource iopci_mem_resource = {
46 "ext pci memory space", 46 .start = DDB_PCI1_MEM_BASE,
47 DDB_PCI1_MEM_BASE, 47 .end = DDB_PCI1_MEM_BASE + DDB_PCI1_MEM_SIZE - 1,
48 DDB_PCI1_MEM_BASE + DDB_PCI1_MEM_SIZE - 1, 48 .name = "ext pci memory space",
49 IORESOURCE_MEM 49 .flags = IORESOURCE_MEM
50}; 50};
51 51
52extern struct pci_ops ddb5477_ext_pci_ops; 52extern struct pci_ops ddb5477_ext_pci_ops;
diff --git a/arch/mips/pci/pci-emma2rh.c b/arch/mips/pci/pci-emma2rh.c
new file mode 100644
index 000000000000..0f8b230057d3
--- /dev/null
+++ b/arch/mips/pci/pci-emma2rh.c
@@ -0,0 +1,90 @@
1/*
2 * arch/mips/pci/pci-emma2rh.c
3 * This file defines the PCI configration.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/pci.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#include <linux/config.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/types.h>
30#include <linux/pci.h>
31
32#include <asm/bootinfo.h>
33#include <asm/debug.h>
34
35#include <asm/emma2rh/emma2rh.h>
36
37static struct resource pci_io_resource = {
38 .name = "pci IO space",
39 .start = EMMA2RH_PCI_IO_BASE,
40 .end = EMMA2RH_PCI_IO_BASE + EMMA2RH_PCI_IO_SIZE - 1,
41 .flags = IORESOURCE_IO,
42};
43
44static struct resource pci_mem_resource = {
45 .name = "pci memory space",
46 .start = EMMA2RH_PCI_MEM_BASE,
47 .end = EMMA2RH_PCI_MEM_BASE + EMMA2RH_PCI_MEM_SIZE - 1,
48 .flags = IORESOURCE_MEM,
49};
50
51extern struct pci_ops emma2rh_pci_ops;
52
53static struct pci_controller emma2rh_pci_controller = {
54 .pci_ops = &emma2rh_pci_ops,
55 .mem_resource = &pci_mem_resource,
56 .io_resource = &pci_io_resource,
57 .mem_offset = -0x04000000,
58 .io_offset = 0,
59};
60
61static void __init emma2rh_pci_init(void)
62{
63 /* setup PCI interface */
64 emma2rh_out32(EMMA2RH_PCI_ARBIT_CTR, 0x70f);
65
66 emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, 0x80000a18);
67 emma2rh_out32(EMMA2RH_PCI_CONFIG_BASE + PCI_COMMAND,
68 PCI_STATUS_DEVSEL_MEDIUM | PCI_STATUS_CAP_LIST |
69 PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
70 emma2rh_out32(EMMA2RH_PCI_CONFIG_BASE + PCI_BASE_ADDRESS_0, 0x10000000);
71 emma2rh_out32(EMMA2RH_PCI_CONFIG_BASE + PCI_BASE_ADDRESS_1, 0x00000000);
72
73 emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, 0x12000000 | 0x218);
74 emma2rh_out32(EMMA2RH_PCI_IWIN1_CTR, 0x18000000 | 0x600);
75 emma2rh_out32(EMMA2RH_PCI_INIT_ESWP, 0x00000200);
76
77 emma2rh_out32(EMMA2RH_PCI_TWIN_CTR, 0x00009200);
78 emma2rh_out32(EMMA2RH_PCI_TWIN_BADR, 0x00000000);
79 emma2rh_out32(EMMA2RH_PCI_TWIN0_DADR, 0x00000000);
80 emma2rh_out32(EMMA2RH_PCI_TWIN1_DADR, 0x00000000);
81}
82
83static int __init emma2rh_pci_setup(void)
84{
85 emma2rh_pci_init();
86 register_pci_controller(&emma2rh_pci_controller);
87 return 0;
88}
89
90arch_initcall(emma2rh_pci_setup);
diff --git a/arch/mips/pci/pci-excite.c b/arch/mips/pci/pci-excite.c
new file mode 100644
index 000000000000..3c86c77cb74f
--- /dev/null
+++ b/arch/mips/pci/pci-excite.c
@@ -0,0 +1,149 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 * Based on the PMC-Sierra Yosemite board support by Ralf Baechle.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/types.h>
23#include <linux/pci.h>
24#include <linux/bitops.h>
25#include <asm/rm9k-ocd.h>
26#include <excite.h>
27
28
29extern struct pci_ops titan_pci_ops;
30
31
32static struct resource
33 mem_resource = {
34 .name = "PCI memory",
35 .start = EXCITE_PHYS_PCI_MEM,
36 .end = EXCITE_PHYS_PCI_MEM + EXCITE_SIZE_PCI_MEM - 1,
37 .flags = IORESOURCE_MEM
38 },
39 io_resource = {
40 .name = "PCI I/O",
41 .start = EXCITE_PHYS_PCI_IO,
42 .end = EXCITE_PHYS_PCI_IO + EXCITE_SIZE_PCI_IO - 1,
43 .flags = IORESOURCE_IO
44 };
45
46
47static struct pci_controller bx_controller = {
48 .pci_ops = &titan_pci_ops,
49 .mem_resource = &mem_resource,
50 .mem_offset = 0x00000000UL,
51 .io_resource = &io_resource,
52 .io_offset = 0x00000000UL
53};
54
55
56static char
57 iopage_failed[] __initdata = "Cannot allocate PCI I/O page",
58 modebits_no_pci[] __initdata = "PCI is not configured in mode bits";
59
60#define RM9000x2_OCD_HTSC 0x0604
61#define RM9000x2_OCD_HTBHL 0x060c
62#define RM9000x2_OCD_PCIHRST 0x078c
63
64#define RM9K_OCD_MODEBIT1 0x00d4 /* (MODEBIT1) Mode Bit 1 */
65#define RM9K_OCD_CPHDCR 0x00f4 /* CPU-PCI/HT Data Control. */
66
67#define PCISC_FB2B 0x00000200
68#define PCISC_MWICG 0x00000010
69#define PCISC_EMC 0x00000004
70#define PCISC_ERMA 0x00000002
71
72
73
74static int __init basler_excite_pci_setup(void)
75{
76 const unsigned int fullbars = memsize / (256 << 20);
77 unsigned int i;
78
79 /* Check modebits to see if PCI is really enabled. */
80 if (!((ocd_readl(RM9K_OCD_MODEBIT1) >> (47-32)) & 0x1))
81 panic(modebits_no_pci);
82
83 if (NULL == request_mem_region(EXCITE_PHYS_PCI_IO, EXCITE_SIZE_PCI_IO,
84 "Memory-mapped PCI I/O page"))
85 panic(iopage_failed);
86
87 /* Enable PCI 0 as master for config cycles */
88 ocd_writel(PCISC_EMC | PCISC_ERMA, RM9000x2_OCD_HTSC);
89
90
91 /* Set up latency timer */
92 ocd_writel(0x8008, RM9000x2_OCD_HTBHL);
93
94 /* Setup host IO and Memory space */
95 ocd_writel((EXCITE_PHYS_PCI_IO >> 4) | 1, LKB7);
96 ocd_writel(((EXCITE_SIZE_PCI_IO >> 4) & 0x7fffff00) - 0x100, LKM7);
97 ocd_writel((EXCITE_PHYS_PCI_MEM >> 4) | 1, LKB8);
98 ocd_writel(((EXCITE_SIZE_PCI_MEM >> 4) & 0x7fffff00) - 0x100, LKM8);
99
100 /* Set up PCI BARs to map all installed memory */
101 for (i = 0; i < 6; i++) {
102 const unsigned int bar = 0x610 + i * 4;
103
104 if (i < fullbars) {
105 ocd_writel(0x10000000 * i, bar);
106 ocd_writel(0x01000000 * i, bar + 0x140);
107 ocd_writel(0x0ffff029, bar + 0x100);
108 continue;
109 }
110
111 if (i == fullbars) {
112 int o;
113 u32 mask;
114
115 const unsigned long rem = memsize - i * 0x10000000;
116 if (!rem) {
117 ocd_writel(0x00000000, bar + 0x100);
118 continue;
119 }
120
121 o = ffs(rem) - 1;
122 if (rem & ~(0x1 << o))
123 o++;
124 mask = ((0x1 << o) & 0x0ffff000) - 0x1000;
125 ocd_writel(0x10000000 * i, bar);
126 ocd_writel(0x01000000 * i, bar + 0x140);
127 ocd_writel(0x00000029 | mask, bar + 0x100);
128 continue;
129 }
130
131 ocd_writel(0x00000000, bar + 0x100);
132 }
133
134 /* Finally, enable the PCI interupt */
135#if USB_IRQ > 7
136 set_c0_intcontrol(1 << USB_IRQ);
137#else
138 set_c0_status(1 << (USB_IRQ + 8));
139#endif
140
141 ioport_resource.start = EXCITE_PHYS_PCI_IO;
142 ioport_resource.end = EXCITE_PHYS_PCI_IO + EXCITE_SIZE_PCI_IO - 1;
143 set_io_port_base((unsigned long) ioremap_nocache(EXCITE_PHYS_PCI_IO, EXCITE_SIZE_PCI_IO));
144 register_pci_controller(&bx_controller);
145 return 0;
146}
147
148
149arch_initcall(basler_excite_pci_setup);
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index 6002d2a6a262..80eb9af9ecdf 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -40,297 +40,7 @@ static struct bridge_controller bridges[MAX_PCI_BUSSES];
40struct bridge_controller *irq_to_bridge[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS]; 40struct bridge_controller *irq_to_bridge[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS];
41int irq_to_slot[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS]; 41int irq_to_slot[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS];
42 42
43/* 43extern struct pci_ops bridge_pci_ops;
44 * The Bridge ASIC supports both type 0 and type 1 access. Type 1 is
45 * not really documented, so right now I can't write code which uses it.
46 * Therefore we use type 0 accesses for now even though they won't work
47 * correcly for PCI-to-PCI bridges.
48 *
49 * The function is complicated by the ultimate brokeness of the IOC3 chip
50 * which is used in SGI systems. The IOC3 can only handle 32-bit PCI
51 * accesses and does only decode parts of it's address space.
52 */
53
54static int pci_conf0_read_config(struct pci_bus *bus, unsigned int devfn,
55 int where, int size, u32 * value)
56{
57 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
58 bridge_t *bridge = bc->base;
59 int slot = PCI_SLOT(devfn);
60 int fn = PCI_FUNC(devfn);
61 volatile void *addr;
62 u32 cf, shift, mask;
63 int res;
64
65 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
66 if (get_dbe(cf, (u32 *) addr))
67 return PCIBIOS_DEVICE_NOT_FOUND;
68
69 /*
70 * IOC3 is fucked fucked beyond believe ... Don't even give the
71 * generic PCI code a chance to look at it for real ...
72 */
73 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
74 goto oh_my_gawd;
75
76 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
77
78 if (size == 1)
79 res = get_dbe(*value, (u8 *) addr);
80 else if (size == 2)
81 res = get_dbe(*value, (u16 *) addr);
82 else
83 res = get_dbe(*value, (u32 *) addr);
84
85 return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
86
87oh_my_gawd:
88
89 /*
90 * IOC3 is fucked fucked beyond believe ... Don't even give the
91 * generic PCI code a chance to look at the wrong register.
92 */
93 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
94 *value = 0;
95 return PCIBIOS_SUCCESSFUL;
96 }
97
98 /*
99 * IOC3 is fucked fucked beyond believe ... Don't try to access
100 * anything but 32-bit words ...
101 */
102 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
103
104 if (get_dbe(cf, (u32 *) addr))
105 return PCIBIOS_DEVICE_NOT_FOUND;
106
107 shift = ((where & 3) << 3);
108 mask = (0xffffffffU >> ((4 - size) << 3));
109 *value = (cf >> shift) & mask;
110
111 return PCIBIOS_SUCCESSFUL;
112}
113
114static int pci_conf1_read_config(struct pci_bus *bus, unsigned int devfn,
115 int where, int size, u32 * value)
116{
117 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
118 bridge_t *bridge = bc->base;
119 int busno = bus->number;
120 int slot = PCI_SLOT(devfn);
121 int fn = PCI_FUNC(devfn);
122 volatile void *addr;
123 u32 cf, shift, mask;
124 int res;
125
126 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
127 addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
128 if (get_dbe(cf, (u32 *) addr))
129 return PCIBIOS_DEVICE_NOT_FOUND;
130
131 /*
132 * IOC3 is fucked fucked beyond believe ... Don't even give the
133 * generic PCI code a chance to look at it for real ...
134 */
135 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
136 goto oh_my_gawd;
137
138 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
139 addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
140
141 if (size == 1)
142 res = get_dbe(*value, (u8 *) addr);
143 else if (size == 2)
144 res = get_dbe(*value, (u16 *) addr);
145 else
146 res = get_dbe(*value, (u32 *) addr);
147
148 return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
149
150oh_my_gawd:
151
152 /*
153 * IOC3 is fucked fucked beyond believe ... Don't even give the
154 * generic PCI code a chance to look at the wrong register.
155 */
156 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
157 *value = 0;
158 return PCIBIOS_SUCCESSFUL;
159 }
160
161 /*
162 * IOC3 is fucked fucked beyond believe ... Don't try to access
163 * anything but 32-bit words ...
164 */
165 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
166 addr = &bridge->b_type1_cfg.c[(fn << 8) | where];
167
168 if (get_dbe(cf, (u32 *) addr))
169 return PCIBIOS_DEVICE_NOT_FOUND;
170
171 shift = ((where & 3) << 3);
172 mask = (0xffffffffU >> ((4 - size) << 3));
173 *value = (cf >> shift) & mask;
174
175 return PCIBIOS_SUCCESSFUL;
176}
177
178static int pci_read_config(struct pci_bus *bus, unsigned int devfn,
179 int where, int size, u32 * value)
180{
181 if (bus->number > 0)
182 return pci_conf1_read_config(bus, devfn, where, size, value);
183
184 return pci_conf0_read_config(bus, devfn, where, size, value);
185}
186
187static int pci_conf0_write_config(struct pci_bus *bus, unsigned int devfn,
188 int where, int size, u32 value)
189{
190 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
191 bridge_t *bridge = bc->base;
192 int slot = PCI_SLOT(devfn);
193 int fn = PCI_FUNC(devfn);
194 volatile void *addr;
195 u32 cf, shift, mask, smask;
196 int res;
197
198 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
199 if (get_dbe(cf, (u32 *) addr))
200 return PCIBIOS_DEVICE_NOT_FOUND;
201
202 /*
203 * IOC3 is fucked fucked beyond believe ... Don't even give the
204 * generic PCI code a chance to look at it for real ...
205 */
206 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
207 goto oh_my_gawd;
208
209 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
210
211 if (size == 1) {
212 res = put_dbe(value, (u8 *) addr);
213 } else if (size == 2) {
214 res = put_dbe(value, (u16 *) addr);
215 } else {
216 res = put_dbe(value, (u32 *) addr);
217 }
218
219 if (res)
220 return PCIBIOS_DEVICE_NOT_FOUND;
221
222 return PCIBIOS_SUCCESSFUL;
223
224oh_my_gawd:
225
226 /*
227 * IOC3 is fucked fucked beyond believe ... Don't even give the
228 * generic PCI code a chance to touch the wrong register.
229 */
230 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
231 return PCIBIOS_SUCCESSFUL;
232
233 /*
234 * IOC3 is fucked fucked beyond believe ... Don't try to access
235 * anything but 32-bit words ...
236 */
237 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
238
239 if (get_dbe(cf, (u32 *) addr))
240 return PCIBIOS_DEVICE_NOT_FOUND;
241
242 shift = ((where & 3) << 3);
243 mask = (0xffffffffU >> ((4 - size) << 3));
244 smask = mask << shift;
245
246 cf = (cf & ~smask) | ((value & mask) << shift);
247 if (put_dbe(cf, (u32 *) addr))
248 return PCIBIOS_DEVICE_NOT_FOUND;
249
250 return PCIBIOS_SUCCESSFUL;
251}
252
253static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
254 int where, int size, u32 value)
255{
256 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
257 bridge_t *bridge = bc->base;
258 int slot = PCI_SLOT(devfn);
259 int fn = PCI_FUNC(devfn);
260 int busno = bus->number;
261 volatile void *addr;
262 u32 cf, shift, mask, smask;
263 int res;
264
265 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
266 addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
267 if (get_dbe(cf, (u32 *) addr))
268 return PCIBIOS_DEVICE_NOT_FOUND;
269
270 /*
271 * IOC3 is fucked fucked beyond believe ... Don't even give the
272 * generic PCI code a chance to look at it for real ...
273 */
274 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
275 goto oh_my_gawd;
276
277 addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
278
279 if (size == 1) {
280 res = put_dbe(value, (u8 *) addr);
281 } else if (size == 2) {
282 res = put_dbe(value, (u16 *) addr);
283 } else {
284 res = put_dbe(value, (u32 *) addr);
285 }
286
287 if (res)
288 return PCIBIOS_DEVICE_NOT_FOUND;
289
290 return PCIBIOS_SUCCESSFUL;
291
292oh_my_gawd:
293
294 /*
295 * IOC3 is fucked fucked beyond believe ... Don't even give the
296 * generic PCI code a chance to touch the wrong register.
297 */
298 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
299 return PCIBIOS_SUCCESSFUL;
300
301 /*
302 * IOC3 is fucked fucked beyond believe ... Don't try to access
303 * anything but 32-bit words ...
304 */
305 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
306
307 if (get_dbe(cf, (u32 *) addr))
308 return PCIBIOS_DEVICE_NOT_FOUND;
309
310 shift = ((where & 3) << 3);
311 mask = (0xffffffffU >> ((4 - size) << 3));
312 smask = mask << shift;
313
314 cf = (cf & ~smask) | ((value & mask) << shift);
315 if (put_dbe(cf, (u32 *) addr))
316 return PCIBIOS_DEVICE_NOT_FOUND;
317
318 return PCIBIOS_SUCCESSFUL;
319}
320
321static int pci_write_config(struct pci_bus *bus, unsigned int devfn,
322 int where, int size, u32 value)
323{
324 if (bus->number > 0)
325 return pci_conf1_write_config(bus, devfn, where, size, value);
326
327 return pci_conf0_write_config(bus, devfn, where, size, value);
328}
329
330static struct pci_ops bridge_pci_ops = {
331 .read = pci_read_config,
332 .write = pci_write_config,
333};
334 44
335int __init bridge_probe(nasid_t nasid, int widget_id, int masterwid) 45int __init bridge_probe(nasid_t nasid, int widget_id, int masterwid)
336{ 46{
@@ -370,8 +80,7 @@ int __init bridge_probe(nasid_t nasid, int widget_id, int masterwid)
370 bc->widget_id = widget_id; 80 bc->widget_id = widget_id;
371 bc->nasid = nasid; 81 bc->nasid = nasid;
372 82
373 bc->baddr = (u64)masterwid << 60; 83 bc->baddr = (u64)masterwid << 60 | PCI64_ATTR_BAR;
374 bc->baddr |= (1UL << 56); /* Barrier set */
375 84
376 /* 85 /*
377 * point to this bridge 86 * point to this bridge
diff --git a/arch/mips/pci/pci-jmr3927.c b/arch/mips/pci/pci-jmr3927.c
index f02ef6e36b02..cb84f4e8ccae 100644
--- a/arch/mips/pci/pci-jmr3927.c
+++ b/arch/mips/pci/pci-jmr3927.c
@@ -35,17 +35,17 @@
35#include <asm/debug.h> 35#include <asm/debug.h>
36 36
37struct resource pci_io_resource = { 37struct resource pci_io_resource = {
38 "IO MEM", 38 .name = "IO MEM",
39 0x1000, /* reserve regacy I/O space */ 39 .start = 0x1000, /* reserve regacy I/O space */
40 0x1000 + JMR3927_PCIIO_SIZE - 1, 40 .end = 0x1000 + JMR3927_PCIIO_SIZE - 1,
41 IORESOURCE_IO 41 .flags = IORESOURCE_IO
42}; 42};
43 43
44struct resource pci_mem_resource = { 44struct resource pci_mem_resource = {
45 "PCI MEM", 45 .name = "PCI MEM",
46 JMR3927_PCIMEM, 46 .start = JMR3927_PCIMEM,
47 JMR3927_PCIMEM + JMR3927_PCIMEM_SIZE - 1, 47 .end = JMR3927_PCIMEM + JMR3927_PCIMEM_SIZE - 1,
48 IORESOURCE_MEM 48 .flags = IORESOURCE_MEM
49}; 49};
50 50
51extern struct pci_ops jmr3927_pci_ops; 51extern struct pci_ops jmr3927_pci_ops;
diff --git a/arch/mips/pci/pci-ocelot.c b/arch/mips/pci/pci-ocelot.c
index 3da8a4ee6baa..2b9495dce6ba 100644
--- a/arch/mips/pci/pci-ocelot.c
+++ b/arch/mips/pci/pci-ocelot.c
@@ -71,13 +71,13 @@ static inline void pci0WriteConfigReg(unsigned int offset, unsigned int data)
71} 71}
72 72
73static struct resource ocelot_mem_resource = { 73static struct resource ocelot_mem_resource = {
74 iomem_resource.start = GT_PCI_MEM_BASE; 74 start = GT_PCI_MEM_BASE;
75 iomem_resource.end = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1; 75 end = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1;
76}; 76};
77 77
78static struct resource ocelot_io_resource = { 78static struct resource ocelot_io_resource = {
79 ioport_resource.start = GT_PCI_IO_BASE; 79 start = GT_PCI_IO_BASE;
80 ioport_resource.end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1; 80 end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1;
81}; 81};
82 82
83static struct pci_controller ocelot_pci_controller = { 83static struct pci_controller ocelot_pci_controller = {
diff --git a/arch/mips/pci/pci-yosemite.c b/arch/mips/pci/pci-yosemite.c
index dac9ed4b0ccf..0357946f30e6 100644
--- a/arch/mips/pci/pci-yosemite.c
+++ b/arch/mips/pci/pci-yosemite.c
@@ -14,7 +14,10 @@
14extern struct pci_ops titan_pci_ops; 14extern struct pci_ops titan_pci_ops;
15 15
16static struct resource py_mem_resource = { 16static struct resource py_mem_resource = {
17 "Titan PCI MEM", 0xe0000000UL, 0xe3ffffffUL, IORESOURCE_MEM 17 .start = 0xe0000000UL,
18 .end = 0xe3ffffffUL,
19 .name = "Titan PCI MEM",
20 .flags = IORESOURCE_MEM
18}; 21};
19 22
20/* 23/*
@@ -26,7 +29,10 @@ static struct resource py_mem_resource = {
26#define TITAN_IO_BASE 0xe8000000UL 29#define TITAN_IO_BASE 0xe8000000UL
27 30
28static struct resource py_io_resource = { 31static struct resource py_io_resource = {
29 "Titan IO MEM", 0x00001000UL, TITAN_IO_SIZE - 1, IORESOURCE_IO, 32 .start = 0x00001000UL,
33 .end = TITAN_IO_SIZE - 1,
34 .name = "Titan IO MEM",
35 .flags = IORESOURCE_IO,
30}; 36};
31 37
32static struct pci_controller py_controller = { 38static struct pci_controller py_controller = {
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 21402ffd7c98..4dfce154d4af 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -76,11 +76,6 @@ pcibios_align_resource(void *data, struct resource *res,
76 res->start = start; 76 res->start = start;
77} 77}
78 78
79struct pci_controller * __init alloc_pci_controller(void)
80{
81 return alloc_bootmem(sizeof(struct pci_controller));
82}
83
84void __init register_pci_controller(struct pci_controller *hose) 79void __init register_pci_controller(struct pci_controller *hose)
85{ 80{
86 *hose_tail = hose; 81 *hose_tail = hose;
diff --git a/arch/mips/philips/pnx8550/common/pci.c b/arch/mips/philips/pnx8550/common/pci.c
index baa6905f649f..eee4f3dfc410 100644
--- a/arch/mips/philips/pnx8550/common/pci.c
+++ b/arch/mips/philips/pnx8550/common/pci.c
@@ -27,17 +27,17 @@
27#include <nand.h> 27#include <nand.h>
28 28
29static struct resource pci_io_resource = { 29static struct resource pci_io_resource = {
30 "pci IO space", 30 .start = PNX8550_PCIIO + 0x1000, /* reserve regacy I/O space */
31 (u32)(PNX8550_PCIIO + 0x1000), /* reserve regacy I/O space */ 31 .end = PNX8550_PCIIO + PNX8550_PCIIO_SIZE,
32 (u32)(PNX8550_PCIIO + PNX8550_PCIIO_SIZE), 32 .name = "pci IO space",
33 IORESOURCE_IO 33 .flags = IORESOURCE_IO
34}; 34};
35 35
36static struct resource pci_mem_resource = { 36static struct resource pci_mem_resource = {
37 "pci memory space", 37 .start = PNX8550_PCIMEM,
38 (u32)(PNX8550_PCIMEM), 38 .end = PNX8550_PCIMEM + PNX8550_PCIMEM_SIZE - 1,
39 (u32)(PNX8550_PCIMEM + PNX8550_PCIMEM_SIZE - 1), 39 .name = "pci memory space",
40 IORESOURCE_MEM 40 .flags = IORESOURCE_MEM
41}; 41};
42 42
43extern struct pci_ops pnx8550_pci_ops; 43extern struct pci_ops pnx8550_pci_ops;
diff --git a/arch/mips/philips/pnx8550/common/setup.c b/arch/mips/philips/pnx8550/common/setup.c
index 0d8a77619391..0e791f4f6ea3 100644
--- a/arch/mips/philips/pnx8550/common/setup.c
+++ b/arch/mips/philips/pnx8550/common/setup.c
@@ -58,10 +58,27 @@ extern void prom_printf(char *fmt, ...);
58extern char *prom_getcmdline(void); 58extern char *prom_getcmdline(void);
59 59
60struct resource standard_io_resources[] = { 60struct resource standard_io_resources[] = {
61 {"dma1", 0x00, 0x1f, IORESOURCE_BUSY}, 61 {
62 {"timer", 0x40, 0x5f, IORESOURCE_BUSY}, 62 .start = .0x00,
63 {"dma page reg", 0x80, 0x8f, IORESOURCE_BUSY}, 63 .end = 0x1f,
64 {"dma2", 0xc0, 0xdf, IORESOURCE_BUSY}, 64 .name = "dma1",
65 .flags = IORESOURCE_BUSY
66 }, {
67 .start = 0x40,
68 .end = 0x5f,
69 .name = "timer",
70 .flags = IORESOURCE_BUSY
71 }, {
72 .start = 0x80,
73 .end = 0x8f,
74 .name = "dma page reg",
75 .flags = IORESOURCE_BUSY
76 }, {
77 .start = 0xc0,
78 .end = 0xdf,
79 .name = "dma2",
80 .flags = IORESOURCE_BUSY
81 },
65}; 82};
66 83
67#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource)) 84#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource))
@@ -82,7 +99,7 @@ unsigned long get_system_mem_size(void)
82 99
83int pnx8550_console_port = -1; 100int pnx8550_console_port = -1;
84 101
85void __init plat_setup(void) 102void __init plat_mem_setup(void)
86{ 103{
87 int i; 104 int i;
88 char* argptr; 105 char* argptr;
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 3f724d661bdb..aa0d6ff3c6ec 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -218,7 +218,7 @@ static void __init py_late_time_init(void)
218 py_rtc_setup(); 218 py_rtc_setup();
219} 219}
220 220
221void __init plat_setup(void) 221void __init plat_mem_setup(void)
222{ 222{
223 board_time_init = yosemite_time_init; 223 board_time_init = yosemite_time_init;
224 late_time_init = py_late_time_init; 224 late_time_init = py_late_time_init;
diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile
index 730f459f3e99..078cd3029c9f 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-irq.o q-mem.o q-setup.o 5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o
6 6
7obj-$(CONFIG_SMP) += q-smp.o 7obj-$(CONFIG_SMP) += q-smp.o
diff --git a/arch/mips/qemu/q-reset.c b/arch/mips/qemu/q-reset.c
new file mode 100644
index 000000000000..c04ebcfc7843
--- /dev/null
+++ b/arch/mips/qemu/q-reset.c
@@ -0,0 +1,34 @@
1#include <linux/config.h>
2
3#include <asm/io.h>
4#include <asm/reboot.h>
5#include <asm/cacheflush.h>
6#include <asm/qemu.h>
7
8static void qemu_machine_restart(char *command)
9{
10 volatile unsigned int *reg = (unsigned int *)QEMU_RESTART_REG;
11
12 set_c0_status(ST0_BEV | ST0_ERL);
13 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
14 flush_cache_all();
15 write_c0_wired(0);
16 *reg = 42;
17 while (1)
18 cpu_wait();
19}
20
21static void qemu_machine_halt(void)
22{
23 volatile unsigned int *reg = (unsigned int *)QEMU_HALT_REG;
24
25 *reg = 42;
26 while (1)
27 cpu_wait();
28}
29
30void qemu_reboot_setup(void)
31{
32 _machine_restart = qemu_machine_restart;
33 _machine_halt = qemu_machine_halt;
34}
diff --git a/arch/mips/qemu/q-setup.c b/arch/mips/qemu/q-setup.c
index 022eb1af6db1..e100d6072e31 100644
--- a/arch/mips/qemu/q-setup.c
+++ b/arch/mips/qemu/q-setup.c
@@ -2,6 +2,8 @@
2#include <asm/io.h> 2#include <asm/io.h>
3#include <asm/time.h> 3#include <asm/time.h>
4 4
5extern void qemu_reboot_setup(void);
6
5#define QEMU_PORT_BASE 0xb4000000 7#define QEMU_PORT_BASE 0xb4000000
6 8
7const char *get_system_type(void) 9const char *get_system_type(void)
@@ -18,8 +20,10 @@ static void __init qemu_timer_setup(struct irqaction *irq)
18 setup_irq(0, irq); 20 setup_irq(0, irq);
19} 21}
20 22
21void __init plat_setup(void) 23void __init plat_mem_setup(void)
22{ 24{
23 set_io_port_base(QEMU_PORT_BASE); 25 set_io_port_base(QEMU_PORT_BASE);
24 board_timer_setup = qemu_timer_setup; 26 board_timer_setup = qemu_timer_setup;
27
28 qemu_reboot_setup();
25} 29}
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
index 7018e1833e85..d7138906eb10 100644
--- a/arch/mips/sgi-ip22/ip22-setup.c
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -53,7 +53,7 @@ EXPORT_SYMBOL(ip22_do_break);
53extern void ip22_be_init(void) __init; 53extern void ip22_be_init(void) __init;
54extern void ip22_time_init(void) __init; 54extern void ip22_time_init(void) __init;
55 55
56void __init plat_setup(void) 56void __init plat_mem_setup(void)
57{ 57{
58 char *ctype; 58 char *ctype;
59 char *cserial; 59 char *cserial;
diff --git a/arch/mips/sgi-ip27/Kconfig b/arch/mips/sgi-ip27/Kconfig
index 7b0bc4437243..f14ef38646d0 100644
--- a/arch/mips/sgi-ip27/Kconfig
+++ b/arch/mips/sgi-ip27/Kconfig
@@ -4,31 +4,29 @@
4# This options adds support for userspace processes upto 16TB size. 4# This options adds support for userspace processes upto 16TB size.
5# Normally the limit is just .5TB. 5# Normally the limit is just .5TB.
6 6
7config SGI_SN0_N_MODE 7choice
8 bool "IP27 N-Mode" 8 prompt "Node addressing mode"
9 depends on SGI_IP27 9 depends on SGI_IP27
10 help 10 default SGI_SN_M_MODE
11 The nodes of Origin 200, Origin 2000 and Onyx 2 systems can be
12 configured in either N-Modes which allows for more nodes or M-Mode
13 which allows for more memory. Your system is most probably
14 running in M-Mode, so you should say N here.
15 11
16config ARCH_DISCONTIGMEM_ENABLE 12config SGI_SN_M_MODE
17 bool 13 bool "IP27 M-Mode"
18 default y if SGI_IP27
19 help 14 help
20 Say Y to upport efficient handling of discontiguous physical memory, 15 The nodes of Origin, Onyx, Fuel and Tezro systems can be configured
21 for architectures which are either NUMA (Non-Uniform Memory Access) 16 in either N-Modes which allows for more nodes or M-Mode which allows
22 or have huge holes in the physical address space for other reasons. 17 for more memory. Your hardware is almost certainly running in
23 See <file:Documentation/vm/numa> for more. 18 M-Mode, so choose M-mode here.
24 19
25config NUMA 20config SGI_SN_N_MODE
26 bool "NUMA Support" 21 bool "IP27 N-Mode"
27 depends on SGI_IP27 22 depends on EXPERIMENTAL
28 help 23 help
29 Say Y to compile the kernel to support NUMA (Non-Uniform Memory 24 The nodes of Origin, Onyx, Fuel and Tezro systems can be configured
30 Access). This option is for configuring high-end multiprocessor 25 in either N-Modes which allows for more nodes or M-Mode which allows
31 server machines. If in doubt, say N. 26 for more memory. Your hardware is almost certainly running in
27 M-Mode, so choose M-mode here.
28
29endchoice
32 30
33config MAPPED_KERNEL 31config MAPPED_KERNEL
34 bool "Mapped kernel support" 32 bool "Mapped kernel support"
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index 8651a0e75404..a6b490e99709 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -196,7 +196,7 @@ extern void ip27_setup_console(void);
196extern void ip27_time_init(void); 196extern void ip27_time_init(void);
197extern void ip27_reboot_setup(void); 197extern void ip27_reboot_setup(void);
198 198
199void __init plat_setup(void) 199void __init plat_mem_setup(void)
200{ 200{
201 hubreg_t p, e, n_mode; 201 hubreg_t p, e, n_mode;
202 nasid_t nid; 202 nasid_t nid;
@@ -228,7 +228,7 @@ void __init plat_setup(void)
228 */ 228 */
229 n_mode = LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_MORENODES_MASK; 229 n_mode = LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_MORENODES_MASK;
230 printk("Machine is in %c mode.\n", n_mode ? 'N' : 'M'); 230 printk("Machine is in %c mode.\n", n_mode ? 'N' : 'M');
231#ifdef CONFIG_SGI_SN0_N_MODE 231#ifdef CONFIG_SGI_SN_N_MODE
232 if (!n_mode) 232 if (!n_mode)
233 panic("Kernel compiled for M mode."); 233 panic("Kernel compiled for M mode.");
234#else 234#else
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 2e643d2f51cb..0b61a39ce2bb 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -360,7 +360,7 @@ static struct hw_interrupt_type bridge_irq_type = {
360 360
361static unsigned long irq_map[NR_IRQS / BITS_PER_LONG]; 361static unsigned long irq_map[NR_IRQS / BITS_PER_LONG];
362 362
363static int allocate_irqno(void) 363int allocate_irqno(void)
364{ 364{
365 int irq; 365 int irq;
366 366
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 36b662e27b6e..1fb860c7ac6d 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -89,11 +89,13 @@ static int set_rtc_mmss(unsigned long nowtime)
89} 89}
90#endif 90#endif
91 91
92static unsigned int rt_timer_irq;
93
92void ip27_rt_timer_interrupt(struct pt_regs *regs) 94void ip27_rt_timer_interrupt(struct pt_regs *regs)
93{ 95{
94 int cpu = smp_processor_id(); 96 int cpu = smp_processor_id();
95 int cpuA = cputoslice(cpu) == 0; 97 int cpuA = cputoslice(cpu) == 0;
96 int irq = 9; /* XXX Assign number */ 98 unsigned int irq = rt_timer_irq;
97 99
98 irq_enter(); 100 irq_enter();
99 write_seqlock(&xtime_lock); 101 write_seqlock(&xtime_lock);
@@ -179,13 +181,68 @@ static __init unsigned long get_m48t35_time(void)
179 return mktime(year, month, date, hour, min, sec); 181 return mktime(year, month, date, hour, min, sec);
180} 182}
181 183
184static void startup_rt_irq(unsigned int irq)
185{
186}
187
188static void shutdown_rt_irq(unsigned int irq)
189{
190}
191
192static void enable_rt_irq(unsigned int irq)
193{
194}
195
196static void disable_rt_irq(unsigned int irq)
197{
198}
199
200static void mask_and_ack_rt(unsigned int irq)
201{
202}
203
204static void end_rt_irq(unsigned int irq)
205{
206}
207
208static struct hw_interrupt_type rt_irq_type = {
209 .typename = "SN HUB RT timer",
210 .startup = startup_rt_irq,
211 .shutdown = shutdown_rt_irq,
212 .enable = enable_rt_irq,
213 .disable = disable_rt_irq,
214 .ack = mask_and_ack_rt,
215 .end = end_rt_irq,
216};
217
218static struct irqaction rt_irqaction = {
219 .handler = ip27_rt_timer_interrupt,
220 .flags = SA_INTERRUPT,
221 .mask = CPU_MASK_NONE,
222 .name = "timer"
223};
224
225extern int allocate_irqno(void);
226
182static void ip27_timer_setup(struct irqaction *irq) 227static void ip27_timer_setup(struct irqaction *irq)
183{ 228{
229 int irqno = allocate_irqno();
230
231 if (irqno < 0)
232 panic("Can't allocate interrupt number for timer interrupt");
233
234 irq_desc[irqno].status = IRQ_DISABLED;
235 irq_desc[irqno].action = NULL;
236 irq_desc[irqno].depth = 1;
237 irq_desc[irqno].handler = &rt_irq_type;
238
184 /* over-write the handler, we use our own way */ 239 /* over-write the handler, we use our own way */
185 irq->handler = no_action; 240 irq->handler = no_action;
186 241
187 /* setup irqaction */ 242 /* setup irqaction */
188// setup_irq(IP27_TIMER_IRQ, irq); /* XXX Can't do this yet. */ 243 irq_desc[irqno].status |= IRQ_PER_CPU;
244
245 rt_timer_irq = irqno;
189} 246}
190 247
191void __init ip27_time_init(void) 248void __init ip27_time_init(void)
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index a2dd8ae1ea8f..acbdad06fac1 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -87,7 +87,7 @@ void __init ip32_timer_setup(struct irqaction *irq)
87 setup_irq(IP32_R4K_TIMER_IRQ, irq); 87 setup_irq(IP32_R4K_TIMER_IRQ, irq);
88} 88}
89 89
90void __init plat_setup(void) 90void __init plat_mem_setup(void)
91{ 91{
92 board_be_init = ip32_be_init; 92 board_be_init = ip32_be_init;
93 93
diff --git a/arch/mips/sibyte/bcm1480/time.c b/arch/mips/sibyte/bcm1480/time.c
index e545752695a1..efaf83efd2e4 100644
--- a/arch/mips/sibyte/bcm1480/time.c
+++ b/arch/mips/sibyte/bcm1480/time.c
@@ -110,17 +110,18 @@ void bcm1480_timer_interrupt(struct pt_regs *regs)
110 __raw_writeq(M_SCD_TIMER_ENABLE|M_SCD_TIMER_MODE_CONTINUOUS, 110 __raw_writeq(M_SCD_TIMER_ENABLE|M_SCD_TIMER_MODE_CONTINUOUS,
111 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG))); 111 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
112 112
113 /*
114 * CPU 0 handles the global timer interrupt job
115 */
116 if (cpu == 0) { 113 if (cpu == 0) {
114 /*
115 * CPU 0 handles the global timer interrupt job
116 */
117 ll_timer_interrupt(irq, regs); 117 ll_timer_interrupt(irq, regs);
118 } 118 }
119 119 else {
120 /* 120 /*
121 * every CPU should do profiling and process accouting 121 * other CPUs should just do profiling and process accounting
122 */ 122 */
123 ll_local_timer_interrupt(irq, regs); 123 ll_local_timer_interrupt(irq, regs);
124 }
124} 125}
125 126
126/* 127/*
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 0f6e54db4888..f853c32f60a0 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -435,13 +435,17 @@ static inline int dclz(unsigned long long x)
435 return lz; 435 return lz;
436} 436}
437 437
438extern void sb1250_timer_interrupt(struct pt_regs *regs);
439extern void sb1250_mailbox_interrupt(struct pt_regs *regs);
440extern void sb1250_kgdb_interrupt(struct pt_regs *regs);
441
438asmlinkage void plat_irq_dispatch(struct pt_regs *regs) 442asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
439{ 443{
440 unsigned int pending; 444 unsigned int pending;
441 445
442#ifdef CONFIG_SIBYTE_SB1250_PROF 446#ifdef CONFIG_SIBYTE_SB1250_PROF
443 /* Set compare to count to silence count/compare timer interrupts */ 447 /* Set compare to count to silence count/compare timer interrupts */
444 write_c0_count(read_c0_count()); 448 write_c0_compare(read_c0_count());
445#endif 449#endif
446 450
447 /* 451 /*
@@ -482,7 +486,7 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
482 * Default...we've hit an IP[2] interrupt, which means we've 486 * Default...we've hit an IP[2] interrupt, which means we've
483 * got to check the 1250 interrupt registers to figure out what 487 * got to check the 1250 interrupt registers to figure out what
484 * to do. Need to detect which CPU we're on, now that 488 * to do. Need to detect which CPU we're on, now that
485 ~ smp_affinity is supported. 489 * smp_affinity is supported.
486 */ 490 */
487 mask = __raw_readq(IOADDR(A_IMR_REGISTER(smp_processor_id(), 491 mask = __raw_readq(IOADDR(A_IMR_REGISTER(smp_processor_id(),
488 R_IMR_INTERRUPT_STATUS_BASE))); 492 R_IMR_INTERRUPT_STATUS_BASE)));
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index 4b5f74ff3edd..f9e694988cdf 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -72,8 +72,10 @@ const char *get_system_type(void)
72 72
73void __init swarm_time_init(void) 73void __init swarm_time_init(void)
74{ 74{
75#if defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
75 /* Setup HPT */ 76 /* Setup HPT */
76 sb1250_hpt_setup(); 77 sb1250_hpt_setup();
78#endif
77} 79}
78 80
79void __init swarm_timer_setup(struct irqaction *irq) 81void __init swarm_timer_setup(struct irqaction *irq)
@@ -103,7 +105,7 @@ int swarm_be_handler(struct pt_regs *regs, int is_fixup)
103 return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL); 105 return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
104} 106}
105 107
106void __init plat_setup(void) 108void __init plat_mem_setup(void)
107{ 109{
108#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 110#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
109 bcm1480_setup(); 111 bcm1480_setup();
diff --git a/arch/mips/sni/Makefile b/arch/mips/sni/Makefile
index 9c7eaa5fb210..a5eb0adb87c7 100644
--- a/arch/mips/sni/Makefile
+++ b/arch/mips/sni/Makefile
@@ -3,5 +3,6 @@
3# 3#
4 4
5obj-y += irq.o pcimt_scache.o reset.o setup.o 5obj-y += irq.o pcimt_scache.o reset.o setup.o
6obj-$(CONFIG_CPU_BIG_ENDIAN) += sniprom.o
6 7
7EXTRA_AFLAGS := $(CFLAGS) 8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 01ba6c581e3d..a050bb6ae704 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -21,8 +21,11 @@
21#include <linux/fb.h> 21#include <linux/fb.h>
22#include <linux/tty.h> 22#include <linux/tty.h>
23 23
24#ifdef CONFIG_ARC
24#include <asm/arc/types.h> 25#include <asm/arc/types.h>
25#include <asm/sgialib.h> 26#include <asm/sgialib.h>
27#endif
28
26#include <asm/bcache.h> 29#include <asm/bcache.h>
27#include <asm/bootinfo.h> 30#include <asm/bootinfo.h>
28#include <asm/io.h> 31#include <asm/io.h>
@@ -72,8 +75,7 @@ static inline void sni_pcimt_detect(void)
72 75
73static void __init sni_display_setup(void) 76static void __init sni_display_setup(void)
74{ 77{
75#ifdef CONFIG_VT 78#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_ARC)
76#if defined(CONFIG_VGA_CONSOLE)
77 struct screen_info *si = &screen_info; 79 struct screen_info *si = &screen_info;
78 DISPLAY_STATUS *di; 80 DISPLAY_STATUS *di;
79 81
@@ -88,24 +90,54 @@ static void __init sni_display_setup(void)
88 si->orig_video_points = 16; 90 si->orig_video_points = 16;
89 } 91 }
90#endif 92#endif
91#endif
92} 93}
93 94
94static struct resource sni_io_resource = { 95static struct resource sni_io_resource = {
95 "PCIMT IO MEM", 0x00001000UL, 0x03bfffffUL, IORESOURCE_IO, 96 .start = 0x00001000UL,
97 .end = 0x03bfffffUL,
98 .name = "PCIMT IO MEM",
99 .flags = IORESOURCE_IO,
96}; 100};
97 101
98static struct resource pcimt_io_resources[] = { 102static struct resource pcimt_io_resources[] = {
99 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY }, 103 {
100 { "timer", 0x40, 0x5f, IORESOURCE_BUSY }, 104 .start = 0x00,
101 { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY }, 105 .end = 0x1f,
102 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY }, 106 .name = "dma1",
103 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, 107 .flags = IORESOURCE_BUSY
104 { "PCI config data", 0xcfc, 0xcff, IORESOURCE_BUSY } 108 }, {
109 .start = 0x40,
110 .end = 0x5f,
111 .name = "timer",
112 .flags = IORESOURCE_BUSY
113 }, {
114 .start = 0x60,
115 .end = 0x6f,
116 .name = "keyboard",
117 .flags = IORESOURCE_BUSY
118 }, {
119 .start = 0x80,
120 .end = 0x8f,
121 .name = "dma page reg",
122 .flags = IORESOURCE_BUSY
123 }, {
124 .start = 0xc0,
125 .end = 0xdf,
126 .name = "dma2",
127 .flags = IORESOURCE_BUSY
128 }, {
129 .start = 0xcfc,
130 .end = 0xcff,
131 .name = "PCI config data",
132 .flags = IORESOURCE_BUSY
133 }
105}; 134};
106 135
107static struct resource sni_mem_resource = { 136static struct resource sni_mem_resource = {
108 "PCIMT PCI MEM", 0x10000000UL, 0xffffffffUL, IORESOURCE_MEM 137 .start = 0x10000000UL,
138 .end = 0xffffffffUL,
139 .name = "PCIMT PCI MEM",
140 .flags = IORESOURCE_MEM
109}; 141};
110 142
111/* 143/*
@@ -122,19 +154,72 @@ static struct resource sni_mem_resource = {
122 * 0xa0000000 - 0xffffffff (1.5GB) PCI/EISA Bus Memory 154 * 0xa0000000 - 0xffffffff (1.5GB) PCI/EISA Bus Memory
123 */ 155 */
124static struct resource pcimt_mem_resources[] = { 156static struct resource pcimt_mem_resources[] = {
125 { "Video RAM area", 0x100a0000, 0x100bffff, IORESOURCE_BUSY }, 157 {
126 { "ISA Reserved", 0x100c0000, 0x100fffff, IORESOURCE_BUSY }, 158 .start = 0x100a0000,
127 { "PCI IO", 0x14000000, 0x17bfffff, IORESOURCE_BUSY }, 159 .end = 0x100bffff,
128 { "Cache Replacement Area", 0x17c00000, 0x17ffffff, IORESOURCE_BUSY}, 160 .name = "Video RAM area",
129 { "PCI INT Acknowledge", 0x1a000000, 0x1a000003, IORESOURCE_BUSY }, 161 .flags = IORESOURCE_BUSY
130 { "Boot PROM", 0x1fc00000, 0x1fc7ffff, IORESOURCE_BUSY}, 162 }, {
131 { "Diag PROM", 0x1fc80000, 0x1fcfffff, IORESOURCE_BUSY}, 163 .start = 0x100c0000,
132 { "X-Bus", 0x1fd00000, 0x1fdfffff, IORESOURCE_BUSY}, 164 .end = 0x100fffff,
133 { "BIOS map", 0x1fe00000, 0x1fefffff, IORESOURCE_BUSY}, 165 .name = "ISA Reserved",
134 { "NVRAM / EEPROM", 0x1ff00000, 0x1ff7ffff, IORESOURCE_BUSY}, 166 .flags = IORESOURCE_BUSY
135 { "ASIC PCI", 0x1fff0000, 0x1fffefff, IORESOURCE_BUSY}, 167 }, {
136 { "MP Agent", 0x1ffff000, 0x1fffffff, IORESOURCE_BUSY}, 168 .start = 0x14000000,
137 { "Main Memory", 0x20000000, 0x9fffffff, IORESOURCE_BUSY} 169 .end = 0x17bfffff,
170 .name = "PCI IO",
171 .flags = IORESOURCE_BUSY
172 }, {
173 .start = 0x17c00000,
174 .end = 0x17ffffff,
175 .name = "Cache Replacement Area",
176 .flags = IORESOURCE_BUSY
177 }, {
178 .start = 0x1a000000,
179 .end = 0x1a000003,
180 .name = "PCI INT Acknowledge",
181 .flags = IORESOURCE_BUSY
182 }, {
183 .start = 0x1fc00000,
184 .end = 0x1fc7ffff,
185 .name = "Boot PROM",
186 .flags = IORESOURCE_BUSY
187 }, {
188 .start = 0x1fc80000,
189 .end = 0x1fcfffff,
190 .name = "Diag PROM",
191 .flags = IORESOURCE_BUSY
192 }, {
193 .start = 0x1fd00000,
194 .end = 0x1fdfffff,
195 .name = "X-Bus",
196 .flags = IORESOURCE_BUSY
197 }, {
198 .start = 0x1fe00000,
199 .end = 0x1fefffff,
200 .name = "BIOS map",
201 .flags = IORESOURCE_BUSY
202 }, {
203 .start = 0x1ff00000,
204 .end = 0x1ff7ffff,
205 .name = "NVRAM / EEPROM",
206 .flags = IORESOURCE_BUSY
207 }, {
208 .start = 0x1fff0000,
209 .end = 0x1fffefff,
210 .name = "ASIC PCI",
211 .flags = IORESOURCE_BUSY
212 }, {
213 .start = 0x1ffff000,
214 .end = 0x1fffffff,
215 .name = "MP Agent",
216 .flags = IORESOURCE_BUSY
217 }, {
218 .start = 0x20000000,
219 .end = 0x9fffffff,
220 .name = "Main Memory",
221 .flags = IORESOURCE_BUSY
222 }
138}; 223};
139 224
140static void __init sni_resource_init(void) 225static void __init sni_resource_init(void)
@@ -168,7 +253,7 @@ static inline void sni_pcimt_time_init(void)
168 rtc_mips_set_time = mc146818_set_rtc_mmss; 253 rtc_mips_set_time = mc146818_set_rtc_mmss;
169} 254}
170 255
171void __init plat_setup(void) 256void __init plat_mem_setup(void)
172{ 257{
173 sni_pcimt_detect(); 258 sni_pcimt_detect();
174 sni_pcimt_sc_init(); 259 sni_pcimt_sc_init();
diff --git a/arch/mips/sni/sniprom.c b/arch/mips/sni/sniprom.c
new file mode 100644
index 000000000000..d1d0f1f493b4
--- /dev/null
+++ b/arch/mips/sni/sniprom.c
@@ -0,0 +1,158 @@
1/*
2 * Big Endian PROM code for SNI RM machines
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) 2005-2006 Florian Lohoff (flo@rfc822.org)
9 * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/string.h>
15
16#include <asm/addrspace.h>
17#include <asm/sni.h>
18#include <asm/mipsprom.h>
19#include <asm/bootinfo.h>
20
21/* special SNI prom calls */
22/*
23 * This does not exist in all proms - SINIX compares
24 * the prom env variable "version" against "2.0008"
25 * or greater. If lesser it tries to probe interesting
26 * registers
27 */
28#define PROM_GET_MEMCONF 58
29
30#define PROM_VEC (u64 *)CKSEG1ADDR(0x1fc00000)
31#define PROM_ENTRY(x) (PROM_VEC + (x))
32
33
34#undef DEBUG
35#ifdef DEBUG
36#define DBG_PRINTF(x...) prom_printf(x)
37#else
38#define DBG_PRINTF(x...)
39#endif
40
41static int *(*__prom_putchar)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR);
42static char *(*__prom_getenv)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV);
43static void (*__prom_get_memconf)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF);
44
45char *prom_getenv (char *s)
46{
47 return __prom_getenv(s);
48}
49
50void prom_printf(char *fmt, ...)
51{
52 va_list args;
53 char ppbuf[1024];
54 char *bptr;
55
56 va_start(args, fmt);
57 vsprintf(ppbuf, fmt, args);
58
59 bptr = ppbuf;
60
61 while (*bptr != 0) {
62 if (*bptr == '\n')
63 __prom_putchar('\r');
64
65 __prom_putchar(*bptr++);
66 }
67 va_end(args);
68}
69
70unsigned long prom_free_prom_memory(void)
71{
72 return 0;
73}
74
75/*
76 * /proc/cpuinfo system type
77 *
78 */
79static const char *systype = "Unknown";
80const char *get_system_type(void)
81{
82 return systype;
83}
84
85#define SNI_IDPROM_BASE 0xbff00000
86#define SNI_IDPROM_MEMSIZE (SNI_IDPROM_BASE+0x28) /* Memsize in 16MB quantities */
87#define SNI_IDPROM_BRDTYPE (SNI_IDPROM_BASE+0x29) /* Board Type */
88#define SNI_IDPROM_CPUTYPE (SNI_IDPROM_BASE+0x30) /* CPU Type */
89
90#define SNI_IDPROM_SIZE 0x1000
91
92#ifdef DEBUG
93static void sni_idprom_dump(void)
94{
95 int i;
96
97 prom_printf("SNI IDProm dump (first 128byte):\n");
98 for(i=0;i<128;i++) {
99 if (i%16 == 0)
100 prom_printf("%04x ", i);
101
102 prom_printf("%02x ", *(unsigned char *) (SNI_IDPROM_BASE+i));
103
104 if (i%16 == 15)
105 prom_printf("\n");
106 }
107}
108#endif
109
110static void sni_mem_init(void )
111{
112 int i, memsize;
113 struct membank {
114 u32 size;
115 u32 base;
116 u32 size2;
117 u32 pad1;
118 u32 pad2;
119 } memconf[8];
120
121 /* MemSIZE from prom in 16MByte chunks */
122 memsize=*((unsigned char *) SNI_IDPROM_MEMSIZE) * 16;
123
124 DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize);
125
126 /* get memory bank layout from prom */
127 __prom_get_memconf(&memconf);
128
129 DBG_PRINTF("prom_get_mem_conf memory configuration:\n");
130 for(i=0;i<8 && memconf[i].size;i++) {
131 prom_printf("Bank%d: %08x @ %08x\n", i,
132 memconf[i].size, memconf[i].base);
133 add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM);
134 }
135}
136
137void __init prom_init(void)
138{
139 int argc = fw_arg0;
140 char **argv = (void *)fw_arg1;
141 unsigned int sni_brd_type = *(unsigned char *) SNI_IDPROM_BRDTYPE;
142 int i;
143
144 DBG_PRINTF("Found SNI brdtype %02x\n", sni_brd_type);
145
146#ifdef DEBUG
147 sni_idprom_dump();
148#endif
149 sni_mem_init();
150
151 /* copy prom cmdline parameters to kernel cmdline */
152 for (i = 1; i < argc; i++) {
153 strcat(arcs_cmdline, argv[i]);
154 if (i < (argc - 1))
155 strcat(arcs_cmdline, " ");
156 }
157}
158
diff --git a/arch/mips/tx4927/common/tx4927_setup.c b/arch/mips/tx4927/common/tx4927_setup.c
index 77c3b66fb959..81a5acfe8c42 100644
--- a/arch/mips/tx4927/common/tx4927_setup.c
+++ b/arch/mips/tx4927/common/tx4927_setup.c
@@ -64,7 +64,7 @@ static void tx4927_write_buffer_flush(void)
64} 64}
65 65
66 66
67void __init plat_setup(void) 67void __init plat_mem_setup(void)
68{ 68{
69 board_time_init = tx4927_time_init; 69 board_time_init = tx4927_time_init;
70 board_timer_setup = tx4927_timer_setup; 70 board_timer_setup = tx4927_timer_setup;
diff --git a/arch/mips/tx4938/common/setup.c b/arch/mips/tx4938/common/setup.c
index fc992953bf95..ef59a5cffc69 100644
--- a/arch/mips/tx4938/common/setup.c
+++ b/arch/mips/tx4938/common/setup.c
@@ -61,7 +61,7 @@ tx4938_write_buffer_flush(void)
61} 61}
62 62
63void __init 63void __init
64plat_setup(void) 64plat_mem_setup(void)
65{ 65{
66 board_time_init = tx4938_time_init; 66 board_time_init = tx4938_time_init;
67 board_timer_setup = tx4938_timer_setup; 67 board_timer_setup = tx4938_timer_setup;
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
index 9166cd4557eb..96e833cd4c14 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
@@ -664,7 +664,10 @@ static struct resource rbtx4938_fpga_resource;
664 664
665static char pcode_str[8]; 665static char pcode_str[8];
666static struct resource tx4938_reg_resource = { 666static struct resource tx4938_reg_resource = {
667 pcode_str, TX4938_REG_BASE, TX4938_REG_BASE+TX4938_REG_SIZE, IORESOURCE_MEM 667 .start = TX4938_REG_BASE,
668 .end = TX4938_REG_BASE + TX4938_REG_SIZE,
669 .name = pcode_str,
670 .flags = IORESOURCE_MEM
668}; 671};
669 672
670void __init tx4938_board_setup(void) 673void __init tx4938_board_setup(void)
diff --git a/arch/mips/vr41xx/Kconfig b/arch/mips/vr41xx/Kconfig
index 055a2cdfc841..6046ef23b2bf 100644
--- a/arch/mips/vr41xx/Kconfig
+++ b/arch/mips/vr41xx/Kconfig
@@ -4,7 +4,6 @@ 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_32BIT_KERNEL
9 select SYS_SUPPORTS_LITTLE_ENDIAN 8 select SYS_SUPPORTS_LITTLE_ENDIAN
10 9
@@ -14,18 +13,15 @@ config IBM_WORKPAD
14 select DMA_NONCOHERENT 13 select DMA_NONCOHERENT
15 select IRQ_CPU 14 select IRQ_CPU
16 select ISA 15 select ISA
17 select SYS_HAS_CPU_VR41XX
18 select SYS_SUPPORTS_32BIT_KERNEL 16 select SYS_SUPPORTS_32BIT_KERNEL
19 select SYS_SUPPORTS_LITTLE_ENDIAN 17 select SYS_SUPPORTS_LITTLE_ENDIAN
20 18
21config NEC_CMBVR4133 19config NEC_CMBVR4133
22 bool "Support for NEC CMB-VR4133" 20 bool "Support for NEC CMB-VR4133"
23 depends on MACH_VR41XX 21 depends on MACH_VR41XX
24 select CPU_VR41XX
25 select DMA_NONCOHERENT 22 select DMA_NONCOHERENT
26 select IRQ_CPU 23 select IRQ_CPU
27 select HW_HAS_PCI 24 select HW_HAS_PCI
28 select SYS_HAS_CPU_VR41XX
29 select SYS_SUPPORTS_32BIT_KERNEL 25 select SYS_SUPPORTS_32BIT_KERNEL
30 select SYS_SUPPORTS_LITTLE_ENDIAN 26 select SYS_SUPPORTS_LITTLE_ENDIAN
31 27
@@ -41,7 +37,6 @@ config TANBAC_TB022X
41 select DMA_NONCOHERENT 37 select DMA_NONCOHERENT
42 select HW_HAS_PCI 38 select HW_HAS_PCI
43 select IRQ_CPU 39 select IRQ_CPU
44 select SYS_HAS_CPU_VR41XX
45 select SYS_SUPPORTS_32BIT_KERNEL 40 select SYS_SUPPORTS_32BIT_KERNEL
46 select SYS_SUPPORTS_LITTLE_ENDIAN 41 select SYS_SUPPORTS_LITTLE_ENDIAN
47 help 42 help
@@ -74,7 +69,6 @@ config VICTOR_MPC30X
74 select DMA_NONCOHERENT 69 select DMA_NONCOHERENT
75 select HW_HAS_PCI 70 select HW_HAS_PCI
76 select IRQ_CPU 71 select IRQ_CPU
77 select SYS_HAS_CPU_VR41XX
78 select SYS_SUPPORTS_32BIT_KERNEL 72 select SYS_SUPPORTS_32BIT_KERNEL
79 select SYS_SUPPORTS_LITTLE_ENDIAN 73 select SYS_SUPPORTS_LITTLE_ENDIAN
80 74
@@ -84,7 +78,6 @@ config ZAO_CAPCELLA
84 select DMA_NONCOHERENT 78 select DMA_NONCOHERENT
85 select HW_HAS_PCI 79 select HW_HAS_PCI
86 select IRQ_CPU 80 select IRQ_CPU
87 select SYS_HAS_CPU_VR41XX
88 select SYS_SUPPORTS_32BIT_KERNEL 81 select SYS_SUPPORTS_32BIT_KERNEL
89 select SYS_SUPPORTS_LITTLE_ENDIAN 82 select SYS_SUPPORTS_LITTLE_ENDIAN
90 83
diff --git a/arch/mips/vr41xx/common/init.c b/arch/mips/vr41xx/common/init.c
index 707bd0933eed..915bfa5c0719 100644
--- a/arch/mips/vr41xx/common/init.c
+++ b/arch/mips/vr41xx/common/init.c
@@ -58,7 +58,7 @@ static void __init timer_init(void)
58 board_timer_setup = setup_timer_irq; 58 board_timer_setup = setup_timer_irq;
59} 59}
60 60
61void __init plat_setup(void) 61void __init plat_mem_setup(void)
62{ 62{
63 vr41xx_calculate_clock_frequency(); 63 vr41xx_calculate_clock_frequency();
64 64
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 41e9ab40cd54..f70bd090dacd 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -822,6 +822,7 @@ static void __init prom_send_capabilities(void)
822 /* try calling the ibm,client-architecture-support method */ 822 /* try calling the ibm,client-architecture-support method */
823 if (call_prom_ret("call-method", 3, 2, &ret, 823 if (call_prom_ret("call-method", 3, 2, &ret,
824 ADDR("ibm,client-architecture-support"), 824 ADDR("ibm,client-architecture-support"),
825 root,
825 ADDR(ibm_architecture_vec)) == 0) { 826 ADDR(ibm_architecture_vec)) == 0) {
826 /* the call exists... */ 827 /* the call exists... */
827 if (ret) 828 if (ret)
@@ -1622,6 +1623,15 @@ static int __init prom_find_machine_type(void)
1622 if (strstr(p, RELOC("Power Macintosh")) || 1623 if (strstr(p, RELOC("Power Macintosh")) ||
1623 strstr(p, RELOC("MacRISC"))) 1624 strstr(p, RELOC("MacRISC")))
1624 return PLATFORM_POWERMAC; 1625 return PLATFORM_POWERMAC;
1626#ifdef CONFIG_PPC64
1627 /* We must make sure we don't detect the IBM Cell
1628 * blades as pSeries due to some firmware issues,
1629 * so we do it here.
1630 */
1631 if (strstr(p, RELOC("IBM,CBEA")) ||
1632 strstr(p, RELOC("IBM,CPBW-1.0")))
1633 return PLATFORM_GENERIC;
1634#endif /* CONFIG_PPC64 */
1625 i += sl + 1; 1635 i += sl + 1;
1626 } 1636 }
1627 } 1637 }
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 01e3c08cb550..8fdeca2d4597 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -803,10 +803,13 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int
803 if (__get_user(cmcp, &ucp->uc_regs)) 803 if (__get_user(cmcp, &ucp->uc_regs))
804 return -EFAULT; 804 return -EFAULT;
805 mcp = (struct mcontext __user *)(u64)cmcp; 805 mcp = (struct mcontext __user *)(u64)cmcp;
806 /* no need to check access_ok(mcp), since mcp < 4GB */
806 } 807 }
807#else 808#else
808 if (__get_user(mcp, &ucp->uc_regs)) 809 if (__get_user(mcp, &ucp->uc_regs))
809 return -EFAULT; 810 return -EFAULT;
811 if (!access_ok(VERIFY_READ, mcp, sizeof(*mcp)))
812 return -EFAULT;
810#endif 813#endif
811 restore_sigmask(&set); 814 restore_sigmask(&set);
812 if (restore_user_regs(regs, mcp, sig)) 815 if (restore_user_regs(regs, mcp, sig))
@@ -908,13 +911,14 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
908{ 911{
909 struct sig_dbg_op op; 912 struct sig_dbg_op op;
910 int i; 913 int i;
914 unsigned char tmp;
911 unsigned long new_msr = regs->msr; 915 unsigned long new_msr = regs->msr;
912#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 916#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
913 unsigned long new_dbcr0 = current->thread.dbcr0; 917 unsigned long new_dbcr0 = current->thread.dbcr0;
914#endif 918#endif
915 919
916 for (i=0; i<ndbg; i++) { 920 for (i=0; i<ndbg; i++) {
917 if (__copy_from_user(&op, dbg, sizeof(op))) 921 if (copy_from_user(&op, dbg + i, sizeof(op)))
918 return -EFAULT; 922 return -EFAULT;
919 switch (op.dbg_type) { 923 switch (op.dbg_type) {
920 case SIG_DBG_SINGLE_STEPPING: 924 case SIG_DBG_SINGLE_STEPPING:
@@ -959,6 +963,11 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
959 current->thread.dbcr0 = new_dbcr0; 963 current->thread.dbcr0 = new_dbcr0;
960#endif 964#endif
961 965
966 if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))
967 || __get_user(tmp, (u8 __user *) ctx)
968 || __get_user(tmp, (u8 __user *) (ctx + 1) - 1))
969 return -EFAULT;
970
962 /* 971 /*
963 * If we get a fault copying the context into the kernel's 972 * If we get a fault copying the context into the kernel's
964 * image of the user's registers, we can't just return -EFAULT 973 * image of the user's registers, we can't just return -EFAULT
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 27f65b95184d..c2db642f4cdd 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -182,6 +182,8 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
182 err |= __get_user(msr, &sc->gp_regs[PT_MSR]); 182 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
183 if (err) 183 if (err)
184 return err; 184 return err;
185 if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128)))
186 return -EFAULT;
185 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ 187 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */
186 if (v_regs != 0 && (msr & MSR_VEC) != 0) 188 if (v_regs != 0 && (msr & MSR_VEC) != 0)
187 err |= __copy_from_user(current->thread.vr, v_regs, 189 err |= __copy_from_user(current->thread.vr, v_regs,
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 33654d1b1b43..994856e55b7c 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -52,7 +52,7 @@ static inline void __tlbie(unsigned long va, unsigned int psize)
52 default: 52 default:
53 penc = mmu_psize_defs[psize].penc; 53 penc = mmu_psize_defs[psize].penc;
54 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 54 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
55 va |= (0x7f >> (8 - penc)) << 12; 55 va |= penc << 12;
56 asm volatile("tlbie %0,1" : : "r" (va) : "memory"); 56 asm volatile("tlbie %0,1" : : "r" (va) : "memory");
57 break; 57 break;
58 } 58 }
@@ -74,7 +74,7 @@ static inline void __tlbiel(unsigned long va, unsigned int psize)
74 default: 74 default:
75 penc = mmu_psize_defs[psize].penc; 75 penc = mmu_psize_defs[psize].penc;
76 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 76 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
77 va |= (0x7f >> (8 - penc)) << 12; 77 va |= penc << 12;
78 asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)" 78 asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)"
79 : : "r"(va) : "memory"); 79 : : "r"(va) : "memory");
80 break; 80 break;
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 6574b22b3cf3..fd3e5609e3e0 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -125,14 +125,13 @@ static void __init cell_init_early(void)
125 125
126static int __init cell_probe(void) 126static int __init cell_probe(void)
127{ 127{
128 /* XXX This is temporary, the Cell maintainer will come up with
129 * more appropriate detection logic
130 */
131 unsigned long root = of_get_flat_dt_root(); 128 unsigned long root = of_get_flat_dt_root();
132 if (!of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
133 return 0;
134 129
135 return 1; 130 if (of_flat_dt_is_compatible(root, "IBM,CBEA") ||
131 of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
132 return 1;
133
134 return 0;
136} 135}
137 136
138/* 137/*
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 5f79f01c44f2..3ba87835757e 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -389,6 +389,7 @@ static int __init pSeries_probe_hypertas(unsigned long node,
389 389
390static int __init pSeries_probe(void) 390static int __init pSeries_probe(void)
391{ 391{
392 unsigned long root = of_get_flat_dt_root();
392 char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(), 393 char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
393 "device_type", NULL); 394 "device_type", NULL);
394 if (dtype == NULL) 395 if (dtype == NULL)
@@ -396,6 +397,13 @@ static int __init pSeries_probe(void)
396 if (strcmp(dtype, "chrp")) 397 if (strcmp(dtype, "chrp"))
397 return 0; 398 return 0;
398 399
400 /* Cell blades firmware claims to be chrp while it's not. Until this
401 * is fixed, we need to avoid those here.
402 */
403 if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0") ||
404 of_flat_dt_is_compatible(root, "IBM,CBEA"))
405 return 0;
406
399 DBG("pSeries detected, looking for LPAR capability...\n"); 407 DBG("pSeries detected, looking for LPAR capability...\n");
400 408
401 /* Now try to figure out if we are running on LPAR */ 409 /* Now try to figure out if we are running on LPAR */
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp.c
index a93f5da6855d..40b42c88e6a7 100644
--- a/arch/sparc/kernel/smp.c
+++ b/arch/sparc/kernel/smp.c
@@ -69,6 +69,17 @@ void __init smp_store_cpu_info(int id)
69 "clock-frequency", 0); 69 "clock-frequency", 0);
70 cpu_data(id).prom_node = cpu_node; 70 cpu_data(id).prom_node = cpu_node;
71 cpu_data(id).mid = cpu_get_hwmid(cpu_node); 71 cpu_data(id).mid = cpu_get_hwmid(cpu_node);
72
73 /* this is required to tune the scheduler correctly */
74 /* is it possible to have CPUs with different cache sizes? */
75 if (id == boot_cpu_id) {
76 int cache_line,cache_nlines;
77 cache_line = 0x20;
78 cache_line = prom_getintdefault(cpu_node, "ecache-line-size", cache_line);
79 cache_nlines = 0x8000;
80 cache_nlines = prom_getintdefault(cpu_node, "ecache-nlines", cache_nlines);
81 max_cache_size = cache_line * cache_nlines;
82 }
72 if (cpu_data(id).mid < 0) 83 if (cpu_data(id).mid < 0)
73 panic("No MID found for CPU%d at node 0x%08d", id, cpu_node); 84 panic("No MID found for CPU%d at node 0x%08d", id, cpu_node);
74} 85}
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 2b7a1f316a93..0c0895202970 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -599,18 +599,128 @@ struct pci_iommu_ops pci_sun4v_iommu_ops = {
599 599
600/* SUN4V PCI configuration space accessors. */ 600/* SUN4V PCI configuration space accessors. */
601 601
602static inline int pci_sun4v_out_of_range(struct pci_pbm_info *pbm, unsigned int bus, unsigned int device, unsigned int func) 602struct pdev_entry {
603 struct pdev_entry *next;
604 u32 devhandle;
605 unsigned int bus;
606 unsigned int device;
607 unsigned int func;
608};
609
610#define PDEV_HTAB_SIZE 16
611#define PDEV_HTAB_MASK (PDEV_HTAB_SIZE - 1)
612static struct pdev_entry *pdev_htab[PDEV_HTAB_SIZE];
613
614static inline unsigned int pdev_hashfn(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func)
603{ 615{
604 if (bus == pbm->pci_first_busno) { 616 unsigned int val;
605 if (device == 0 && func == 0) 617
606 return 0; 618 val = (devhandle ^ (devhandle >> 4));
607 return 1; 619 val ^= bus;
620 val ^= device;
621 val ^= func;
622
623 return val & PDEV_HTAB_MASK;
624}
625
626static int pdev_htab_add(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func)
627{
628 struct pdev_entry *p = kmalloc(sizeof(*p), GFP_KERNEL);
629 struct pdev_entry **slot;
630
631 if (!p)
632 return -ENOMEM;
633
634 slot = &pdev_htab[pdev_hashfn(devhandle, bus, device, func)];
635 p->next = *slot;
636 *slot = p;
637
638 p->devhandle = devhandle;
639 p->bus = bus;
640 p->device = device;
641 p->func = func;
642
643 return 0;
644}
645
646/* Recursively descend into the OBP device tree, rooted at toplevel_node,
647 * looking for a PCI device matching bus and devfn.
648 */
649static int obp_find(struct linux_prom_pci_registers *pregs, int toplevel_node, unsigned int bus, unsigned int devfn)
650{
651 toplevel_node = prom_getchild(toplevel_node);
652
653 while (toplevel_node != 0) {
654 int ret = obp_find(pregs, toplevel_node, bus, devfn);
655
656 if (ret != 0)
657 return ret;
658
659 ret = prom_getproperty(toplevel_node, "reg", (char *) pregs,
660 sizeof(*pregs) * PROMREG_MAX);
661 if (ret == 0 || ret == -1)
662 goto next_sibling;
663
664 if (((pregs[0].phys_hi >> 16) & 0xff) == bus &&
665 ((pregs[0].phys_hi >> 8) & 0xff) == devfn)
666 break;
667
668 next_sibling:
669 toplevel_node = prom_getsibling(toplevel_node);
670 }
671
672 return toplevel_node;
673}
674
675static int pdev_htab_populate(struct pci_pbm_info *pbm)
676{
677 struct linux_prom_pci_registers pr[PROMREG_MAX];
678 u32 devhandle = pbm->devhandle;
679 unsigned int bus;
680
681 for (bus = pbm->pci_first_busno; bus <= pbm->pci_last_busno; bus++) {
682 unsigned int devfn;
683
684 for (devfn = 0; devfn < 256; devfn++) {
685 unsigned int device = PCI_SLOT(devfn);
686 unsigned int func = PCI_FUNC(devfn);
687
688 if (obp_find(pr, pbm->prom_node, bus, devfn)) {
689 int err = pdev_htab_add(devhandle, bus,
690 device, func);
691 if (err)
692 return err;
693 }
694 }
695 }
696
697 return 0;
698}
699
700static struct pdev_entry *pdev_find(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func)
701{
702 struct pdev_entry *p;
703
704 p = pdev_htab[pdev_hashfn(devhandle, bus, device, func)];
705 while (p) {
706 if (p->devhandle == devhandle &&
707 p->bus == bus &&
708 p->device == device &&
709 p->func == func)
710 break;
711
712 p = p->next;
608 } 713 }
609 714
715 return p;
716}
717
718static inline int pci_sun4v_out_of_range(struct pci_pbm_info *pbm, unsigned int bus, unsigned int device, unsigned int func)
719{
610 if (bus < pbm->pci_first_busno || 720 if (bus < pbm->pci_first_busno ||
611 bus > pbm->pci_last_busno) 721 bus > pbm->pci_last_busno)
612 return 1; 722 return 1;
613 return 0; 723 return pdev_find(pbm->devhandle, bus, device, func) == NULL;
614} 724}
615 725
616static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, 726static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
@@ -1063,6 +1173,8 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, int prom_node, u32
1063 1173
1064 pci_sun4v_get_bus_range(pbm); 1174 pci_sun4v_get_bus_range(pbm);
1065 pci_sun4v_iommu_init(pbm); 1175 pci_sun4v_iommu_init(pbm);
1176
1177 pdev_htab_populate(pbm);
1066} 1178}
1067 1179
1068void sun4v_pci_init(int node, char *model_name) 1180void sun4v_pci_init(int node, char *model_name)
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 4e8cd79156e0..f03d52d0b88d 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -1287,6 +1287,40 @@ int setup_profiling_timer(unsigned int multiplier)
1287 return 0; 1287 return 0;
1288} 1288}
1289 1289
1290static void __init smp_tune_scheduling(void)
1291{
1292 int instance, node;
1293 unsigned int def, smallest = ~0U;
1294
1295 def = ((tlb_type == hypervisor) ?
1296 (3 * 1024 * 1024) :
1297 (4 * 1024 * 1024));
1298
1299 instance = 0;
1300 while (!cpu_find_by_instance(instance, &node, NULL)) {
1301 unsigned int val;
1302
1303 val = prom_getintdefault(node, "ecache-size", def);
1304 if (val < smallest)
1305 smallest = val;
1306
1307 instance++;
1308 }
1309
1310 /* Any value less than 256K is nonsense. */
1311 if (smallest < (256U * 1024U))
1312 smallest = 256 * 1024;
1313
1314 max_cache_size = smallest;
1315
1316 if (smallest < 1U * 1024U * 1024U)
1317 printk(KERN_INFO "Using max_cache_size of %uKB\n",
1318 smallest / 1024U);
1319 else
1320 printk(KERN_INFO "Using max_cache_size of %uMB\n",
1321 smallest / 1024U / 1024U);
1322}
1323
1290/* Constrain the number of cpus to max_cpus. */ 1324/* Constrain the number of cpus to max_cpus. */
1291void __init smp_prepare_cpus(unsigned int max_cpus) 1325void __init smp_prepare_cpus(unsigned int max_cpus)
1292{ 1326{
@@ -1322,6 +1356,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
1322 } 1356 }
1323 1357
1324 smp_store_cpu_info(boot_cpu_id); 1358 smp_store_cpu_info(boot_cpu_id);
1359 smp_tune_scheduling();
1325} 1360}
1326 1361
1327/* Set this up early so that things like the scheduler can init 1362/* Set this up early so that things like the scheduler can init
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 62d8a99271ea..38e569f786dd 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -297,7 +297,6 @@ EXPORT_SYMBOL(svr4_getcontext);
297EXPORT_SYMBOL(svr4_setcontext); 297EXPORT_SYMBOL(svr4_setcontext);
298EXPORT_SYMBOL(compat_sys_ioctl); 298EXPORT_SYMBOL(compat_sys_ioctl);
299EXPORT_SYMBOL(sparc32_open); 299EXPORT_SYMBOL(sparc32_open);
300EXPORT_SYMBOL(sys_close);
301#endif 300#endif
302 301
303/* Special internal versions of library functions. */ 302/* Special internal versions of library functions. */
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 2793a5d82380..563db528e031 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1797,7 +1797,9 @@ static const char *sun4v_err_type_to_str(u32 type)
1797 }; 1797 };
1798} 1798}
1799 1799
1800static void sun4v_log_error(struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt) 1800extern void __show_regs(struct pt_regs * regs);
1801
1802static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt)
1801{ 1803{
1802 int cnt; 1804 int cnt;
1803 1805
@@ -1830,6 +1832,8 @@ static void sun4v_log_error(struct sun4v_error_entry *ent, int cpu, const char *
1830 pfx, 1832 pfx,
1831 ent->err_raddr, ent->err_size, ent->err_cpu); 1833 ent->err_raddr, ent->err_size, ent->err_cpu);
1832 1834
1835 __show_regs(regs);
1836
1833 if ((cnt = atomic_read(ocnt)) != 0) { 1837 if ((cnt = atomic_read(ocnt)) != 0) {
1834 atomic_set(ocnt, 0); 1838 atomic_set(ocnt, 0);
1835 wmb(); 1839 wmb();
@@ -1862,7 +1866,7 @@ void sun4v_resum_error(struct pt_regs *regs, unsigned long offset)
1862 1866
1863 put_cpu(); 1867 put_cpu();
1864 1868
1865 sun4v_log_error(&local_copy, cpu, 1869 sun4v_log_error(regs, &local_copy, cpu,
1866 KERN_ERR "RESUMABLE ERROR", 1870 KERN_ERR "RESUMABLE ERROR",
1867 &sun4v_resum_oflow_cnt); 1871 &sun4v_resum_oflow_cnt);
1868} 1872}
@@ -1910,7 +1914,7 @@ void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset)
1910 } 1914 }
1911#endif 1915#endif
1912 1916
1913 sun4v_log_error(&local_copy, cpu, 1917 sun4v_log_error(regs, &local_copy, cpu,
1914 KERN_EMERG "NON-RESUMABLE ERROR", 1918 KERN_EMERG "NON-RESUMABLE ERROR",
1915 &sun4v_nonresum_oflow_cnt); 1919 &sun4v_nonresum_oflow_cnt);
1916 1920
@@ -2200,7 +2204,6 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2200void die_if_kernel(char *str, struct pt_regs *regs) 2204void die_if_kernel(char *str, struct pt_regs *regs)
2201{ 2205{
2202 static int die_counter; 2206 static int die_counter;
2203 extern void __show_regs(struct pt_regs * regs);
2204 extern void smp_report_regs(void); 2207 extern void smp_report_regs(void);
2205 int count = 0; 2208 int count = 0;
2206 2209
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 0de3ea938830..9cc7031b7151 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -271,6 +271,18 @@ __setup("enable_8254_timer", setup_enable_8254_timer);
271#include <linux/pci_ids.h> 271#include <linux/pci_ids.h>
272#include <linux/pci.h> 272#include <linux/pci.h>
273 273
274
275#ifdef CONFIG_ACPI
276
277static int nvidia_hpet_detected __initdata;
278
279static int __init nvidia_hpet_check(unsigned long phys, unsigned long size)
280{
281 nvidia_hpet_detected = 1;
282 return 0;
283}
284#endif
285
274/* Temporary Hack. Nvidia and VIA boards currently only work with IO-APIC 286/* Temporary Hack. Nvidia and VIA boards currently only work with IO-APIC
275 off. Check for an Nvidia or VIA PCI bridge and turn it off. 287 off. Check for an Nvidia or VIA PCI bridge and turn it off.
276 Use pci direct infrastructure because this runs before the PCI subsystem. 288 Use pci direct infrastructure because this runs before the PCI subsystem.
@@ -317,11 +329,19 @@ void __init check_ioapic(void)
317 return; 329 return;
318 case PCI_VENDOR_ID_NVIDIA: 330 case PCI_VENDOR_ID_NVIDIA:
319#ifdef CONFIG_ACPI 331#ifdef CONFIG_ACPI
320 /* All timer overrides on Nvidia 332 /*
321 seem to be wrong. Skip them. */ 333 * All timer overrides on Nvidia are
322 acpi_skip_timer_override = 1; 334 * wrong unless HPET is enabled.
323 printk(KERN_INFO 335 */
324 "Nvidia board detected. Ignoring ACPI timer override.\n"); 336 nvidia_hpet_detected = 0;
337 acpi_table_parse(ACPI_HPET,
338 nvidia_hpet_check);
339 if (nvidia_hpet_detected == 0) {
340 acpi_skip_timer_override = 1;
341 printk(KERN_INFO "Nvidia board "
342 "detected. Ignoring ACPI "
343 "timer override.\n");
344 }
325#endif 345#endif
326 /* RED-PEN skip them on mptables too? */ 346 /* RED-PEN skip them on mptables too? */
327 return; 347 return;
diff --git a/block/as-iosched.c b/block/as-iosched.c
index e25a5d79ab27..a7caf35ca0c2 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -1648,17 +1648,17 @@ static void as_exit_queue(elevator_t *e)
1648 * initialize elevator private data (as_data), and alloc a arq for 1648 * initialize elevator private data (as_data), and alloc a arq for
1649 * each request on the free lists 1649 * each request on the free lists
1650 */ 1650 */
1651static int as_init_queue(request_queue_t *q, elevator_t *e) 1651static void *as_init_queue(request_queue_t *q, elevator_t *e)
1652{ 1652{
1653 struct as_data *ad; 1653 struct as_data *ad;
1654 int i; 1654 int i;
1655 1655
1656 if (!arq_pool) 1656 if (!arq_pool)
1657 return -ENOMEM; 1657 return NULL;
1658 1658
1659 ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node); 1659 ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node);
1660 if (!ad) 1660 if (!ad)
1661 return -ENOMEM; 1661 return NULL;
1662 memset(ad, 0, sizeof(*ad)); 1662 memset(ad, 0, sizeof(*ad));
1663 1663
1664 ad->q = q; /* Identify what queue the data belongs to */ 1664 ad->q = q; /* Identify what queue the data belongs to */
@@ -1667,7 +1667,7 @@ static int as_init_queue(request_queue_t *q, elevator_t *e)
1667 GFP_KERNEL, q->node); 1667 GFP_KERNEL, q->node);
1668 if (!ad->hash) { 1668 if (!ad->hash) {
1669 kfree(ad); 1669 kfree(ad);
1670 return -ENOMEM; 1670 return NULL;
1671 } 1671 }
1672 1672
1673 ad->arq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, 1673 ad->arq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab,
@@ -1675,7 +1675,7 @@ static int as_init_queue(request_queue_t *q, elevator_t *e)
1675 if (!ad->arq_pool) { 1675 if (!ad->arq_pool) {
1676 kfree(ad->hash); 1676 kfree(ad->hash);
1677 kfree(ad); 1677 kfree(ad);
1678 return -ENOMEM; 1678 return NULL;
1679 } 1679 }
1680 1680
1681 /* anticipatory scheduling helpers */ 1681 /* anticipatory scheduling helpers */
@@ -1696,14 +1696,13 @@ static int as_init_queue(request_queue_t *q, elevator_t *e)
1696 ad->antic_expire = default_antic_expire; 1696 ad->antic_expire = default_antic_expire;
1697 ad->batch_expire[REQ_SYNC] = default_read_batch_expire; 1697 ad->batch_expire[REQ_SYNC] = default_read_batch_expire;
1698 ad->batch_expire[REQ_ASYNC] = default_write_batch_expire; 1698 ad->batch_expire[REQ_ASYNC] = default_write_batch_expire;
1699 e->elevator_data = ad;
1700 1699
1701 ad->current_batch_expires = jiffies + ad->batch_expire[REQ_SYNC]; 1700 ad->current_batch_expires = jiffies + ad->batch_expire[REQ_SYNC];
1702 ad->write_batch_count = ad->batch_expire[REQ_ASYNC] / 10; 1701 ad->write_batch_count = ad->batch_expire[REQ_ASYNC] / 10;
1703 if (ad->write_batch_count < 2) 1702 if (ad->write_batch_count < 2)
1704 ad->write_batch_count = 2; 1703 ad->write_batch_count = 2;
1705 1704
1706 return 0; 1705 return ad;
1707} 1706}
1708 1707
1709/* 1708/*
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 8e9d84825e1c..052b17487625 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1323,17 +1323,12 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1323 struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); 1323 struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask);
1324 1324
1325 if (cic) { 1325 if (cic) {
1326 RB_CLEAR(&cic->rb_node); 1326 memset(cic, 0, sizeof(*cic));
1327 cic->key = NULL; 1327 RB_CLEAR_COLOR(&cic->rb_node);
1328 cic->cfqq[ASYNC] = NULL;
1329 cic->cfqq[SYNC] = NULL;
1330 cic->last_end_request = jiffies; 1328 cic->last_end_request = jiffies;
1331 cic->ttime_total = 0; 1329 INIT_LIST_HEAD(&cic->queue_list);
1332 cic->ttime_samples = 0;
1333 cic->ttime_mean = 0;
1334 cic->dtor = cfq_free_io_context; 1330 cic->dtor = cfq_free_io_context;
1335 cic->exit = cfq_exit_io_context; 1331 cic->exit = cfq_exit_io_context;
1336 INIT_LIST_HEAD(&cic->queue_list);
1337 atomic_inc(&ioc_count); 1332 atomic_inc(&ioc_count);
1338 } 1333 }
1339 1334
@@ -2251,14 +2246,14 @@ static void cfq_exit_queue(elevator_t *e)
2251 kfree(cfqd); 2246 kfree(cfqd);
2252} 2247}
2253 2248
2254static int cfq_init_queue(request_queue_t *q, elevator_t *e) 2249static void *cfq_init_queue(request_queue_t *q, elevator_t *e)
2255{ 2250{
2256 struct cfq_data *cfqd; 2251 struct cfq_data *cfqd;
2257 int i; 2252 int i;
2258 2253
2259 cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL); 2254 cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL);
2260 if (!cfqd) 2255 if (!cfqd)
2261 return -ENOMEM; 2256 return NULL;
2262 2257
2263 memset(cfqd, 0, sizeof(*cfqd)); 2258 memset(cfqd, 0, sizeof(*cfqd));
2264 2259
@@ -2288,8 +2283,6 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e)
2288 for (i = 0; i < CFQ_QHASH_ENTRIES; i++) 2283 for (i = 0; i < CFQ_QHASH_ENTRIES; i++)
2289 INIT_HLIST_HEAD(&cfqd->cfq_hash[i]); 2284 INIT_HLIST_HEAD(&cfqd->cfq_hash[i]);
2290 2285
2291 e->elevator_data = cfqd;
2292
2293 cfqd->queue = q; 2286 cfqd->queue = q;
2294 2287
2295 cfqd->max_queued = q->nr_requests / 4; 2288 cfqd->max_queued = q->nr_requests / 4;
@@ -2316,14 +2309,14 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e)
2316 cfqd->cfq_slice_async_rq = cfq_slice_async_rq; 2309 cfqd->cfq_slice_async_rq = cfq_slice_async_rq;
2317 cfqd->cfq_slice_idle = cfq_slice_idle; 2310 cfqd->cfq_slice_idle = cfq_slice_idle;
2318 2311
2319 return 0; 2312 return cfqd;
2320out_crqpool: 2313out_crqpool:
2321 kfree(cfqd->cfq_hash); 2314 kfree(cfqd->cfq_hash);
2322out_cfqhash: 2315out_cfqhash:
2323 kfree(cfqd->crq_hash); 2316 kfree(cfqd->crq_hash);
2324out_crqhash: 2317out_crqhash:
2325 kfree(cfqd); 2318 kfree(cfqd);
2326 return -ENOMEM; 2319 return NULL;
2327} 2320}
2328 2321
2329static void cfq_slab_kill(void) 2322static void cfq_slab_kill(void)
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index 399fa1e60e1f..3bd0415a9828 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -613,24 +613,24 @@ static void deadline_exit_queue(elevator_t *e)
613 * initialize elevator private data (deadline_data), and alloc a drq for 613 * initialize elevator private data (deadline_data), and alloc a drq for
614 * each request on the free lists 614 * each request on the free lists
615 */ 615 */
616static int deadline_init_queue(request_queue_t *q, elevator_t *e) 616static void *deadline_init_queue(request_queue_t *q, elevator_t *e)
617{ 617{
618 struct deadline_data *dd; 618 struct deadline_data *dd;
619 int i; 619 int i;
620 620
621 if (!drq_pool) 621 if (!drq_pool)
622 return -ENOMEM; 622 return NULL;
623 623
624 dd = kmalloc_node(sizeof(*dd), GFP_KERNEL, q->node); 624 dd = kmalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
625 if (!dd) 625 if (!dd)
626 return -ENOMEM; 626 return NULL;
627 memset(dd, 0, sizeof(*dd)); 627 memset(dd, 0, sizeof(*dd));
628 628
629 dd->hash = kmalloc_node(sizeof(struct list_head)*DL_HASH_ENTRIES, 629 dd->hash = kmalloc_node(sizeof(struct list_head)*DL_HASH_ENTRIES,
630 GFP_KERNEL, q->node); 630 GFP_KERNEL, q->node);
631 if (!dd->hash) { 631 if (!dd->hash) {
632 kfree(dd); 632 kfree(dd);
633 return -ENOMEM; 633 return NULL;
634 } 634 }
635 635
636 dd->drq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, 636 dd->drq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab,
@@ -638,7 +638,7 @@ static int deadline_init_queue(request_queue_t *q, elevator_t *e)
638 if (!dd->drq_pool) { 638 if (!dd->drq_pool) {
639 kfree(dd->hash); 639 kfree(dd->hash);
640 kfree(dd); 640 kfree(dd);
641 return -ENOMEM; 641 return NULL;
642 } 642 }
643 643
644 for (i = 0; i < DL_HASH_ENTRIES; i++) 644 for (i = 0; i < DL_HASH_ENTRIES; i++)
@@ -653,8 +653,7 @@ static int deadline_init_queue(request_queue_t *q, elevator_t *e)
653 dd->writes_starved = writes_starved; 653 dd->writes_starved = writes_starved;
654 dd->front_merges = 1; 654 dd->front_merges = 1;
655 dd->fifo_batch = fifo_batch; 655 dd->fifo_batch = fifo_batch;
656 e->elevator_data = dd; 656 return dd;
657 return 0;
658} 657}
659 658
660static void deadline_put_request(request_queue_t *q, struct request *rq) 659static void deadline_put_request(request_queue_t *q, struct request *rq)
diff --git a/block/elevator.c b/block/elevator.c
index 8768a367fdde..a0afdd317cef 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -121,16 +121,16 @@ static struct elevator_type *elevator_get(const char *name)
121 return e; 121 return e;
122} 122}
123 123
124static int elevator_attach(request_queue_t *q, struct elevator_queue *eq) 124static void *elevator_init_queue(request_queue_t *q, struct elevator_queue *eq)
125{ 125{
126 int ret = 0; 126 return eq->ops->elevator_init_fn(q, eq);
127}
127 128
129static void elevator_attach(request_queue_t *q, struct elevator_queue *eq,
130 void *data)
131{
128 q->elevator = eq; 132 q->elevator = eq;
129 133 eq->elevator_data = data;
130 if (eq->ops->elevator_init_fn)
131 ret = eq->ops->elevator_init_fn(q, eq);
132
133 return ret;
134} 134}
135 135
136static char chosen_elevator[16]; 136static char chosen_elevator[16];
@@ -181,6 +181,7 @@ int elevator_init(request_queue_t *q, char *name)
181 struct elevator_type *e = NULL; 181 struct elevator_type *e = NULL;
182 struct elevator_queue *eq; 182 struct elevator_queue *eq;
183 int ret = 0; 183 int ret = 0;
184 void *data;
184 185
185 INIT_LIST_HEAD(&q->queue_head); 186 INIT_LIST_HEAD(&q->queue_head);
186 q->last_merge = NULL; 187 q->last_merge = NULL;
@@ -202,10 +203,13 @@ int elevator_init(request_queue_t *q, char *name)
202 if (!eq) 203 if (!eq)
203 return -ENOMEM; 204 return -ENOMEM;
204 205
205 ret = elevator_attach(q, eq); 206 data = elevator_init_queue(q, eq);
206 if (ret) 207 if (!data) {
207 kobject_put(&eq->kobj); 208 kobject_put(&eq->kobj);
209 return -ENOMEM;
210 }
208 211
212 elevator_attach(q, eq, data);
209 return ret; 213 return ret;
210} 214}
211 215
@@ -722,13 +726,16 @@ int elv_register_queue(struct request_queue *q)
722 return error; 726 return error;
723} 727}
724 728
729static void __elv_unregister_queue(elevator_t *e)
730{
731 kobject_uevent(&e->kobj, KOBJ_REMOVE);
732 kobject_del(&e->kobj);
733}
734
725void elv_unregister_queue(struct request_queue *q) 735void elv_unregister_queue(struct request_queue *q)
726{ 736{
727 if (q) { 737 if (q)
728 elevator_t *e = q->elevator; 738 __elv_unregister_queue(q->elevator);
729 kobject_uevent(&e->kobj, KOBJ_REMOVE);
730 kobject_del(&e->kobj);
731 }
732} 739}
733 740
734int elv_register(struct elevator_type *e) 741int elv_register(struct elevator_type *e)
@@ -780,6 +787,7 @@ EXPORT_SYMBOL_GPL(elv_unregister);
780static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) 787static int elevator_switch(request_queue_t *q, struct elevator_type *new_e)
781{ 788{
782 elevator_t *old_elevator, *e; 789 elevator_t *old_elevator, *e;
790 void *data;
783 791
784 /* 792 /*
785 * Allocate new elevator 793 * Allocate new elevator
@@ -788,6 +796,12 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e)
788 if (!e) 796 if (!e)
789 return 0; 797 return 0;
790 798
799 data = elevator_init_queue(q, e);
800 if (!data) {
801 kobject_put(&e->kobj);
802 return 0;
803 }
804
791 /* 805 /*
792 * Turn on BYPASS and drain all requests w/ elevator private data 806 * Turn on BYPASS and drain all requests w/ elevator private data
793 */ 807 */
@@ -806,19 +820,19 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e)
806 elv_drain_elevator(q); 820 elv_drain_elevator(q);
807 } 821 }
808 822
809 spin_unlock_irq(q->queue_lock);
810
811 /* 823 /*
812 * unregister old elevator data 824 * Remember old elevator.
813 */ 825 */
814 elv_unregister_queue(q);
815 old_elevator = q->elevator; 826 old_elevator = q->elevator;
816 827
817 /* 828 /*
818 * attach and start new elevator 829 * attach and start new elevator
819 */ 830 */
820 if (elevator_attach(q, e)) 831 elevator_attach(q, e, data);
821 goto fail; 832
833 spin_unlock_irq(q->queue_lock);
834
835 __elv_unregister_queue(old_elevator);
822 836
823 if (elv_register_queue(q)) 837 if (elv_register_queue(q))
824 goto fail_register; 838 goto fail_register;
@@ -837,7 +851,6 @@ fail_register:
837 */ 851 */
838 elevator_exit(e); 852 elevator_exit(e);
839 e = NULL; 853 e = NULL;
840fail:
841 q->elevator = old_elevator; 854 q->elevator = old_elevator;
842 elv_register_queue(q); 855 elv_register_queue(q);
843 clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); 856 clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);
diff --git a/block/noop-iosched.c b/block/noop-iosched.c
index f370e4a7fe6d..56a7c620574f 100644
--- a/block/noop-iosched.c
+++ b/block/noop-iosched.c
@@ -65,16 +65,15 @@ noop_latter_request(request_queue_t *q, struct request *rq)
65 return list_entry(rq->queuelist.next, struct request, queuelist); 65 return list_entry(rq->queuelist.next, struct request, queuelist);
66} 66}
67 67
68static int noop_init_queue(request_queue_t *q, elevator_t *e) 68static void *noop_init_queue(request_queue_t *q, elevator_t *e)
69{ 69{
70 struct noop_data *nd; 70 struct noop_data *nd;
71 71
72 nd = kmalloc(sizeof(*nd), GFP_KERNEL); 72 nd = kmalloc(sizeof(*nd), GFP_KERNEL);
73 if (!nd) 73 if (!nd)
74 return -ENOMEM; 74 return NULL;
75 INIT_LIST_HEAD(&nd->queue); 75 INIT_LIST_HEAD(&nd->queue);
76 e->elevator_data = nd; 76 return nd;
77 return 0;
78} 77}
79 78
80static void noop_exit_queue(elevator_t *e) 79static void noop_exit_queue(elevator_t *e)
diff --git a/drivers/Kconfig b/drivers/Kconfig
index aeb5ab2391e4..8b11cebe65df 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -72,4 +72,6 @@ source "drivers/edac/Kconfig"
72 72
73source "drivers/rtc/Kconfig" 73source "drivers/rtc/Kconfig"
74 74
75source "drivers/dma/Kconfig"
76
75endmenu 77endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 447d8e68887a..3c5170310bd0 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -74,3 +74,4 @@ obj-$(CONFIG_SGI_SN) += sn/
74obj-y += firmware/ 74obj-y += firmware/
75obj-$(CONFIG_CRYPTO) += crypto/ 75obj-$(CONFIG_CRYPTO) += crypto/
76obj-$(CONFIG_SUPERH) += sh/ 76obj-$(CONFIG_SUPERH) += sh/
77obj-$(CONFIG_DMA_ENGINE) += dma/
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 07bc6dfe662b..8920e8c6e246 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -812,6 +812,9 @@ static int irqrouter_resume(struct sys_device *dev)
812 812
813 ACPI_FUNCTION_TRACE("irqrouter_resume"); 813 ACPI_FUNCTION_TRACE("irqrouter_resume");
814 814
815 /* Make sure SCI is enabled again (Apple firmware bug?) */
816 acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK);
817
815 acpi_in_resume = 1; 818 acpi_in_resume = 1;
816 list_for_each(node, &acpi_link.entries) { 819 list_for_each(node, &acpi_link.entries) {
817 link = list_entry(node, struct acpi_pci_link, node); 820 link = list_entry(node, struct acpi_pci_link, node);
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index abbdb37a7f5f..f36db22ce1ae 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -577,6 +577,8 @@ acpi_processor_register_performance(struct acpi_processor_performance
577 return_VALUE(-EBUSY); 577 return_VALUE(-EBUSY);
578 } 578 }
579 579
580 WARN_ON(!performance);
581
580 pr->performance = performance; 582 pr->performance = performance;
581 583
582 if (acpi_processor_get_performance_info(pr)) { 584 if (acpi_processor_get_performance_info(pr)) {
@@ -609,7 +611,8 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
609 return_VOID; 611 return_VOID;
610 } 612 }
611 613
612 kfree(pr->performance->states); 614 if (pr->performance)
615 kfree(pr->performance->states);
613 pr->performance = NULL; 616 pr->performance = NULL;
614 617
615 acpi_cpufreq_remove_file(pr); 618 acpi_cpufreq_remove_file(pr);
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index fdff774b8ab9..c1434ed11880 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -116,8 +116,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
116 skb = skb_share_check(skb, GFP_ATOMIC); 116 skb = skb_share_check(skb, GFP_ATOMIC);
117 if (skb == NULL) 117 if (skb == NULL)
118 return 0; 118 return 0;
119 if (skb_is_nonlinear(skb)) 119 if (skb_linearize(skb))
120 if (skb_linearize(skb, GFP_ATOMIC) < 0)
121 goto exit; 120 goto exit;
122 if (!is_aoe_netif(ifp)) 121 if (!is_aoe_netif(ifp))
123 goto exit; 122 goto exit;
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index a59876a0bfa1..3170eaa25087 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -1009,9 +1009,9 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
1009 if (fp->f_mode & FMODE_WRITE) { 1009 if (fp->f_mode & FMODE_WRITE) {
1010 ret = -EROFS; 1010 ret = -EROFS;
1011 if (cdrom_open_write(cdi)) 1011 if (cdrom_open_write(cdi))
1012 goto err; 1012 goto err_release;
1013 if (!CDROM_CAN(CDC_RAM)) 1013 if (!CDROM_CAN(CDC_RAM))
1014 goto err; 1014 goto err_release;
1015 ret = 0; 1015 ret = 0;
1016 cdi->media_written = 0; 1016 cdi->media_written = 0;
1017 } 1017 }
@@ -1026,6 +1026,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
1026 not be mounting, but opening with O_NONBLOCK */ 1026 not be mounting, but opening with O_NONBLOCK */
1027 check_disk_change(ip->i_bdev); 1027 check_disk_change(ip->i_bdev);
1028 return 0; 1028 return 0;
1029err_release:
1030 cdi->ops->release(cdi);
1029err: 1031err:
1030 cdi->use_count--; 1032 cdi->use_count--;
1031 return ret; 1033 return ret;
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index f5b01c6d498e..fb919bfb2824 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -41,9 +41,9 @@ obj-$(CONFIG_N_HDLC) += n_hdlc.o
41obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o 41obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
42obj-$(CONFIG_SX) += sx.o generic_serial.o 42obj-$(CONFIG_SX) += sx.o generic_serial.o
43obj-$(CONFIG_RIO) += rio/ generic_serial.o 43obj-$(CONFIG_RIO) += rio/ generic_serial.o
44obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
45obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o 44obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o
46obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o 45obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
46obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
47obj-$(CONFIG_RAW_DRIVER) += raw.o 47obj-$(CONFIG_RAW_DRIVER) += raw.o
48obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o 48obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o
49obj-$(CONFIG_MMTIMER) += mmtimer.o 49obj-$(CONFIG_MMTIMER) += mmtimer.o
diff --git a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c
index 2b5838e64751..b4e00a343da9 100644
--- a/drivers/char/agp/alpha-agp.c
+++ b/drivers/char/agp/alpha-agp.c
@@ -46,12 +46,6 @@ struct vm_operations_struct alpha_core_agp_vm_ops = {
46}; 46};
47 47
48 48
49static int alpha_core_agp_nop(void)
50{
51 /* just return success */
52 return 0;
53}
54
55static int alpha_core_agp_fetch_size(void) 49static int alpha_core_agp_fetch_size(void)
56{ 50{
57 return alpha_core_agp_sizes[0].size; 51 return alpha_core_agp_sizes[0].size;
@@ -120,6 +114,11 @@ static int alpha_core_agp_remove_memory(struct agp_memory *mem, off_t pg_start,
120 return status; 114 return status;
121} 115}
122 116
117static int alpha_core_agp_create_free_gatt_table(struct agp_bridge_data *a)
118{
119 return 0;
120}
121
123struct agp_bridge_driver alpha_core_agp_driver = { 122struct agp_bridge_driver alpha_core_agp_driver = {
124 .owner = THIS_MODULE, 123 .owner = THIS_MODULE,
125 .aperture_sizes = alpha_core_agp_sizes, 124 .aperture_sizes = alpha_core_agp_sizes,
@@ -135,8 +134,8 @@ struct agp_bridge_driver alpha_core_agp_driver = {
135 .tlb_flush = alpha_core_agp_tlbflush, 134 .tlb_flush = alpha_core_agp_tlbflush,
136 .mask_memory = agp_generic_mask_memory, 135 .mask_memory = agp_generic_mask_memory,
137 .cache_flush = global_cache_flush, 136 .cache_flush = global_cache_flush,
138 .create_gatt_table = alpha_core_agp_nop, 137 .create_gatt_table = alpha_core_agp_create_free_gatt_table,
139 .free_gatt_table = alpha_core_agp_nop, 138 .free_gatt_table = alpha_core_agp_create_free_gatt_table,
140 .insert_memory = alpha_core_agp_insert_memory, 139 .insert_memory = alpha_core_agp_insert_memory,
141 .remove_memory = alpha_core_agp_remove_memory, 140 .remove_memory = alpha_core_agp_remove_memory,
142 .alloc_by_type = agp_generic_alloc_by_type, 141 .alloc_by_type = agp_generic_alloc_by_type,
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 4e1891e2c035..a92ab53a1370 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -809,12 +809,10 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
809 case U32_APER_SIZE: 809 case U32_APER_SIZE:
810 bridge->current_size = A_IDX32(bridge); 810 bridge->current_size = A_IDX32(bridge);
811 break; 811 break;
812 /* This case will never really happen. */ 812 /* These cases will never really happen. */
813 case FIXED_APER_SIZE: 813 case FIXED_APER_SIZE:
814 case LVL2_APER_SIZE: 814 case LVL2_APER_SIZE:
815 default: 815 default:
816 bridge->current_size =
817 bridge->current_size;
818 break; 816 break;
819 } 817 }
820 temp = bridge->current_size; 818 temp = bridge->current_size;
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index bddcae54b16d..61ac3809f997 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -736,7 +736,7 @@ static int intel_i915_remove_entries(struct agp_memory *mem,off_t pg_start,
736static int intel_i915_fetch_size(void) 736static int intel_i915_fetch_size(void)
737{ 737{
738 struct aper_size_info_fixed *values; 738 struct aper_size_info_fixed *values;
739 u32 temp, offset = 0; 739 u32 temp, offset;
740 740
741#define I915_256MB_ADDRESS_MASK (1<<27) 741#define I915_256MB_ADDRESS_MASK (1<<27)
742 742
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 9846defbddb4..1de1b12043bf 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -329,7 +329,7 @@ static int agp_uninorth_suspend(struct pci_dev *pdev)
329 /* turn off AGP on the bridge */ 329 /* turn off AGP on the bridge */
330 agp = pci_find_capability(pdev, PCI_CAP_ID_AGP); 330 agp = pci_find_capability(pdev, PCI_CAP_ID_AGP);
331 pci_read_config_dword(pdev, agp + PCI_AGP_COMMAND, &cmd); 331 pci_read_config_dword(pdev, agp + PCI_AGP_COMMAND, &cmd);
332 bridge->dev_private_data = (void *)cmd; 332 bridge->dev_private_data = (void *)(long)cmd;
333 if (cmd & PCI_AGP_COMMAND_AGP) { 333 if (cmd & PCI_AGP_COMMAND_AGP) {
334 printk("uninorth-agp: disabling AGP on bridge %s\n", 334 printk("uninorth-agp: disabling AGP on bridge %s\n",
335 pci_name(pdev)); 335 pci_name(pdev));
@@ -351,7 +351,7 @@ static int agp_uninorth_resume(struct pci_dev *pdev)
351 if (bridge == NULL) 351 if (bridge == NULL)
352 return -ENODEV; 352 return -ENODEV;
353 353
354 command = (u32)bridge->dev_private_data; 354 command = (long)bridge->dev_private_data;
355 bridge->dev_private_data = NULL; 355 bridge->dev_private_data = NULL;
356 if (!(command & PCI_AGP_COMMAND_AGP)) 356 if (!(command & PCI_AGP_COMMAND_AGP))
357 return 0; 357 return 0;
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index ede365d05387..b9371d5bf790 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1384,8 +1384,10 @@ do_it_again:
1384 * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, 1384 * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode,
1385 * we won't get any more characters. 1385 * we won't get any more characters.
1386 */ 1386 */
1387 if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) 1387 if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) {
1388 n_tty_set_room(tty);
1388 check_unthrottle(tty); 1389 check_unthrottle(tty);
1390 }
1389 1391
1390 if (b - buf >= minimum) 1392 if (b - buf >= minimum)
1391 break; 1393 break;
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index 9f2f00d82917..05f8ce2cfb4a 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -127,7 +127,7 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id)
127 127
128 if (found) { 128 if (found) {
129 cn_queue_free_callback(cbq); 129 cn_queue_free_callback(cbq);
130 atomic_dec_and_test(&dev->refcnt); 130 atomic_dec(&dev->refcnt);
131 } 131 }
132} 132}
133 133
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 29b2fa5534ae..44d1eca83a72 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -257,7 +257,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
257 if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { 257 if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
258 if ((policy) && (policy->cpu == freqs->cpu) && 258 if ((policy) && (policy->cpu == freqs->cpu) &&
259 (policy->cur) && (policy->cur != freqs->old)) { 259 (policy->cur) && (policy->cur != freqs->old)) {
260 dprintk(KERN_WARNING "Warning: CPU frequency is" 260 dprintk("Warning: CPU frequency is"
261 " %u, cpufreq assumed %u kHz.\n", 261 " %u, cpufreq assumed %u kHz.\n",
262 freqs->old, policy->cur); 262 freqs->old, policy->cur);
263 freqs->old = policy->cur; 263 freqs->old = policy->cur;
@@ -874,7 +874,7 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne
874{ 874{
875 struct cpufreq_freqs freqs; 875 struct cpufreq_freqs freqs;
876 876
877 dprintk(KERN_WARNING "Warning: CPU frequency out of sync: cpufreq and timing " 877 dprintk("Warning: CPU frequency out of sync: cpufreq and timing "
878 "core thinks of %u, is %u kHz.\n", old_freq, new_freq); 878 "core thinks of %u, is %u kHz.\n", old_freq, new_freq);
879 879
880 freqs.cpu = cpu; 880 freqs.cpu = cpu;
@@ -1006,7 +1006,7 @@ static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg)
1006 struct cpufreq_freqs freqs; 1006 struct cpufreq_freqs freqs;
1007 1007
1008 if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN)) 1008 if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN))
1009 dprintk(KERN_DEBUG "Warning: CPU frequency is %u, " 1009 dprintk("Warning: CPU frequency is %u, "
1010 "cpufreq assumed %u kHz.\n", 1010 "cpufreq assumed %u kHz.\n",
1011 cur_freq, cpu_policy->cur); 1011 cur_freq, cpu_policy->cur);
1012 1012
@@ -1087,7 +1087,7 @@ static int cpufreq_resume(struct sys_device * sysdev)
1087 struct cpufreq_freqs freqs; 1087 struct cpufreq_freqs freqs;
1088 1088
1089 if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN)) 1089 if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN))
1090 dprintk(KERN_WARNING "Warning: CPU frequency" 1090 dprintk("Warning: CPU frequency"
1091 "is %u, cpufreq assumed %u kHz.\n", 1091 "is %u, cpufreq assumed %u kHz.\n",
1092 cur_freq, cpu_policy->cur); 1092 cur_freq, cpu_policy->cur);
1093 1093
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 9694b6ed3268..c576c0b3f452 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -74,7 +74,7 @@ static ssize_t
74show_total_trans(struct cpufreq_policy *policy, char *buf) 74show_total_trans(struct cpufreq_policy *policy, char *buf)
75{ 75{
76 struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu]; 76 struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu];
77 if(!stat) 77 if (!stat)
78 return 0; 78 return 0;
79 return sprintf(buf, "%d\n", 79 return sprintf(buf, "%d\n",
80 cpufreq_stats_table[stat->cpu]->total_trans); 80 cpufreq_stats_table[stat->cpu]->total_trans);
@@ -86,7 +86,7 @@ show_time_in_state(struct cpufreq_policy *policy, char *buf)
86 ssize_t len = 0; 86 ssize_t len = 0;
87 int i; 87 int i;
88 struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu]; 88 struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu];
89 if(!stat) 89 if (!stat)
90 return 0; 90 return 0;
91 cpufreq_stats_update(stat->cpu); 91 cpufreq_stats_update(stat->cpu);
92 for (i = 0; i < stat->state_num; i++) { 92 for (i = 0; i < stat->state_num; i++) {
@@ -104,7 +104,7 @@ show_trans_table(struct cpufreq_policy *policy, char *buf)
104 int i, j; 104 int i, j;
105 105
106 struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu]; 106 struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu];
107 if(!stat) 107 if (!stat)
108 return 0; 108 return 0;
109 cpufreq_stats_update(stat->cpu); 109 cpufreq_stats_update(stat->cpu);
110 len += snprintf(buf + len, PAGE_SIZE - len, " From : To\n"); 110 len += snprintf(buf + len, PAGE_SIZE - len, " From : To\n");
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index a4818ce88919..551f4ccf87fd 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -20,7 +20,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
20{ 20{
21 unsigned int min_freq = ~0; 21 unsigned int min_freq = ~0;
22 unsigned int max_freq = 0; 22 unsigned int max_freq = 0;
23 unsigned int i = 0; 23 unsigned int i;
24 24
25 for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { 25 for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
26 unsigned int freq = table[i].frequency; 26 unsigned int freq = table[i].frequency;
@@ -51,7 +51,7 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
51 struct cpufreq_frequency_table *table) 51 struct cpufreq_frequency_table *table)
52{ 52{
53 unsigned int next_larger = ~0; 53 unsigned int next_larger = ~0;
54 unsigned int i = 0; 54 unsigned int i;
55 unsigned int count = 0; 55 unsigned int count = 0;
56 56
57 dprintk("request for verification of policy (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu); 57 dprintk("request for verification of policy (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu);
@@ -91,20 +91,24 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
91 unsigned int relation, 91 unsigned int relation,
92 unsigned int *index) 92 unsigned int *index)
93{ 93{
94 struct cpufreq_frequency_table optimal = { .index = ~0, }; 94 struct cpufreq_frequency_table optimal = {
95 struct cpufreq_frequency_table suboptimal = { .index = ~0, }; 95 .index = ~0,
96 .frequency = 0,
97 };
98 struct cpufreq_frequency_table suboptimal = {
99 .index = ~0,
100 .frequency = 0,
101 };
96 unsigned int i; 102 unsigned int i;
97 103
98 dprintk("request for target %u kHz (relation: %u) for cpu %u\n", target_freq, relation, policy->cpu); 104 dprintk("request for target %u kHz (relation: %u) for cpu %u\n", target_freq, relation, policy->cpu);
99 105
100 switch (relation) { 106 switch (relation) {
101 case CPUFREQ_RELATION_H: 107 case CPUFREQ_RELATION_H:
102 optimal.frequency = 0;
103 suboptimal.frequency = ~0; 108 suboptimal.frequency = ~0;
104 break; 109 break;
105 case CPUFREQ_RELATION_L: 110 case CPUFREQ_RELATION_L:
106 optimal.frequency = ~0; 111 optimal.frequency = ~0;
107 suboptimal.frequency = 0;
108 break; 112 break;
109 } 113 }
110 114
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
new file mode 100644
index 000000000000..30d021d1a07c
--- /dev/null
+++ b/drivers/dma/Kconfig
@@ -0,0 +1,34 @@
1#
2# DMA engine configuration
3#
4
5menu "DMA Engine support"
6
7config DMA_ENGINE
8 bool "Support for DMA engines"
9 ---help---
10 DMA engines offload copy operations from the CPU to dedicated
11 hardware, allowing the copies to happen asynchronously.
12
13comment "DMA Clients"
14
15config NET_DMA
16 bool "Network: TCP receive copy offload"
17 depends on DMA_ENGINE && NET
18 default y
19 ---help---
20 This enables the use of DMA engines in the network stack to
21 offload receive copy-to-user operations, freeing CPU cycles.
22 Since this is the main user of the DMA engine, it should be enabled;
23 say Y here.
24
25comment "DMA Devices"
26
27config INTEL_IOATDMA
28 tristate "Intel I/OAT DMA support"
29 depends on DMA_ENGINE && PCI
30 default m
31 ---help---
32 Enable support for the Intel(R) I/OAT DMA engine.
33
34endmenu
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
new file mode 100644
index 000000000000..bdcfdbdb1aec
--- /dev/null
+++ b/drivers/dma/Makefile
@@ -0,0 +1,3 @@
1obj-$(CONFIG_DMA_ENGINE) += dmaengine.o
2obj-$(CONFIG_NET_DMA) += iovlock.o
3obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
new file mode 100644
index 000000000000..5829143558e1
--- /dev/null
+++ b/drivers/dma/dmaengine.c
@@ -0,0 +1,408 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that 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 for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21
22/*
23 * This code implements the DMA subsystem. It provides a HW-neutral interface
24 * for other kernel code to use asynchronous memory copy capabilities,
25 * if present, and allows different HW DMA drivers to register as providing
26 * this capability.
27 *
28 * Due to the fact we are accelerating what is already a relatively fast
29 * operation, the code goes to great lengths to avoid additional overhead,
30 * such as locking.
31 *
32 * LOCKING:
33 *
34 * The subsystem keeps two global lists, dma_device_list and dma_client_list.
35 * Both of these are protected by a mutex, dma_list_mutex.
36 *
37 * Each device has a channels list, which runs unlocked but is never modified
38 * once the device is registered, it's just setup by the driver.
39 *
40 * Each client has a channels list, it's only modified under the client->lock
41 * and in an RCU callback, so it's safe to read under rcu_read_lock().
42 *
43 * Each device has a kref, which is initialized to 1 when the device is
44 * registered. A kref_put is done for each class_device registered. When the
45 * class_device is released, the coresponding kref_put is done in the release
46 * method. Every time one of the device's channels is allocated to a client,
47 * a kref_get occurs. When the channel is freed, the coresponding kref_put
48 * happens. The device's release function does a completion, so
49 * unregister_device does a remove event, class_device_unregister, a kref_put
50 * for the first reference, then waits on the completion for all other
51 * references to finish.
52 *
53 * Each channel has an open-coded implementation of Rusty Russell's "bigref,"
54 * with a kref and a per_cpu local_t. A single reference is set when on an
55 * ADDED event, and removed with a REMOVE event. Net DMA client takes an
56 * extra reference per outstanding transaction. The relase function does a
57 * kref_put on the device. -ChrisL
58 */
59
60#include <linux/init.h>
61#include <linux/module.h>
62#include <linux/device.h>
63#include <linux/dmaengine.h>
64#include <linux/hardirq.h>
65#include <linux/spinlock.h>
66#include <linux/percpu.h>
67#include <linux/rcupdate.h>
68#include <linux/mutex.h>
69
70static DEFINE_MUTEX(dma_list_mutex);
71static LIST_HEAD(dma_device_list);
72static LIST_HEAD(dma_client_list);
73
74/* --- sysfs implementation --- */
75
76static ssize_t show_memcpy_count(struct class_device *cd, char *buf)
77{
78 struct dma_chan *chan = container_of(cd, struct dma_chan, class_dev);
79 unsigned long count = 0;
80 int i;
81
82 for_each_possible_cpu(i)
83 count += per_cpu_ptr(chan->local, i)->memcpy_count;
84
85 return sprintf(buf, "%lu\n", count);
86}
87
88static ssize_t show_bytes_transferred(struct class_device *cd, char *buf)
89{
90 struct dma_chan *chan = container_of(cd, struct dma_chan, class_dev);
91 unsigned long count = 0;
92 int i;
93
94 for_each_possible_cpu(i)
95 count += per_cpu_ptr(chan->local, i)->bytes_transferred;
96
97 return sprintf(buf, "%lu\n", count);
98}
99
100static ssize_t show_in_use(struct class_device *cd, char *buf)
101{
102 struct dma_chan *chan = container_of(cd, struct dma_chan, class_dev);
103
104 return sprintf(buf, "%d\n", (chan->client ? 1 : 0));
105}
106
107static struct class_device_attribute dma_class_attrs[] = {
108 __ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL),
109 __ATTR(bytes_transferred, S_IRUGO, show_bytes_transferred, NULL),
110 __ATTR(in_use, S_IRUGO, show_in_use, NULL),
111 __ATTR_NULL
112};
113
114static void dma_async_device_cleanup(struct kref *kref);
115
116static void dma_class_dev_release(struct class_device *cd)
117{
118 struct dma_chan *chan = container_of(cd, struct dma_chan, class_dev);
119 kref_put(&chan->device->refcount, dma_async_device_cleanup);
120}
121
122static struct class dma_devclass = {
123 .name = "dma",
124 .class_dev_attrs = dma_class_attrs,
125 .release = dma_class_dev_release,
126};
127
128/* --- client and device registration --- */
129
130/**
131 * dma_client_chan_alloc - try to allocate a channel to a client
132 * @client: &dma_client
133 *
134 * Called with dma_list_mutex held.
135 */
136static struct dma_chan *dma_client_chan_alloc(struct dma_client *client)
137{
138 struct dma_device *device;
139 struct dma_chan *chan;
140 unsigned long flags;
141 int desc; /* allocated descriptor count */
142
143 /* Find a channel, any DMA engine will do */
144 list_for_each_entry(device, &dma_device_list, global_node) {
145 list_for_each_entry(chan, &device->channels, device_node) {
146 if (chan->client)
147 continue;
148
149 desc = chan->device->device_alloc_chan_resources(chan);
150 if (desc >= 0) {
151 kref_get(&device->refcount);
152 kref_init(&chan->refcount);
153 chan->slow_ref = 0;
154 INIT_RCU_HEAD(&chan->rcu);
155 chan->client = client;
156 spin_lock_irqsave(&client->lock, flags);
157 list_add_tail_rcu(&chan->client_node,
158 &client->channels);
159 spin_unlock_irqrestore(&client->lock, flags);
160 return chan;
161 }
162 }
163 }
164
165 return NULL;
166}
167
168/**
169 * dma_client_chan_free - release a DMA channel
170 * @chan: &dma_chan
171 */
172void dma_chan_cleanup(struct kref *kref)
173{
174 struct dma_chan *chan = container_of(kref, struct dma_chan, refcount);
175 chan->device->device_free_chan_resources(chan);
176 chan->client = NULL;
177 kref_put(&chan->device->refcount, dma_async_device_cleanup);
178}
179
180static void dma_chan_free_rcu(struct rcu_head *rcu)
181{
182 struct dma_chan *chan = container_of(rcu, struct dma_chan, rcu);
183 int bias = 0x7FFFFFFF;
184 int i;
185 for_each_possible_cpu(i)
186 bias -= local_read(&per_cpu_ptr(chan->local, i)->refcount);
187 atomic_sub(bias, &chan->refcount.refcount);
188 kref_put(&chan->refcount, dma_chan_cleanup);
189}
190
191static void dma_client_chan_free(struct dma_chan *chan)
192{
193 atomic_add(0x7FFFFFFF, &chan->refcount.refcount);
194 chan->slow_ref = 1;
195 call_rcu(&chan->rcu, dma_chan_free_rcu);
196}
197
198/**
199 * dma_chans_rebalance - reallocate channels to clients
200 *
201 * When the number of DMA channel in the system changes,
202 * channels need to be rebalanced among clients
203 */
204static void dma_chans_rebalance(void)
205{
206 struct dma_client *client;
207 struct dma_chan *chan;
208 unsigned long flags;
209
210 mutex_lock(&dma_list_mutex);
211
212 list_for_each_entry(client, &dma_client_list, global_node) {
213 while (client->chans_desired > client->chan_count) {
214 chan = dma_client_chan_alloc(client);
215 if (!chan)
216 break;
217 client->chan_count++;
218 client->event_callback(client,
219 chan,
220 DMA_RESOURCE_ADDED);
221 }
222 while (client->chans_desired < client->chan_count) {
223 spin_lock_irqsave(&client->lock, flags);
224 chan = list_entry(client->channels.next,
225 struct dma_chan,
226 client_node);
227 list_del_rcu(&chan->client_node);
228 spin_unlock_irqrestore(&client->lock, flags);
229 client->chan_count--;
230 client->event_callback(client,
231 chan,
232 DMA_RESOURCE_REMOVED);
233 dma_client_chan_free(chan);
234 }
235 }
236
237 mutex_unlock(&dma_list_mutex);
238}
239
240/**
241 * dma_async_client_register - allocate and register a &dma_client
242 * @event_callback: callback for notification of channel addition/removal
243 */
244struct dma_client *dma_async_client_register(dma_event_callback event_callback)
245{
246 struct dma_client *client;
247
248 client = kzalloc(sizeof(*client), GFP_KERNEL);
249 if (!client)
250 return NULL;
251
252 INIT_LIST_HEAD(&client->channels);
253 spin_lock_init(&client->lock);
254 client->chans_desired = 0;
255 client->chan_count = 0;
256 client->event_callback = event_callback;
257
258 mutex_lock(&dma_list_mutex);
259 list_add_tail(&client->global_node, &dma_client_list);
260 mutex_unlock(&dma_list_mutex);
261
262 return client;
263}
264
265/**
266 * dma_async_client_unregister - unregister a client and free the &dma_client
267 * @client:
268 *
269 * Force frees any allocated DMA channels, frees the &dma_client memory
270 */
271void dma_async_client_unregister(struct dma_client *client)
272{
273 struct dma_chan *chan;
274
275 if (!client)
276 return;
277
278 rcu_read_lock();
279 list_for_each_entry_rcu(chan, &client->channels, client_node)
280 dma_client_chan_free(chan);
281 rcu_read_unlock();
282
283 mutex_lock(&dma_list_mutex);
284 list_del(&client->global_node);
285 mutex_unlock(&dma_list_mutex);
286
287 kfree(client);
288 dma_chans_rebalance();
289}
290
291/**
292 * dma_async_client_chan_request - request DMA channels
293 * @client: &dma_client
294 * @number: count of DMA channels requested
295 *
296 * Clients call dma_async_client_chan_request() to specify how many
297 * DMA channels they need, 0 to free all currently allocated.
298 * The resulting allocations/frees are indicated to the client via the
299 * event callback.
300 */
301void dma_async_client_chan_request(struct dma_client *client,
302 unsigned int number)
303{
304 client->chans_desired = number;
305 dma_chans_rebalance();
306}
307
308/**
309 * dma_async_device_register -
310 * @device: &dma_device
311 */
312int dma_async_device_register(struct dma_device *device)
313{
314 static int id;
315 int chancnt = 0;
316 struct dma_chan* chan;
317
318 if (!device)
319 return -ENODEV;
320
321 init_completion(&device->done);
322 kref_init(&device->refcount);
323 device->dev_id = id++;
324
325 /* represent channels in sysfs. Probably want devs too */
326 list_for_each_entry(chan, &device->channels, device_node) {
327 chan->local = alloc_percpu(typeof(*chan->local));
328 if (chan->local == NULL)
329 continue;
330
331 chan->chan_id = chancnt++;
332 chan->class_dev.class = &dma_devclass;
333 chan->class_dev.dev = NULL;
334 snprintf(chan->class_dev.class_id, BUS_ID_SIZE, "dma%dchan%d",
335 device->dev_id, chan->chan_id);
336
337 kref_get(&device->refcount);
338 class_device_register(&chan->class_dev);
339 }
340
341 mutex_lock(&dma_list_mutex);
342 list_add_tail(&device->global_node, &dma_device_list);
343 mutex_unlock(&dma_list_mutex);
344
345 dma_chans_rebalance();
346
347 return 0;
348}
349
350/**
351 * dma_async_device_unregister -
352 * @device: &dma_device
353 */
354static void dma_async_device_cleanup(struct kref *kref)
355{
356 struct dma_device *device;
357
358 device = container_of(kref, struct dma_device, refcount);
359 complete(&device->done);
360}
361
362void dma_async_device_unregister(struct dma_device* device)
363{
364 struct dma_chan *chan;
365 unsigned long flags;
366
367 mutex_lock(&dma_list_mutex);
368 list_del(&device->global_node);
369 mutex_unlock(&dma_list_mutex);
370
371 list_for_each_entry(chan, &device->channels, device_node) {
372 if (chan->client) {
373 spin_lock_irqsave(&chan->client->lock, flags);
374 list_del(&chan->client_node);
375 chan->client->chan_count--;
376 spin_unlock_irqrestore(&chan->client->lock, flags);
377 chan->client->event_callback(chan->client,
378 chan,
379 DMA_RESOURCE_REMOVED);
380 dma_client_chan_free(chan);
381 }
382 class_device_unregister(&chan->class_dev);
383 }
384 dma_chans_rebalance();
385
386 kref_put(&device->refcount, dma_async_device_cleanup);
387 wait_for_completion(&device->done);
388}
389
390static int __init dma_bus_init(void)
391{
392 mutex_init(&dma_list_mutex);
393 return class_register(&dma_devclass);
394}
395
396subsys_initcall(dma_bus_init);
397
398EXPORT_SYMBOL(dma_async_client_register);
399EXPORT_SYMBOL(dma_async_client_unregister);
400EXPORT_SYMBOL(dma_async_client_chan_request);
401EXPORT_SYMBOL(dma_async_memcpy_buf_to_buf);
402EXPORT_SYMBOL(dma_async_memcpy_buf_to_pg);
403EXPORT_SYMBOL(dma_async_memcpy_pg_to_pg);
404EXPORT_SYMBOL(dma_async_memcpy_complete);
405EXPORT_SYMBOL(dma_async_memcpy_issue_pending);
406EXPORT_SYMBOL(dma_async_device_register);
407EXPORT_SYMBOL(dma_async_device_unregister);
408EXPORT_SYMBOL(dma_chan_cleanup);
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c
new file mode 100644
index 000000000000..0fdf7fbd6495
--- /dev/null
+++ b/drivers/dma/ioatdma.c
@@ -0,0 +1,840 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that 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 for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21
22/*
23 * This driver supports an Intel I/OAT DMA engine, which does asynchronous
24 * copy operations.
25 */
26
27#include <linux/init.h>
28#include <linux/module.h>
29#include <linux/pci.h>
30#include <linux/interrupt.h>
31#include <linux/dmaengine.h>
32#include <linux/delay.h>
33#include <linux/dma-mapping.h>
34#include "ioatdma.h"
35#include "ioatdma_io.h"
36#include "ioatdma_registers.h"
37#include "ioatdma_hw.h"
38
39#define to_ioat_chan(chan) container_of(chan, struct ioat_dma_chan, common)
40#define to_ioat_device(dev) container_of(dev, struct ioat_device, common)
41#define to_ioat_desc(lh) container_of(lh, struct ioat_desc_sw, node)
42
43/* internal functions */
44static int __devinit ioat_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
45static void __devexit ioat_remove(struct pci_dev *pdev);
46
47static int enumerate_dma_channels(struct ioat_device *device)
48{
49 u8 xfercap_scale;
50 u32 xfercap;
51 int i;
52 struct ioat_dma_chan *ioat_chan;
53
54 device->common.chancnt = ioatdma_read8(device, IOAT_CHANCNT_OFFSET);
55 xfercap_scale = ioatdma_read8(device, IOAT_XFERCAP_OFFSET);
56 xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale));
57
58 for (i = 0; i < device->common.chancnt; i++) {
59 ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL);
60 if (!ioat_chan) {
61 device->common.chancnt = i;
62 break;
63 }
64
65 ioat_chan->device = device;
66 ioat_chan->reg_base = device->reg_base + (0x80 * (i + 1));
67 ioat_chan->xfercap = xfercap;
68 spin_lock_init(&ioat_chan->cleanup_lock);
69 spin_lock_init(&ioat_chan->desc_lock);
70 INIT_LIST_HEAD(&ioat_chan->free_desc);
71 INIT_LIST_HEAD(&ioat_chan->used_desc);
72 /* This should be made common somewhere in dmaengine.c */
73 ioat_chan->common.device = &device->common;
74 ioat_chan->common.client = NULL;
75 list_add_tail(&ioat_chan->common.device_node,
76 &device->common.channels);
77 }
78 return device->common.chancnt;
79}
80
81static struct ioat_desc_sw *ioat_dma_alloc_descriptor(
82 struct ioat_dma_chan *ioat_chan,
83 int flags)
84{
85 struct ioat_dma_descriptor *desc;
86 struct ioat_desc_sw *desc_sw;
87 struct ioat_device *ioat_device;
88 dma_addr_t phys;
89
90 ioat_device = to_ioat_device(ioat_chan->common.device);
91 desc = pci_pool_alloc(ioat_device->dma_pool, flags, &phys);
92 if (unlikely(!desc))
93 return NULL;
94
95 desc_sw = kzalloc(sizeof(*desc_sw), flags);
96 if (unlikely(!desc_sw)) {
97 pci_pool_free(ioat_device->dma_pool, desc, phys);
98 return NULL;
99 }
100
101 memset(desc, 0, sizeof(*desc));
102 desc_sw->hw = desc;
103 desc_sw->phys = phys;
104
105 return desc_sw;
106}
107
108#define INITIAL_IOAT_DESC_COUNT 128
109
110static void ioat_start_null_desc(struct ioat_dma_chan *ioat_chan);
111
112/* returns the actual number of allocated descriptors */
113static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
114{
115 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
116 struct ioat_desc_sw *desc = NULL;
117 u16 chanctrl;
118 u32 chanerr;
119 int i;
120 LIST_HEAD(tmp_list);
121
122 /*
123 * In-use bit automatically set by reading chanctrl
124 * If 0, we got it, if 1, someone else did
125 */
126 chanctrl = ioatdma_chan_read16(ioat_chan, IOAT_CHANCTRL_OFFSET);
127 if (chanctrl & IOAT_CHANCTRL_CHANNEL_IN_USE)
128 return -EBUSY;
129
130 /* Setup register to interrupt and write completion status on error */
131 chanctrl = IOAT_CHANCTRL_CHANNEL_IN_USE |
132 IOAT_CHANCTRL_ERR_INT_EN |
133 IOAT_CHANCTRL_ANY_ERR_ABORT_EN |
134 IOAT_CHANCTRL_ERR_COMPLETION_EN;
135 ioatdma_chan_write16(ioat_chan, IOAT_CHANCTRL_OFFSET, chanctrl);
136
137 chanerr = ioatdma_chan_read32(ioat_chan, IOAT_CHANERR_OFFSET);
138 if (chanerr) {
139 printk("IOAT: CHANERR = %x, clearing\n", chanerr);
140 ioatdma_chan_write32(ioat_chan, IOAT_CHANERR_OFFSET, chanerr);
141 }
142
143 /* Allocate descriptors */
144 for (i = 0; i < INITIAL_IOAT_DESC_COUNT; i++) {
145 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL);
146 if (!desc) {
147 printk(KERN_ERR "IOAT: Only %d initial descriptors\n", i);
148 break;
149 }
150 list_add_tail(&desc->node, &tmp_list);
151 }
152 spin_lock_bh(&ioat_chan->desc_lock);
153 list_splice(&tmp_list, &ioat_chan->free_desc);
154 spin_unlock_bh(&ioat_chan->desc_lock);
155
156 /* allocate a completion writeback area */
157 /* doing 2 32bit writes to mmio since 1 64b write doesn't work */
158 ioat_chan->completion_virt =
159 pci_pool_alloc(ioat_chan->device->completion_pool,
160 GFP_KERNEL,
161 &ioat_chan->completion_addr);
162 memset(ioat_chan->completion_virt, 0,
163 sizeof(*ioat_chan->completion_virt));
164 ioatdma_chan_write32(ioat_chan, IOAT_CHANCMP_OFFSET_LOW,
165 ((u64) ioat_chan->completion_addr) & 0x00000000FFFFFFFF);
166 ioatdma_chan_write32(ioat_chan, IOAT_CHANCMP_OFFSET_HIGH,
167 ((u64) ioat_chan->completion_addr) >> 32);
168
169 ioat_start_null_desc(ioat_chan);
170 return i;
171}
172
173static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan);
174
175static void ioat_dma_free_chan_resources(struct dma_chan *chan)
176{
177 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
178 struct ioat_device *ioat_device = to_ioat_device(chan->device);
179 struct ioat_desc_sw *desc, *_desc;
180 u16 chanctrl;
181 int in_use_descs = 0;
182
183 ioat_dma_memcpy_cleanup(ioat_chan);
184
185 ioatdma_chan_write8(ioat_chan, IOAT_CHANCMD_OFFSET, IOAT_CHANCMD_RESET);
186
187 spin_lock_bh(&ioat_chan->desc_lock);
188 list_for_each_entry_safe(desc, _desc, &ioat_chan->used_desc, node) {
189 in_use_descs++;
190 list_del(&desc->node);
191 pci_pool_free(ioat_device->dma_pool, desc->hw, desc->phys);
192 kfree(desc);
193 }
194 list_for_each_entry_safe(desc, _desc, &ioat_chan->free_desc, node) {
195 list_del(&desc->node);
196 pci_pool_free(ioat_device->dma_pool, desc->hw, desc->phys);
197 kfree(desc);
198 }
199 spin_unlock_bh(&ioat_chan->desc_lock);
200
201 pci_pool_free(ioat_device->completion_pool,
202 ioat_chan->completion_virt,
203 ioat_chan->completion_addr);
204
205 /* one is ok since we left it on there on purpose */
206 if (in_use_descs > 1)
207 printk(KERN_ERR "IOAT: Freeing %d in use descriptors!\n",
208 in_use_descs - 1);
209
210 ioat_chan->last_completion = ioat_chan->completion_addr = 0;
211
212 /* Tell hw the chan is free */
213 chanctrl = ioatdma_chan_read16(ioat_chan, IOAT_CHANCTRL_OFFSET);
214 chanctrl &= ~IOAT_CHANCTRL_CHANNEL_IN_USE;
215 ioatdma_chan_write16(ioat_chan, IOAT_CHANCTRL_OFFSET, chanctrl);
216}
217
218/**
219 * do_ioat_dma_memcpy - actual function that initiates a IOAT DMA transaction
220 * @chan: IOAT DMA channel handle
221 * @dest: DMA destination address
222 * @src: DMA source address
223 * @len: transaction length in bytes
224 */
225
226static dma_cookie_t do_ioat_dma_memcpy(struct ioat_dma_chan *ioat_chan,
227 dma_addr_t dest,
228 dma_addr_t src,
229 size_t len)
230{
231 struct ioat_desc_sw *first;
232 struct ioat_desc_sw *prev;
233 struct ioat_desc_sw *new;
234 dma_cookie_t cookie;
235 LIST_HEAD(new_chain);
236 u32 copy;
237 size_t orig_len;
238 dma_addr_t orig_src, orig_dst;
239 unsigned int desc_count = 0;
240 unsigned int append = 0;
241
242 if (!ioat_chan || !dest || !src)
243 return -EFAULT;
244
245 if (!len)
246 return ioat_chan->common.cookie;
247
248 orig_len = len;
249 orig_src = src;
250 orig_dst = dest;
251
252 first = NULL;
253 prev = NULL;
254
255 spin_lock_bh(&ioat_chan->desc_lock);
256
257 while (len) {
258 if (!list_empty(&ioat_chan->free_desc)) {
259 new = to_ioat_desc(ioat_chan->free_desc.next);
260 list_del(&new->node);
261 } else {
262 /* try to get another desc */
263 new = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC);
264 /* will this ever happen? */
265 /* TODO add upper limit on these */
266 BUG_ON(!new);
267 }
268
269 copy = min((u32) len, ioat_chan->xfercap);
270
271 new->hw->size = copy;
272 new->hw->ctl = 0;
273 new->hw->src_addr = src;
274 new->hw->dst_addr = dest;
275 new->cookie = 0;
276
277 /* chain together the physical address list for the HW */
278 if (!first)
279 first = new;
280 else
281 prev->hw->next = (u64) new->phys;
282
283 prev = new;
284
285 len -= copy;
286 dest += copy;
287 src += copy;
288
289 list_add_tail(&new->node, &new_chain);
290 desc_count++;
291 }
292 new->hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
293 new->hw->next = 0;
294
295 /* cookie incr and addition to used_list must be atomic */
296
297 cookie = ioat_chan->common.cookie;
298 cookie++;
299 if (cookie < 0)
300 cookie = 1;
301 ioat_chan->common.cookie = new->cookie = cookie;
302
303 pci_unmap_addr_set(new, src, orig_src);
304 pci_unmap_addr_set(new, dst, orig_dst);
305 pci_unmap_len_set(new, src_len, orig_len);
306 pci_unmap_len_set(new, dst_len, orig_len);
307
308 /* write address into NextDescriptor field of last desc in chain */
309 to_ioat_desc(ioat_chan->used_desc.prev)->hw->next = first->phys;
310 list_splice_init(&new_chain, ioat_chan->used_desc.prev);
311
312 ioat_chan->pending += desc_count;
313 if (ioat_chan->pending >= 20) {
314 append = 1;
315 ioat_chan->pending = 0;
316 }
317
318 spin_unlock_bh(&ioat_chan->desc_lock);
319
320 if (append)
321 ioatdma_chan_write8(ioat_chan,
322 IOAT_CHANCMD_OFFSET,
323 IOAT_CHANCMD_APPEND);
324 return cookie;
325}
326
327/**
328 * ioat_dma_memcpy_buf_to_buf - wrapper that takes src & dest bufs
329 * @chan: IOAT DMA channel handle
330 * @dest: DMA destination address
331 * @src: DMA source address
332 * @len: transaction length in bytes
333 */
334
335static dma_cookie_t ioat_dma_memcpy_buf_to_buf(struct dma_chan *chan,
336 void *dest,
337 void *src,
338 size_t len)
339{
340 dma_addr_t dest_addr;
341 dma_addr_t src_addr;
342 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
343
344 dest_addr = pci_map_single(ioat_chan->device->pdev,
345 dest, len, PCI_DMA_FROMDEVICE);
346 src_addr = pci_map_single(ioat_chan->device->pdev,
347 src, len, PCI_DMA_TODEVICE);
348
349 return do_ioat_dma_memcpy(ioat_chan, dest_addr, src_addr, len);
350}
351
352/**
353 * ioat_dma_memcpy_buf_to_pg - wrapper, copying from a buf to a page
354 * @chan: IOAT DMA channel handle
355 * @page: pointer to the page to copy to
356 * @offset: offset into that page
357 * @src: DMA source address
358 * @len: transaction length in bytes
359 */
360
361static dma_cookie_t ioat_dma_memcpy_buf_to_pg(struct dma_chan *chan,
362 struct page *page,
363 unsigned int offset,
364 void *src,
365 size_t len)
366{
367 dma_addr_t dest_addr;
368 dma_addr_t src_addr;
369 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
370
371 dest_addr = pci_map_page(ioat_chan->device->pdev,
372 page, offset, len, PCI_DMA_FROMDEVICE);
373 src_addr = pci_map_single(ioat_chan->device->pdev,
374 src, len, PCI_DMA_TODEVICE);
375
376 return do_ioat_dma_memcpy(ioat_chan, dest_addr, src_addr, len);
377}
378
379/**
380 * ioat_dma_memcpy_pg_to_pg - wrapper, copying between two pages
381 * @chan: IOAT DMA channel handle
382 * @dest_pg: pointer to the page to copy to
383 * @dest_off: offset into that page
384 * @src_pg: pointer to the page to copy from
385 * @src_off: offset into that page
386 * @len: transaction length in bytes. This is guaranteed to not make a copy
387 * across a page boundary.
388 */
389
390static dma_cookie_t ioat_dma_memcpy_pg_to_pg(struct dma_chan *chan,
391 struct page *dest_pg,
392 unsigned int dest_off,
393 struct page *src_pg,
394 unsigned int src_off,
395 size_t len)
396{
397 dma_addr_t dest_addr;
398 dma_addr_t src_addr;
399 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
400
401 dest_addr = pci_map_page(ioat_chan->device->pdev,
402 dest_pg, dest_off, len, PCI_DMA_FROMDEVICE);
403 src_addr = pci_map_page(ioat_chan->device->pdev,
404 src_pg, src_off, len, PCI_DMA_TODEVICE);
405
406 return do_ioat_dma_memcpy(ioat_chan, dest_addr, src_addr, len);
407}
408
409/**
410 * ioat_dma_memcpy_issue_pending - push potentially unrecognoized appended descriptors to hw
411 * @chan: DMA channel handle
412 */
413
414static void ioat_dma_memcpy_issue_pending(struct dma_chan *chan)
415{
416 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
417
418 if (ioat_chan->pending != 0) {
419 ioat_chan->pending = 0;
420 ioatdma_chan_write8(ioat_chan,
421 IOAT_CHANCMD_OFFSET,
422 IOAT_CHANCMD_APPEND);
423 }
424}
425
426static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *chan)
427{
428 unsigned long phys_complete;
429 struct ioat_desc_sw *desc, *_desc;
430 dma_cookie_t cookie = 0;
431
432 prefetch(chan->completion_virt);
433
434 if (!spin_trylock(&chan->cleanup_lock))
435 return;
436
437 /* The completion writeback can happen at any time,
438 so reads by the driver need to be atomic operations
439 The descriptor physical addresses are limited to 32-bits
440 when the CPU can only do a 32-bit mov */
441
442#if (BITS_PER_LONG == 64)
443 phys_complete =
444 chan->completion_virt->full & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR;
445#else
446 phys_complete = chan->completion_virt->low & IOAT_LOW_COMPLETION_MASK;
447#endif
448
449 if ((chan->completion_virt->full & IOAT_CHANSTS_DMA_TRANSFER_STATUS) ==
450 IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED) {
451 printk("IOAT: Channel halted, chanerr = %x\n",
452 ioatdma_chan_read32(chan, IOAT_CHANERR_OFFSET));
453
454 /* TODO do something to salvage the situation */
455 }
456
457 if (phys_complete == chan->last_completion) {
458 spin_unlock(&chan->cleanup_lock);
459 return;
460 }
461
462 spin_lock_bh(&chan->desc_lock);
463 list_for_each_entry_safe(desc, _desc, &chan->used_desc, node) {
464
465 /*
466 * Incoming DMA requests may use multiple descriptors, due to
467 * exceeding xfercap, perhaps. If so, only the last one will
468 * have a cookie, and require unmapping.
469 */
470 if (desc->cookie) {
471 cookie = desc->cookie;
472
473 /* yes we are unmapping both _page and _single alloc'd
474 regions with unmap_page. Is this *really* that bad?
475 */
476 pci_unmap_page(chan->device->pdev,
477 pci_unmap_addr(desc, dst),
478 pci_unmap_len(desc, dst_len),
479 PCI_DMA_FROMDEVICE);
480 pci_unmap_page(chan->device->pdev,
481 pci_unmap_addr(desc, src),
482 pci_unmap_len(desc, src_len),
483 PCI_DMA_TODEVICE);
484 }
485
486 if (desc->phys != phys_complete) {
487 /* a completed entry, but not the last, so cleanup */
488 list_del(&desc->node);
489 list_add_tail(&desc->node, &chan->free_desc);
490 } else {
491 /* last used desc. Do not remove, so we can append from
492 it, but don't look at it next time, either */
493 desc->cookie = 0;
494
495 /* TODO check status bits? */
496 break;
497 }
498 }
499
500 spin_unlock_bh(&chan->desc_lock);
501
502 chan->last_completion = phys_complete;
503 if (cookie != 0)
504 chan->completed_cookie = cookie;
505
506 spin_unlock(&chan->cleanup_lock);
507}
508
509/**
510 * ioat_dma_is_complete - poll the status of a IOAT DMA transaction
511 * @chan: IOAT DMA channel handle
512 * @cookie: DMA transaction identifier
513 */
514
515static enum dma_status ioat_dma_is_complete(struct dma_chan *chan,
516 dma_cookie_t cookie,
517 dma_cookie_t *done,
518 dma_cookie_t *used)
519{
520 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
521 dma_cookie_t last_used;
522 dma_cookie_t last_complete;
523 enum dma_status ret;
524
525 last_used = chan->cookie;
526 last_complete = ioat_chan->completed_cookie;
527
528 if (done)
529 *done= last_complete;
530 if (used)
531 *used = last_used;
532
533 ret = dma_async_is_complete(cookie, last_complete, last_used);
534 if (ret == DMA_SUCCESS)
535 return ret;
536
537 ioat_dma_memcpy_cleanup(ioat_chan);
538
539 last_used = chan->cookie;
540 last_complete = ioat_chan->completed_cookie;
541
542 if (done)
543 *done= last_complete;
544 if (used)
545 *used = last_used;
546
547 return dma_async_is_complete(cookie, last_complete, last_used);
548}
549
550/* PCI API */
551
552static struct pci_device_id ioat_pci_tbl[] = {
553 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT) },
554 { 0, }
555};
556
557static struct pci_driver ioat_pci_drv = {
558 .name = "ioatdma",
559 .id_table = ioat_pci_tbl,
560 .probe = ioat_probe,
561 .remove = __devexit_p(ioat_remove),
562};
563
564static irqreturn_t ioat_do_interrupt(int irq, void *data, struct pt_regs *regs)
565{
566 struct ioat_device *instance = data;
567 unsigned long attnstatus;
568 u8 intrctrl;
569
570 intrctrl = ioatdma_read8(instance, IOAT_INTRCTRL_OFFSET);
571
572 if (!(intrctrl & IOAT_INTRCTRL_MASTER_INT_EN))
573 return IRQ_NONE;
574
575 if (!(intrctrl & IOAT_INTRCTRL_INT_STATUS)) {
576 ioatdma_write8(instance, IOAT_INTRCTRL_OFFSET, intrctrl);
577 return IRQ_NONE;
578 }
579
580 attnstatus = ioatdma_read32(instance, IOAT_ATTNSTATUS_OFFSET);
581
582 printk(KERN_ERR "ioatdma error: interrupt! status %lx\n", attnstatus);
583
584 ioatdma_write8(instance, IOAT_INTRCTRL_OFFSET, intrctrl);
585 return IRQ_HANDLED;
586}
587
588static void ioat_start_null_desc(struct ioat_dma_chan *ioat_chan)
589{
590 struct ioat_desc_sw *desc;
591
592 spin_lock_bh(&ioat_chan->desc_lock);
593
594 if (!list_empty(&ioat_chan->free_desc)) {
595 desc = to_ioat_desc(ioat_chan->free_desc.next);
596 list_del(&desc->node);
597 } else {
598 /* try to get another desc */
599 spin_unlock_bh(&ioat_chan->desc_lock);
600 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL);
601 spin_lock_bh(&ioat_chan->desc_lock);
602 /* will this ever happen? */
603 BUG_ON(!desc);
604 }
605
606 desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL;
607 desc->hw->next = 0;
608
609 list_add_tail(&desc->node, &ioat_chan->used_desc);
610 spin_unlock_bh(&ioat_chan->desc_lock);
611
612#if (BITS_PER_LONG == 64)
613 ioatdma_chan_write64(ioat_chan, IOAT_CHAINADDR_OFFSET, desc->phys);
614#else
615 ioatdma_chan_write32(ioat_chan,
616 IOAT_CHAINADDR_OFFSET_LOW,
617 (u32) desc->phys);
618 ioatdma_chan_write32(ioat_chan, IOAT_CHAINADDR_OFFSET_HIGH, 0);
619#endif
620 ioatdma_chan_write8(ioat_chan, IOAT_CHANCMD_OFFSET, IOAT_CHANCMD_START);
621}
622
623/*
624 * Perform a IOAT transaction to verify the HW works.
625 */
626#define IOAT_TEST_SIZE 2000
627
628static int ioat_self_test(struct ioat_device *device)
629{
630 int i;
631 u8 *src;
632 u8 *dest;
633 struct dma_chan *dma_chan;
634 dma_cookie_t cookie;
635 int err = 0;
636
637 src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, SLAB_KERNEL);
638 if (!src)
639 return -ENOMEM;
640 dest = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, SLAB_KERNEL);
641 if (!dest) {
642 kfree(src);
643 return -ENOMEM;
644 }
645
646 /* Fill in src buffer */
647 for (i = 0; i < IOAT_TEST_SIZE; i++)
648 src[i] = (u8)i;
649
650 /* Start copy, using first DMA channel */
651 dma_chan = container_of(device->common.channels.next,
652 struct dma_chan,
653 device_node);
654 if (ioat_dma_alloc_chan_resources(dma_chan) < 1) {
655 err = -ENODEV;
656 goto out;
657 }
658
659 cookie = ioat_dma_memcpy_buf_to_buf(dma_chan, dest, src, IOAT_TEST_SIZE);
660 ioat_dma_memcpy_issue_pending(dma_chan);
661 msleep(1);
662
663 if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) {
664 printk(KERN_ERR "ioatdma: Self-test copy timed out, disabling\n");
665 err = -ENODEV;
666 goto free_resources;
667 }
668 if (memcmp(src, dest, IOAT_TEST_SIZE)) {
669 printk(KERN_ERR "ioatdma: Self-test copy failed compare, disabling\n");
670 err = -ENODEV;
671 goto free_resources;
672 }
673
674free_resources:
675 ioat_dma_free_chan_resources(dma_chan);
676out:
677 kfree(src);
678 kfree(dest);
679 return err;
680}
681
682static int __devinit ioat_probe(struct pci_dev *pdev,
683 const struct pci_device_id *ent)
684{
685 int err;
686 unsigned long mmio_start, mmio_len;
687 void *reg_base;
688 struct ioat_device *device;
689
690 err = pci_enable_device(pdev);
691 if (err)
692 goto err_enable_device;
693
694 err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
695 if (err)
696 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
697 if (err)
698 goto err_set_dma_mask;
699
700 err = pci_request_regions(pdev, ioat_pci_drv.name);
701 if (err)
702 goto err_request_regions;
703
704 mmio_start = pci_resource_start(pdev, 0);
705 mmio_len = pci_resource_len(pdev, 0);
706
707 reg_base = ioremap(mmio_start, mmio_len);
708 if (!reg_base) {
709 err = -ENOMEM;
710 goto err_ioremap;
711 }
712
713 device = kzalloc(sizeof(*device), GFP_KERNEL);
714 if (!device) {
715 err = -ENOMEM;
716 goto err_kzalloc;
717 }
718
719 /* DMA coherent memory pool for DMA descriptor allocations */
720 device->dma_pool = pci_pool_create("dma_desc_pool", pdev,
721 sizeof(struct ioat_dma_descriptor), 64, 0);
722 if (!device->dma_pool) {
723 err = -ENOMEM;
724 goto err_dma_pool;
725 }
726
727 device->completion_pool = pci_pool_create("completion_pool", pdev, sizeof(u64), SMP_CACHE_BYTES, SMP_CACHE_BYTES);
728 if (!device->completion_pool) {
729 err = -ENOMEM;
730 goto err_completion_pool;
731 }
732
733 device->pdev = pdev;
734 pci_set_drvdata(pdev, device);
735#ifdef CONFIG_PCI_MSI
736 if (pci_enable_msi(pdev) == 0) {
737 device->msi = 1;
738 } else {
739 device->msi = 0;
740 }
741#endif
742 err = request_irq(pdev->irq, &ioat_do_interrupt, SA_SHIRQ, "ioat",
743 device);
744 if (err)
745 goto err_irq;
746
747 device->reg_base = reg_base;
748
749 ioatdma_write8(device, IOAT_INTRCTRL_OFFSET, IOAT_INTRCTRL_MASTER_INT_EN);
750 pci_set_master(pdev);
751
752 INIT_LIST_HEAD(&device->common.channels);
753 enumerate_dma_channels(device);
754
755 device->common.device_alloc_chan_resources = ioat_dma_alloc_chan_resources;
756 device->common.device_free_chan_resources = ioat_dma_free_chan_resources;
757 device->common.device_memcpy_buf_to_buf = ioat_dma_memcpy_buf_to_buf;
758 device->common.device_memcpy_buf_to_pg = ioat_dma_memcpy_buf_to_pg;
759 device->common.device_memcpy_pg_to_pg = ioat_dma_memcpy_pg_to_pg;
760 device->common.device_memcpy_complete = ioat_dma_is_complete;
761 device->common.device_memcpy_issue_pending = ioat_dma_memcpy_issue_pending;
762 printk(KERN_INFO "Intel(R) I/OAT DMA Engine found, %d channels\n",
763 device->common.chancnt);
764
765 err = ioat_self_test(device);
766 if (err)
767 goto err_self_test;
768
769 dma_async_device_register(&device->common);
770
771 return 0;
772
773err_self_test:
774err_irq:
775 pci_pool_destroy(device->completion_pool);
776err_completion_pool:
777 pci_pool_destroy(device->dma_pool);
778err_dma_pool:
779 kfree(device);
780err_kzalloc:
781 iounmap(reg_base);
782err_ioremap:
783 pci_release_regions(pdev);
784err_request_regions:
785err_set_dma_mask:
786 pci_disable_device(pdev);
787err_enable_device:
788 return err;
789}
790
791static void __devexit ioat_remove(struct pci_dev *pdev)
792{
793 struct ioat_device *device;
794 struct dma_chan *chan, *_chan;
795 struct ioat_dma_chan *ioat_chan;
796
797 device = pci_get_drvdata(pdev);
798 dma_async_device_unregister(&device->common);
799
800 free_irq(device->pdev->irq, device);
801#ifdef CONFIG_PCI_MSI
802 if (device->msi)
803 pci_disable_msi(device->pdev);
804#endif
805 pci_pool_destroy(device->dma_pool);
806 pci_pool_destroy(device->completion_pool);
807 iounmap(device->reg_base);
808 pci_release_regions(pdev);
809 pci_disable_device(pdev);
810 list_for_each_entry_safe(chan, _chan, &device->common.channels, device_node) {
811 ioat_chan = to_ioat_chan(chan);
812 list_del(&chan->device_node);
813 kfree(ioat_chan);
814 }
815 kfree(device);
816}
817
818/* MODULE API */
819MODULE_VERSION("1.7");
820MODULE_LICENSE("GPL");
821MODULE_AUTHOR("Intel Corporation");
822
823static int __init ioat_init_module(void)
824{
825 /* it's currently unsafe to unload this module */
826 /* if forced, worst case is that rmmod hangs */
827 if (THIS_MODULE != NULL)
828 THIS_MODULE->unsafe = 1;
829
830 return pci_module_init(&ioat_pci_drv);
831}
832
833module_init(ioat_init_module);
834
835static void __exit ioat_exit_module(void)
836{
837 pci_unregister_driver(&ioat_pci_drv);
838}
839
840module_exit(ioat_exit_module);
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h
new file mode 100644
index 000000000000..a5d3b3644160
--- /dev/null
+++ b/drivers/dma/ioatdma.h
@@ -0,0 +1,125 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that 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 for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef IOATDMA_H
22#define IOATDMA_H
23
24#include <linux/dmaengine.h>
25#include "ioatdma_hw.h"
26#include <linux/init.h>
27#include <linux/dmapool.h>
28#include <linux/cache.h>
29#include <linux/pci_ids.h>
30
31#define IOAT_LOW_COMPLETION_MASK 0xffffffc0
32
33extern struct list_head dma_device_list;
34extern struct list_head dma_client_list;
35
36/**
37 * struct ioat_device - internal representation of a IOAT device
38 * @pdev: PCI-Express device
39 * @reg_base: MMIO register space base address
40 * @dma_pool: for allocating DMA descriptors
41 * @common: embedded struct dma_device
42 * @msi: Message Signaled Interrupt number
43 */
44
45struct ioat_device {
46 struct pci_dev *pdev;
47 void *reg_base;
48 struct pci_pool *dma_pool;
49 struct pci_pool *completion_pool;
50
51 struct dma_device common;
52 u8 msi;
53};
54
55/**
56 * struct ioat_dma_chan - internal representation of a DMA channel
57 * @device:
58 * @reg_base:
59 * @sw_in_use:
60 * @completion:
61 * @completion_low:
62 * @completion_high:
63 * @completed_cookie: last cookie seen completed on cleanup
64 * @cookie: value of last cookie given to client
65 * @last_completion:
66 * @xfercap:
67 * @desc_lock:
68 * @free_desc:
69 * @used_desc:
70 * @resource:
71 * @device_node:
72 */
73
74struct ioat_dma_chan {
75
76 void *reg_base;
77
78 dma_cookie_t completed_cookie;
79 unsigned long last_completion;
80
81 u32 xfercap; /* XFERCAP register value expanded out */
82
83 spinlock_t cleanup_lock;
84 spinlock_t desc_lock;
85 struct list_head free_desc;
86 struct list_head used_desc;
87
88 int pending;
89
90 struct ioat_device *device;
91 struct dma_chan common;
92
93 dma_addr_t completion_addr;
94 union {
95 u64 full; /* HW completion writeback */
96 struct {
97 u32 low;
98 u32 high;
99 };
100 } *completion_virt;
101};
102
103/* wrapper around hardware descriptor format + additional software fields */
104
105/**
106 * struct ioat_desc_sw - wrapper around hardware descriptor
107 * @hw: hardware DMA descriptor
108 * @node:
109 * @cookie:
110 * @phys:
111 */
112
113struct ioat_desc_sw {
114 struct ioat_dma_descriptor *hw;
115 struct list_head node;
116 dma_cookie_t cookie;
117 dma_addr_t phys;
118 DECLARE_PCI_UNMAP_ADDR(src)
119 DECLARE_PCI_UNMAP_LEN(src_len)
120 DECLARE_PCI_UNMAP_ADDR(dst)
121 DECLARE_PCI_UNMAP_LEN(dst_len)
122};
123
124#endif /* IOATDMA_H */
125
diff --git a/drivers/dma/ioatdma_hw.h b/drivers/dma/ioatdma_hw.h
new file mode 100644
index 000000000000..4d7a12880be3
--- /dev/null
+++ b/drivers/dma/ioatdma_hw.h
@@ -0,0 +1,52 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that 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 for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef _IOAT_HW_H_
22#define _IOAT_HW_H_
23
24/* PCI Configuration Space Values */
25#define IOAT_PCI_VID 0x8086
26#define IOAT_PCI_DID 0x1A38
27#define IOAT_PCI_RID 0x00
28#define IOAT_PCI_SVID 0x8086
29#define IOAT_PCI_SID 0x8086
30#define IOAT_VER 0x12 /* Version 1.2 */
31
32struct ioat_dma_descriptor {
33 uint32_t size;
34 uint32_t ctl;
35 uint64_t src_addr;
36 uint64_t dst_addr;
37 uint64_t next;
38 uint64_t rsv1;
39 uint64_t rsv2;
40 uint64_t user1;
41 uint64_t user2;
42};
43
44#define IOAT_DMA_DESCRIPTOR_CTL_INT_GN 0x00000001
45#define IOAT_DMA_DESCRIPTOR_CTL_SRC_SN 0x00000002
46#define IOAT_DMA_DESCRIPTOR_CTL_DST_SN 0x00000004
47#define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008
48#define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010
49#define IOAT_DMA_DESCRIPTOR_NUL 0x00000020
50#define IOAT_DMA_DESCRIPTOR_OPCODE 0xFF000000
51
52#endif
diff --git a/drivers/dma/ioatdma_io.h b/drivers/dma/ioatdma_io.h
new file mode 100644
index 000000000000..c0b4bf66c920
--- /dev/null
+++ b/drivers/dma/ioatdma_io.h
@@ -0,0 +1,118 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that 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 for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef IOATDMA_IO_H
22#define IOATDMA_IO_H
23
24#include <asm/io.h>
25
26/*
27 * device and per-channel MMIO register read and write functions
28 * this is a lot of anoying inline functions, but it's typesafe
29 */
30
31static inline u8 ioatdma_read8(struct ioat_device *device,
32 unsigned int offset)
33{
34 return readb(device->reg_base + offset);
35}
36
37static inline u16 ioatdma_read16(struct ioat_device *device,
38 unsigned int offset)
39{
40 return readw(device->reg_base + offset);
41}
42
43static inline u32 ioatdma_read32(struct ioat_device *device,
44 unsigned int offset)
45{
46 return readl(device->reg_base + offset);
47}
48
49static inline void ioatdma_write8(struct ioat_device *device,
50 unsigned int offset, u8 value)
51{
52 writeb(value, device->reg_base + offset);
53}
54
55static inline void ioatdma_write16(struct ioat_device *device,
56 unsigned int offset, u16 value)
57{
58 writew(value, device->reg_base + offset);
59}
60
61static inline void ioatdma_write32(struct ioat_device *device,
62 unsigned int offset, u32 value)
63{
64 writel(value, device->reg_base + offset);
65}
66
67static inline u8 ioatdma_chan_read8(struct ioat_dma_chan *chan,
68 unsigned int offset)
69{
70 return readb(chan->reg_base + offset);
71}
72
73static inline u16 ioatdma_chan_read16(struct ioat_dma_chan *chan,
74 unsigned int offset)
75{
76 return readw(chan->reg_base + offset);
77}
78
79static inline u32 ioatdma_chan_read32(struct ioat_dma_chan *chan,
80 unsigned int offset)
81{
82 return readl(chan->reg_base + offset);
83}
84
85static inline void ioatdma_chan_write8(struct ioat_dma_chan *chan,
86 unsigned int offset, u8 value)
87{
88 writeb(value, chan->reg_base + offset);
89}
90
91static inline void ioatdma_chan_write16(struct ioat_dma_chan *chan,
92 unsigned int offset, u16 value)
93{
94 writew(value, chan->reg_base + offset);
95}
96
97static inline void ioatdma_chan_write32(struct ioat_dma_chan *chan,
98 unsigned int offset, u32 value)
99{
100 writel(value, chan->reg_base + offset);
101}
102
103#if (BITS_PER_LONG == 64)
104static inline u64 ioatdma_chan_read64(struct ioat_dma_chan *chan,
105 unsigned int offset)
106{
107 return readq(chan->reg_base + offset);
108}
109
110static inline void ioatdma_chan_write64(struct ioat_dma_chan *chan,
111 unsigned int offset, u64 value)
112{
113 writeq(value, chan->reg_base + offset);
114}
115#endif
116
117#endif /* IOATDMA_IO_H */
118
diff --git a/drivers/dma/ioatdma_registers.h b/drivers/dma/ioatdma_registers.h
new file mode 100644
index 000000000000..41a21ab2b000
--- /dev/null
+++ b/drivers/dma/ioatdma_registers.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that 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 for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef _IOAT_REGISTERS_H_
22#define _IOAT_REGISTERS_H_
23
24
25/* MMIO Device Registers */
26#define IOAT_CHANCNT_OFFSET 0x00 /* 8-bit */
27
28#define IOAT_XFERCAP_OFFSET 0x01 /* 8-bit */
29#define IOAT_XFERCAP_4KB 12
30#define IOAT_XFERCAP_8KB 13
31#define IOAT_XFERCAP_16KB 14
32#define IOAT_XFERCAP_32KB 15
33#define IOAT_XFERCAP_32GB 0
34
35#define IOAT_GENCTRL_OFFSET 0x02 /* 8-bit */
36#define IOAT_GENCTRL_DEBUG_EN 0x01
37
38#define IOAT_INTRCTRL_OFFSET 0x03 /* 8-bit */
39#define IOAT_INTRCTRL_MASTER_INT_EN 0x01 /* Master Interrupt Enable */
40#define IOAT_INTRCTRL_INT_STATUS 0x02 /* ATTNSTATUS -or- Channel Int */
41#define IOAT_INTRCTRL_INT 0x04 /* INT_STATUS -and- MASTER_INT_EN */
42
43#define IOAT_ATTNSTATUS_OFFSET 0x04 /* Each bit is a channel */
44
45#define IOAT_VER_OFFSET 0x08 /* 8-bit */
46#define IOAT_VER_MAJOR_MASK 0xF0
47#define IOAT_VER_MINOR_MASK 0x0F
48#define GET_IOAT_VER_MAJOR(x) ((x) & IOAT_VER_MAJOR_MASK)
49#define GET_IOAT_VER_MINOR(x) ((x) & IOAT_VER_MINOR_MASK)
50
51#define IOAT_PERPORTOFFSET_OFFSET 0x0A /* 16-bit */
52
53#define IOAT_INTRDELAY_OFFSET 0x0C /* 16-bit */
54#define IOAT_INTRDELAY_INT_DELAY_MASK 0x3FFF /* Interrupt Delay Time */
55#define IOAT_INTRDELAY_COALESE_SUPPORT 0x8000 /* Interrupt Coalesing Supported */
56
57#define IOAT_DEVICE_STATUS_OFFSET 0x0E /* 16-bit */
58#define IOAT_DEVICE_STATUS_DEGRADED_MODE 0x0001
59
60
61#define IOAT_CHANNEL_MMIO_SIZE 0x80 /* Each Channel MMIO space is this size */
62
63/* DMA Channel Registers */
64#define IOAT_CHANCTRL_OFFSET 0x00 /* 16-bit Channel Control Register */
65#define IOAT_CHANCTRL_CHANNEL_PRIORITY_MASK 0xF000
66#define IOAT_CHANCTRL_CHANNEL_IN_USE 0x0100
67#define IOAT_CHANCTRL_DESCRIPTOR_ADDR_SNOOP_CONTROL 0x0020
68#define IOAT_CHANCTRL_ERR_INT_EN 0x0010
69#define IOAT_CHANCTRL_ANY_ERR_ABORT_EN 0x0008
70#define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004
71#define IOAT_CHANCTRL_INT_DISABLE 0x0001
72
73#define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatability */
74#define IOAT_DMA_COMP_V1 0x0001 /* Compatability with DMA version 1 */
75
76#define IOAT_CHANSTS_OFFSET 0x04 /* 64-bit Channel Status Register */
77#define IOAT_CHANSTS_OFFSET_LOW 0x04
78#define IOAT_CHANSTS_OFFSET_HIGH 0x08
79#define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR 0xFFFFFFFFFFFFFFC0
80#define IOAT_CHANSTS_SOFT_ERR 0x0000000000000010
81#define IOAT_CHANSTS_DMA_TRANSFER_STATUS 0x0000000000000007
82#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE 0x0
83#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_DONE 0x1
84#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_SUSPENDED 0x2
85#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED 0x3
86
87#define IOAT_CHAINADDR_OFFSET 0x0C /* 64-bit Descriptor Chain Address Register */
88#define IOAT_CHAINADDR_OFFSET_LOW 0x0C
89#define IOAT_CHAINADDR_OFFSET_HIGH 0x10
90
91#define IOAT_CHANCMD_OFFSET 0x14 /* 8-bit DMA Channel Command Register */
92#define IOAT_CHANCMD_RESET 0x20
93#define IOAT_CHANCMD_RESUME 0x10
94#define IOAT_CHANCMD_ABORT 0x08
95#define IOAT_CHANCMD_SUSPEND 0x04
96#define IOAT_CHANCMD_APPEND 0x02
97#define IOAT_CHANCMD_START 0x01
98
99#define IOAT_CHANCMP_OFFSET 0x18 /* 64-bit Channel Completion Address Register */
100#define IOAT_CHANCMP_OFFSET_LOW 0x18
101#define IOAT_CHANCMP_OFFSET_HIGH 0x1C
102
103#define IOAT_CDAR_OFFSET 0x20 /* 64-bit Current Descriptor Address Register */
104#define IOAT_CDAR_OFFSET_LOW 0x20
105#define IOAT_CDAR_OFFSET_HIGH 0x24
106
107#define IOAT_CHANERR_OFFSET 0x28 /* 32-bit Channel Error Register */
108#define IOAT_CHANERR_DMA_TRANSFER_SRC_ADDR_ERR 0x0001
109#define IOAT_CHANERR_DMA_TRANSFER_DEST_ADDR_ERR 0x0002
110#define IOAT_CHANERR_NEXT_DESCRIPTOR_ADDR_ERR 0x0004
111#define IOAT_CHANERR_NEXT_DESCRIPTOR_ALIGNMENT_ERR 0x0008
112#define IOAT_CHANERR_CHAIN_ADDR_VALUE_ERR 0x0010
113#define IOAT_CHANERR_CHANCMD_ERR 0x0020
114#define IOAT_CHANERR_CHIPSET_UNCORRECTABLE_DATA_INTEGRITY_ERR 0x0040
115#define IOAT_CHANERR_DMA_UNCORRECTABLE_DATA_INTEGRITY_ERR 0x0080
116#define IOAT_CHANERR_READ_DATA_ERR 0x0100
117#define IOAT_CHANERR_WRITE_DATA_ERR 0x0200
118#define IOAT_CHANERR_DESCRIPTOR_CONTROL_ERR 0x0400
119#define IOAT_CHANERR_DESCRIPTOR_LENGTH_ERR 0x0800
120#define IOAT_CHANERR_COMPLETION_ADDR_ERR 0x1000
121#define IOAT_CHANERR_INT_CONFIGURATION_ERR 0x2000
122#define IOAT_CHANERR_SOFT_ERR 0x4000
123
124#define IOAT_CHANERR_MASK_OFFSET 0x2C /* 32-bit Channel Error Register */
125
126#endif /* _IOAT_REGISTERS_H_ */
diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c
new file mode 100644
index 000000000000..5ed327e453a2
--- /dev/null
+++ b/drivers/dma/iovlock.c
@@ -0,0 +1,301 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 * Portions based on net/core/datagram.c and copyrighted by their authors.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59
17 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 * The full GNU General Public License is included in this distribution in the
20 * file called COPYING.
21 */
22
23/*
24 * This code allows the net stack to make use of a DMA engine for
25 * skb to iovec copies.
26 */
27
28#include <linux/dmaengine.h>
29#include <linux/pagemap.h>
30#include <net/tcp.h> /* for memcpy_toiovec */
31#include <asm/io.h>
32#include <asm/uaccess.h>
33
34int num_pages_spanned(struct iovec *iov)
35{
36 return
37 ((PAGE_ALIGN((unsigned long)iov->iov_base + iov->iov_len) -
38 ((unsigned long)iov->iov_base & PAGE_MASK)) >> PAGE_SHIFT);
39}
40
41/*
42 * Pin down all the iovec pages needed for len bytes.
43 * Return a struct dma_pinned_list to keep track of pages pinned down.
44 *
45 * We are allocating a single chunk of memory, and then carving it up into
46 * 3 sections, the latter 2 whose size depends on the number of iovecs and the
47 * total number of pages, respectively.
48 */
49struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
50{
51 struct dma_pinned_list *local_list;
52 struct page **pages;
53 int i;
54 int ret;
55 int nr_iovecs = 0;
56 int iovec_len_used = 0;
57 int iovec_pages_used = 0;
58 long err;
59
60 /* don't pin down non-user-based iovecs */
61 if (segment_eq(get_fs(), KERNEL_DS))
62 return NULL;
63
64 /* determine how many iovecs/pages there are, up front */
65 do {
66 iovec_len_used += iov[nr_iovecs].iov_len;
67 iovec_pages_used += num_pages_spanned(&iov[nr_iovecs]);
68 nr_iovecs++;
69 } while (iovec_len_used < len);
70
71 /* single kmalloc for pinned list, page_list[], and the page arrays */
72 local_list = kmalloc(sizeof(*local_list)
73 + (nr_iovecs * sizeof (struct dma_page_list))
74 + (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL);
75 if (!local_list) {
76 err = -ENOMEM;
77 goto out;
78 }
79
80 /* list of pages starts right after the page list array */
81 pages = (struct page **) &local_list->page_list[nr_iovecs];
82
83 for (i = 0; i < nr_iovecs; i++) {
84 struct dma_page_list *page_list = &local_list->page_list[i];
85
86 len -= iov[i].iov_len;
87
88 if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len)) {
89 err = -EFAULT;
90 goto unpin;
91 }
92
93 page_list->nr_pages = num_pages_spanned(&iov[i]);
94 page_list->base_address = iov[i].iov_base;
95
96 page_list->pages = pages;
97 pages += page_list->nr_pages;
98
99 /* pin pages down */
100 down_read(&current->mm->mmap_sem);
101 ret = get_user_pages(
102 current,
103 current->mm,
104 (unsigned long) iov[i].iov_base,
105 page_list->nr_pages,
106 1, /* write */
107 0, /* force */
108 page_list->pages,
109 NULL);
110 up_read(&current->mm->mmap_sem);
111
112 if (ret != page_list->nr_pages) {
113 err = -ENOMEM;
114 goto unpin;
115 }
116
117 local_list->nr_iovecs = i + 1;
118 }
119
120 return local_list;
121
122unpin:
123 dma_unpin_iovec_pages(local_list);
124out:
125 return ERR_PTR(err);
126}
127
128void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list)
129{
130 int i, j;
131
132 if (!pinned_list)
133 return;
134
135 for (i = 0; i < pinned_list->nr_iovecs; i++) {
136 struct dma_page_list *page_list = &pinned_list->page_list[i];
137 for (j = 0; j < page_list->nr_pages; j++) {
138 set_page_dirty_lock(page_list->pages[j]);
139 page_cache_release(page_list->pages[j]);
140 }
141 }
142
143 kfree(pinned_list);
144}
145
146static dma_cookie_t dma_memcpy_to_kernel_iovec(struct dma_chan *chan, struct
147 iovec *iov, unsigned char *kdata, size_t len)
148{
149 dma_cookie_t dma_cookie = 0;
150
151 while (len > 0) {
152 if (iov->iov_len) {
153 int copy = min_t(unsigned int, iov->iov_len, len);
154 dma_cookie = dma_async_memcpy_buf_to_buf(
155 chan,
156 iov->iov_base,
157 kdata,
158 copy);
159 kdata += copy;
160 len -= copy;
161 iov->iov_len -= copy;
162 iov->iov_base += copy;
163 }
164 iov++;
165 }
166
167 return dma_cookie;
168}
169
170/*
171 * We have already pinned down the pages we will be using in the iovecs.
172 * Each entry in iov array has corresponding entry in pinned_list->page_list.
173 * Using array indexing to keep iov[] and page_list[] in sync.
174 * Initial elements in iov array's iov->iov_len will be 0 if already copied into
175 * by another call.
176 * iov array length remaining guaranteed to be bigger than len.
177 */
178dma_cookie_t dma_memcpy_to_iovec(struct dma_chan *chan, struct iovec *iov,
179 struct dma_pinned_list *pinned_list, unsigned char *kdata, size_t len)
180{
181 int iov_byte_offset;
182 int copy;
183 dma_cookie_t dma_cookie = 0;
184 int iovec_idx;
185 int page_idx;
186
187 if (!chan)
188 return memcpy_toiovec(iov, kdata, len);
189
190 /* -> kernel copies (e.g. smbfs) */
191 if (!pinned_list)
192 return dma_memcpy_to_kernel_iovec(chan, iov, kdata, len);
193
194 iovec_idx = 0;
195 while (iovec_idx < pinned_list->nr_iovecs) {
196 struct dma_page_list *page_list;
197
198 /* skip already used-up iovecs */
199 while (!iov[iovec_idx].iov_len)
200 iovec_idx++;
201
202 page_list = &pinned_list->page_list[iovec_idx];
203
204 iov_byte_offset = ((unsigned long)iov[iovec_idx].iov_base & ~PAGE_MASK);
205 page_idx = (((unsigned long)iov[iovec_idx].iov_base & PAGE_MASK)
206 - ((unsigned long)page_list->base_address & PAGE_MASK)) >> PAGE_SHIFT;
207
208 /* break up copies to not cross page boundary */
209 while (iov[iovec_idx].iov_len) {
210 copy = min_t(int, PAGE_SIZE - iov_byte_offset, len);
211 copy = min_t(int, copy, iov[iovec_idx].iov_len);
212
213 dma_cookie = dma_async_memcpy_buf_to_pg(chan,
214 page_list->pages[page_idx],
215 iov_byte_offset,
216 kdata,
217 copy);
218
219 len -= copy;
220 iov[iovec_idx].iov_len -= copy;
221 iov[iovec_idx].iov_base += copy;
222
223 if (!len)
224 return dma_cookie;
225
226 kdata += copy;
227 iov_byte_offset = 0;
228 page_idx++;
229 }
230 iovec_idx++;
231 }
232
233 /* really bad if we ever run out of iovecs */
234 BUG();
235 return -EFAULT;
236}
237
238dma_cookie_t dma_memcpy_pg_to_iovec(struct dma_chan *chan, struct iovec *iov,
239 struct dma_pinned_list *pinned_list, struct page *page,
240 unsigned int offset, size_t len)
241{
242 int iov_byte_offset;
243 int copy;
244 dma_cookie_t dma_cookie = 0;
245 int iovec_idx;
246 int page_idx;
247 int err;
248
249 /* this needs as-yet-unimplemented buf-to-buff, so punt. */
250 /* TODO: use dma for this */
251 if (!chan || !pinned_list) {
252 u8 *vaddr = kmap(page);
253 err = memcpy_toiovec(iov, vaddr + offset, len);
254 kunmap(page);
255 return err;
256 }
257
258 iovec_idx = 0;
259 while (iovec_idx < pinned_list->nr_iovecs) {
260 struct dma_page_list *page_list;
261
262 /* skip already used-up iovecs */
263 while (!iov[iovec_idx].iov_len)
264 iovec_idx++;
265
266 page_list = &pinned_list->page_list[iovec_idx];
267
268 iov_byte_offset = ((unsigned long)iov[iovec_idx].iov_base & ~PAGE_MASK);
269 page_idx = (((unsigned long)iov[iovec_idx].iov_base & PAGE_MASK)
270 - ((unsigned long)page_list->base_address & PAGE_MASK)) >> PAGE_SHIFT;
271
272 /* break up copies to not cross page boundary */
273 while (iov[iovec_idx].iov_len) {
274 copy = min_t(int, PAGE_SIZE - iov_byte_offset, len);
275 copy = min_t(int, copy, iov[iovec_idx].iov_len);
276
277 dma_cookie = dma_async_memcpy_pg_to_pg(chan,
278 page_list->pages[page_idx],
279 iov_byte_offset,
280 page,
281 offset,
282 copy);
283
284 len -= copy;
285 iov[iovec_idx].iov_len -= copy;
286 iov[iovec_idx].iov_base += copy;
287
288 if (!len)
289 return dma_cookie;
290
291 offset += copy;
292 iov_byte_offset = 0;
293 page_idx++;
294 }
295 iovec_idx++;
296 }
297
298 /* really bad if we ever run out of iovecs */
299 BUG();
300 return -EFAULT;
301}
diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index afc612b8577d..ba2d6505e9a4 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -29,6 +29,11 @@ config INFINIBAND_USER_ACCESS
29 libibverbs, libibcm and a hardware driver library from 29 libibverbs, libibcm and a hardware driver library from
30 <http://www.openib.org>. 30 <http://www.openib.org>.
31 31
32config INFINIBAND_ADDR_TRANS
33 bool
34 depends on INFINIBAND && INET
35 default y
36
32source "drivers/infiniband/hw/mthca/Kconfig" 37source "drivers/infiniband/hw/mthca/Kconfig"
33source "drivers/infiniband/hw/ipath/Kconfig" 38source "drivers/infiniband/hw/ipath/Kconfig"
34 39
diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
index ec3353f24b27..68e73ec2d1f8 100644
--- a/drivers/infiniband/core/Makefile
+++ b/drivers/infiniband/core/Makefile
@@ -1,5 +1,7 @@
1infiniband-$(CONFIG_INFINIBAND_ADDR_TRANS) := ib_addr.o rdma_cm.o
2
1obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o \ 3obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o \
2 ib_cm.o 4 ib_cm.o $(infiniband-y)
3obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o 5obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o
4obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o 6obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o
5 7
@@ -12,8 +14,13 @@ ib_sa-y := sa_query.o
12 14
13ib_cm-y := cm.o 15ib_cm-y := cm.o
14 16
17rdma_cm-y := cma.o
18
19ib_addr-y := addr.o
20
15ib_umad-y := user_mad.o 21ib_umad-y := user_mad.o
16 22
17ib_ucm-y := ucm.o 23ib_ucm-y := ucm.o
18 24
19ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_mem.o 25ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_mem.o \
26 uverbs_marshall.o
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
new file mode 100644
index 000000000000..d294bbc42f09
--- /dev/null
+++ b/drivers/infiniband/core/addr.c
@@ -0,0 +1,367 @@
1/*
2 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
3 * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
4 * Copyright (c) 1999-2005, Mellanox Technologies, Inc. All rights reserved.
5 * Copyright (c) 2005 Intel Corporation. All rights reserved.
6 *
7 * This Software is licensed under one of the following licenses:
8 *
9 * 1) under the terms of the "Common Public License 1.0" a copy of which is
10 * available from the Open Source Initiative, see
11 * http://www.opensource.org/licenses/cpl.php.
12 *
13 * 2) under the terms of the "The BSD License" a copy of which is
14 * available from the Open Source Initiative, see
15 * http://www.opensource.org/licenses/bsd-license.php.
16 *
17 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
18 * copy of which is available from the Open Source Initiative, see
19 * http://www.opensource.org/licenses/gpl-license.php.
20 *
21 * Licensee has the right to choose one of the above licenses.
22 *
23 * Redistributions of source code must retain the above copyright
24 * notice and one of the license notices.
25 *
26 * Redistributions in binary form must reproduce both the above copyright
27 * notice, one of the license notices in the documentation
28 * and/or other materials provided with the distribution.
29 */
30
31#include <linux/mutex.h>
32#include <linux/inetdevice.h>
33#include <linux/workqueue.h>
34#include <linux/if_arp.h>
35#include <net/arp.h>
36#include <net/neighbour.h>
37#include <net/route.h>
38#include <rdma/ib_addr.h>
39
40MODULE_AUTHOR("Sean Hefty");
41MODULE_DESCRIPTION("IB Address Translation");
42MODULE_LICENSE("Dual BSD/GPL");
43
44struct addr_req {
45 struct list_head list;
46 struct sockaddr src_addr;
47 struct sockaddr dst_addr;
48 struct rdma_dev_addr *addr;
49 void *context;
50 void (*callback)(int status, struct sockaddr *src_addr,
51 struct rdma_dev_addr *addr, void *context);
52 unsigned long timeout;
53 int status;
54};
55
56static void process_req(void *data);
57
58static DEFINE_MUTEX(lock);
59static LIST_HEAD(req_list);
60static DECLARE_WORK(work, process_req, NULL);
61static struct workqueue_struct *addr_wq;
62
63static int copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
64 unsigned char *dst_dev_addr)
65{
66 switch (dev->type) {
67 case ARPHRD_INFINIBAND:
68 dev_addr->dev_type = IB_NODE_CA;
69 break;
70 default:
71 return -EADDRNOTAVAIL;
72 }
73
74 memcpy(dev_addr->src_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
75 memcpy(dev_addr->broadcast, dev->broadcast, MAX_ADDR_LEN);
76 if (dst_dev_addr)
77 memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN);
78 return 0;
79}
80
81int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
82{
83 struct net_device *dev;
84 u32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
85 int ret;
86
87 dev = ip_dev_find(ip);
88 if (!dev)
89 return -EADDRNOTAVAIL;
90
91 ret = copy_addr(dev_addr, dev, NULL);
92 dev_put(dev);
93 return ret;
94}
95EXPORT_SYMBOL(rdma_translate_ip);
96
97static void set_timeout(unsigned long time)
98{
99 unsigned long delay;
100
101 cancel_delayed_work(&work);
102
103 delay = time - jiffies;
104 if ((long)delay <= 0)
105 delay = 1;
106
107 queue_delayed_work(addr_wq, &work, delay);
108}
109
110static void queue_req(struct addr_req *req)
111{
112 struct addr_req *temp_req;
113
114 mutex_lock(&lock);
115 list_for_each_entry_reverse(temp_req, &req_list, list) {
116 if (time_after(req->timeout, temp_req->timeout))
117 break;
118 }
119
120 list_add(&req->list, &temp_req->list);
121
122 if (req_list.next == &req->list)
123 set_timeout(req->timeout);
124 mutex_unlock(&lock);
125}
126
127static void addr_send_arp(struct sockaddr_in *dst_in)
128{
129 struct rtable *rt;
130 struct flowi fl;
131 u32 dst_ip = dst_in->sin_addr.s_addr;
132
133 memset(&fl, 0, sizeof fl);
134 fl.nl_u.ip4_u.daddr = dst_ip;
135 if (ip_route_output_key(&rt, &fl))
136 return;
137
138 arp_send(ARPOP_REQUEST, ETH_P_ARP, rt->rt_gateway, rt->idev->dev,
139 rt->rt_src, NULL, rt->idev->dev->dev_addr, NULL);
140 ip_rt_put(rt);
141}
142
143static int addr_resolve_remote(struct sockaddr_in *src_in,
144 struct sockaddr_in *dst_in,
145 struct rdma_dev_addr *addr)
146{
147 u32 src_ip = src_in->sin_addr.s_addr;
148 u32 dst_ip = dst_in->sin_addr.s_addr;
149 struct flowi fl;
150 struct rtable *rt;
151 struct neighbour *neigh;
152 int ret;
153
154 memset(&fl, 0, sizeof fl);
155 fl.nl_u.ip4_u.daddr = dst_ip;
156 fl.nl_u.ip4_u.saddr = src_ip;
157 ret = ip_route_output_key(&rt, &fl);
158 if (ret)
159 goto out;
160
161 /* If the device does ARP internally, return 'done' */
162 if (rt->idev->dev->flags & IFF_NOARP) {
163 copy_addr(addr, rt->idev->dev, NULL);
164 goto put;
165 }
166
167 neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->idev->dev);
168 if (!neigh) {
169 ret = -ENODATA;
170 goto put;
171 }
172
173 if (!(neigh->nud_state & NUD_VALID)) {
174 ret = -ENODATA;
175 goto release;
176 }
177
178 if (!src_ip) {
179 src_in->sin_family = dst_in->sin_family;
180 src_in->sin_addr.s_addr = rt->rt_src;
181 }
182
183 ret = copy_addr(addr, neigh->dev, neigh->ha);
184release:
185 neigh_release(neigh);
186put:
187 ip_rt_put(rt);
188out:
189 return ret;
190}
191
192static void process_req(void *data)
193{
194 struct addr_req *req, *temp_req;
195 struct sockaddr_in *src_in, *dst_in;
196 struct list_head done_list;
197
198 INIT_LIST_HEAD(&done_list);
199
200 mutex_lock(&lock);
201 list_for_each_entry_safe(req, temp_req, &req_list, list) {
202 if (req->status) {
203 src_in = (struct sockaddr_in *) &req->src_addr;
204 dst_in = (struct sockaddr_in *) &req->dst_addr;
205 req->status = addr_resolve_remote(src_in, dst_in,
206 req->addr);
207 }
208 if (req->status && time_after(jiffies, req->timeout))
209 req->status = -ETIMEDOUT;
210 else if (req->status == -ENODATA)
211 continue;
212
213 list_del(&req->list);
214 list_add_tail(&req->list, &done_list);
215 }
216
217 if (!list_empty(&req_list)) {
218 req = list_entry(req_list.next, struct addr_req, list);
219 set_timeout(req->timeout);
220 }
221 mutex_unlock(&lock);
222
223 list_for_each_entry_safe(req, temp_req, &done_list, list) {
224 list_del(&req->list);
225 req->callback(req->status, &req->src_addr, req->addr,
226 req->context);
227 kfree(req);
228 }
229}
230
231static int addr_resolve_local(struct sockaddr_in *src_in,
232 struct sockaddr_in *dst_in,
233 struct rdma_dev_addr *addr)
234{
235 struct net_device *dev;
236 u32 src_ip = src_in->sin_addr.s_addr;
237 u32 dst_ip = dst_in->sin_addr.s_addr;
238 int ret;
239
240 dev = ip_dev_find(dst_ip);
241 if (!dev)
242 return -EADDRNOTAVAIL;
243
244 if (ZERONET(src_ip)) {
245 src_in->sin_family = dst_in->sin_family;
246 src_in->sin_addr.s_addr = dst_ip;
247 ret = copy_addr(addr, dev, dev->dev_addr);
248 } else if (LOOPBACK(src_ip)) {
249 ret = rdma_translate_ip((struct sockaddr *)dst_in, addr);
250 if (!ret)
251 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
252 } else {
253 ret = rdma_translate_ip((struct sockaddr *)src_in, addr);
254 if (!ret)
255 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
256 }
257
258 dev_put(dev);
259 return ret;
260}
261
262int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr,
263 struct rdma_dev_addr *addr, int timeout_ms,
264 void (*callback)(int status, struct sockaddr *src_addr,
265 struct rdma_dev_addr *addr, void *context),
266 void *context)
267{
268 struct sockaddr_in *src_in, *dst_in;
269 struct addr_req *req;
270 int ret = 0;
271
272 req = kmalloc(sizeof *req, GFP_KERNEL);
273 if (!req)
274 return -ENOMEM;
275 memset(req, 0, sizeof *req);
276
277 if (src_addr)
278 memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr));
279 memcpy(&req->dst_addr, dst_addr, ip_addr_size(dst_addr));
280 req->addr = addr;
281 req->callback = callback;
282 req->context = context;
283
284 src_in = (struct sockaddr_in *) &req->src_addr;
285 dst_in = (struct sockaddr_in *) &req->dst_addr;
286
287 req->status = addr_resolve_local(src_in, dst_in, addr);
288 if (req->status == -EADDRNOTAVAIL)
289 req->status = addr_resolve_remote(src_in, dst_in, addr);
290
291 switch (req->status) {
292 case 0:
293 req->timeout = jiffies;
294 queue_req(req);
295 break;
296 case -ENODATA:
297 req->timeout = msecs_to_jiffies(timeout_ms) + jiffies;
298 queue_req(req);
299 addr_send_arp(dst_in);
300 break;
301 default:
302 ret = req->status;
303 kfree(req);
304 break;
305 }
306 return ret;
307}
308EXPORT_SYMBOL(rdma_resolve_ip);
309
310void rdma_addr_cancel(struct rdma_dev_addr *addr)
311{
312 struct addr_req *req, *temp_req;
313
314 mutex_lock(&lock);
315 list_for_each_entry_safe(req, temp_req, &req_list, list) {
316 if (req->addr == addr) {
317 req->status = -ECANCELED;
318 req->timeout = jiffies;
319 list_del(&req->list);
320 list_add(&req->list, &req_list);
321 set_timeout(req->timeout);
322 break;
323 }
324 }
325 mutex_unlock(&lock);
326}
327EXPORT_SYMBOL(rdma_addr_cancel);
328
329static int addr_arp_recv(struct sk_buff *skb, struct net_device *dev,
330 struct packet_type *pkt, struct net_device *orig_dev)
331{
332 struct arphdr *arp_hdr;
333
334 arp_hdr = (struct arphdr *) skb->nh.raw;
335
336 if (arp_hdr->ar_op == htons(ARPOP_REQUEST) ||
337 arp_hdr->ar_op == htons(ARPOP_REPLY))
338 set_timeout(jiffies);
339
340 kfree_skb(skb);
341 return 0;
342}
343
344static struct packet_type addr_arp = {
345 .type = __constant_htons(ETH_P_ARP),
346 .func = addr_arp_recv,
347 .af_packet_priv = (void*) 1,
348};
349
350static int addr_init(void)
351{
352 addr_wq = create_singlethread_workqueue("ib_addr_wq");
353 if (!addr_wq)
354 return -ENOMEM;
355
356 dev_add_pack(&addr_arp);
357 return 0;
358}
359
360static void addr_cleanup(void)
361{
362 dev_remove_pack(&addr_arp);
363 destroy_workqueue(addr_wq);
364}
365
366module_init(addr_init);
367module_exit(addr_cleanup);
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 50364c0b090c..e05ca2cdc73f 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -191,6 +191,24 @@ int ib_find_cached_pkey(struct ib_device *device,
191} 191}
192EXPORT_SYMBOL(ib_find_cached_pkey); 192EXPORT_SYMBOL(ib_find_cached_pkey);
193 193
194int ib_get_cached_lmc(struct ib_device *device,
195 u8 port_num,
196 u8 *lmc)
197{
198 unsigned long flags;
199 int ret = 0;
200
201 if (port_num < start_port(device) || port_num > end_port(device))
202 return -EINVAL;
203
204 read_lock_irqsave(&device->cache.lock, flags);
205 *lmc = device->cache.lmc_cache[port_num - start_port(device)];
206 read_unlock_irqrestore(&device->cache.lock, flags);
207
208 return ret;
209}
210EXPORT_SYMBOL(ib_get_cached_lmc);
211
194static void ib_cache_update(struct ib_device *device, 212static void ib_cache_update(struct ib_device *device,
195 u8 port) 213 u8 port)
196{ 214{
@@ -251,6 +269,8 @@ static void ib_cache_update(struct ib_device *device,
251 device->cache.pkey_cache[port - start_port(device)] = pkey_cache; 269 device->cache.pkey_cache[port - start_port(device)] = pkey_cache;
252 device->cache.gid_cache [port - start_port(device)] = gid_cache; 270 device->cache.gid_cache [port - start_port(device)] = gid_cache;
253 271
272 device->cache.lmc_cache[port - start_port(device)] = tprops->lmc;
273
254 write_unlock_irq(&device->cache.lock); 274 write_unlock_irq(&device->cache.lock);
255 275
256 kfree(old_pkey_cache); 276 kfree(old_pkey_cache);
@@ -305,7 +325,13 @@ static void ib_cache_setup_one(struct ib_device *device)
305 kmalloc(sizeof *device->cache.gid_cache * 325 kmalloc(sizeof *device->cache.gid_cache *
306 (end_port(device) - start_port(device) + 1), GFP_KERNEL); 326 (end_port(device) - start_port(device) + 1), GFP_KERNEL);
307 327
308 if (!device->cache.pkey_cache || !device->cache.gid_cache) { 328 device->cache.lmc_cache = kmalloc(sizeof *device->cache.lmc_cache *
329 (end_port(device) -
330 start_port(device) + 1),
331 GFP_KERNEL);
332
333 if (!device->cache.pkey_cache || !device->cache.gid_cache ||
334 !device->cache.lmc_cache) {
309 printk(KERN_WARNING "Couldn't allocate cache " 335 printk(KERN_WARNING "Couldn't allocate cache "
310 "for %s\n", device->name); 336 "for %s\n", device->name);
311 goto err; 337 goto err;
@@ -333,6 +359,7 @@ err_cache:
333err: 359err:
334 kfree(device->cache.pkey_cache); 360 kfree(device->cache.pkey_cache);
335 kfree(device->cache.gid_cache); 361 kfree(device->cache.gid_cache);
362 kfree(device->cache.lmc_cache);
336} 363}
337 364
338static void ib_cache_cleanup_one(struct ib_device *device) 365static void ib_cache_cleanup_one(struct ib_device *device)
@@ -349,6 +376,7 @@ static void ib_cache_cleanup_one(struct ib_device *device)
349 376
350 kfree(device->cache.pkey_cache); 377 kfree(device->cache.pkey_cache);
351 kfree(device->cache.gid_cache); 378 kfree(device->cache.gid_cache);
379 kfree(device->cache.lmc_cache);
352} 380}
353 381
354static struct ib_client cache_client = { 382static struct ib_client cache_client = {
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 86fee43502cd..450adfe0a4f1 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -32,7 +32,7 @@
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE. 33 * SOFTWARE.
34 * 34 *
35 * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $ 35 * $Id: cm.c 4311 2005-12-05 18:42:01Z sean.hefty $
36 */ 36 */
37 37
38#include <linux/completion.h> 38#include <linux/completion.h>
@@ -132,6 +132,7 @@ struct cm_id_private {
132 /* todo: use alternate port on send failure */ 132 /* todo: use alternate port on send failure */
133 struct cm_av av; 133 struct cm_av av;
134 struct cm_av alt_av; 134 struct cm_av alt_av;
135 struct ib_cm_compare_data *compare_data;
135 136
136 void *private_data; 137 void *private_data;
137 __be64 tid; 138 __be64 tid;
@@ -253,23 +254,13 @@ static void cm_set_private_data(struct cm_id_private *cm_id_priv,
253 cm_id_priv->private_data_len = private_data_len; 254 cm_id_priv->private_data_len = private_data_len;
254} 255}
255 256
256static void cm_set_ah_attr(struct ib_ah_attr *ah_attr, u8 port_num, 257static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
257 u16 dlid, u8 sl, u16 src_path_bits) 258 struct ib_grh *grh, struct cm_av *av)
258{
259 memset(ah_attr, 0, sizeof ah_attr);
260 ah_attr->dlid = dlid;
261 ah_attr->sl = sl;
262 ah_attr->src_path_bits = src_path_bits;
263 ah_attr->port_num = port_num;
264}
265
266static void cm_init_av_for_response(struct cm_port *port,
267 struct ib_wc *wc, struct cm_av *av)
268{ 259{
269 av->port = port; 260 av->port = port;
270 av->pkey_index = wc->pkey_index; 261 av->pkey_index = wc->pkey_index;
271 cm_set_ah_attr(&av->ah_attr, port->port_num, wc->slid, 262 ib_init_ah_from_wc(port->cm_dev->device, port->port_num, wc,
272 wc->sl, wc->dlid_path_bits); 263 grh, &av->ah_attr);
273} 264}
274 265
275static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av) 266static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
@@ -299,9 +290,8 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
299 return ret; 290 return ret;
300 291
301 av->port = port; 292 av->port = port;
302 cm_set_ah_attr(&av->ah_attr, av->port->port_num, 293 ib_init_ah_from_path(cm_dev->device, port->port_num, path,
303 be16_to_cpu(path->dlid), path->sl, 294 &av->ah_attr);
304 be16_to_cpu(path->slid) & 0x7F);
305 av->packet_life_time = path->packet_life_time; 295 av->packet_life_time = path->packet_life_time;
306 return 0; 296 return 0;
307} 297}
@@ -357,6 +347,41 @@ static struct cm_id_private * cm_acquire_id(__be32 local_id, __be32 remote_id)
357 return cm_id_priv; 347 return cm_id_priv;
358} 348}
359 349
350static void cm_mask_copy(u8 *dst, u8 *src, u8 *mask)
351{
352 int i;
353
354 for (i = 0; i < IB_CM_COMPARE_SIZE / sizeof(unsigned long); i++)
355 ((unsigned long *) dst)[i] = ((unsigned long *) src)[i] &
356 ((unsigned long *) mask)[i];
357}
358
359static int cm_compare_data(struct ib_cm_compare_data *src_data,
360 struct ib_cm_compare_data *dst_data)
361{
362 u8 src[IB_CM_COMPARE_SIZE];
363 u8 dst[IB_CM_COMPARE_SIZE];
364
365 if (!src_data || !dst_data)
366 return 0;
367
368 cm_mask_copy(src, src_data->data, dst_data->mask);
369 cm_mask_copy(dst, dst_data->data, src_data->mask);
370 return memcmp(src, dst, IB_CM_COMPARE_SIZE);
371}
372
373static int cm_compare_private_data(u8 *private_data,
374 struct ib_cm_compare_data *dst_data)
375{
376 u8 src[IB_CM_COMPARE_SIZE];
377
378 if (!dst_data)
379 return 0;
380
381 cm_mask_copy(src, private_data, dst_data->mask);
382 return memcmp(src, dst_data->data, IB_CM_COMPARE_SIZE);
383}
384
360static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv) 385static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
361{ 386{
362 struct rb_node **link = &cm.listen_service_table.rb_node; 387 struct rb_node **link = &cm.listen_service_table.rb_node;
@@ -364,14 +389,18 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
364 struct cm_id_private *cur_cm_id_priv; 389 struct cm_id_private *cur_cm_id_priv;
365 __be64 service_id = cm_id_priv->id.service_id; 390 __be64 service_id = cm_id_priv->id.service_id;
366 __be64 service_mask = cm_id_priv->id.service_mask; 391 __be64 service_mask = cm_id_priv->id.service_mask;
392 int data_cmp;
367 393
368 while (*link) { 394 while (*link) {
369 parent = *link; 395 parent = *link;
370 cur_cm_id_priv = rb_entry(parent, struct cm_id_private, 396 cur_cm_id_priv = rb_entry(parent, struct cm_id_private,
371 service_node); 397 service_node);
398 data_cmp = cm_compare_data(cm_id_priv->compare_data,
399 cur_cm_id_priv->compare_data);
372 if ((cur_cm_id_priv->id.service_mask & service_id) == 400 if ((cur_cm_id_priv->id.service_mask & service_id) ==
373 (service_mask & cur_cm_id_priv->id.service_id) && 401 (service_mask & cur_cm_id_priv->id.service_id) &&
374 (cm_id_priv->id.device == cur_cm_id_priv->id.device)) 402 (cm_id_priv->id.device == cur_cm_id_priv->id.device) &&
403 !data_cmp)
375 return cur_cm_id_priv; 404 return cur_cm_id_priv;
376 405
377 if (cm_id_priv->id.device < cur_cm_id_priv->id.device) 406 if (cm_id_priv->id.device < cur_cm_id_priv->id.device)
@@ -380,6 +409,10 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
380 link = &(*link)->rb_right; 409 link = &(*link)->rb_right;
381 else if (service_id < cur_cm_id_priv->id.service_id) 410 else if (service_id < cur_cm_id_priv->id.service_id)
382 link = &(*link)->rb_left; 411 link = &(*link)->rb_left;
412 else if (service_id > cur_cm_id_priv->id.service_id)
413 link = &(*link)->rb_right;
414 else if (data_cmp < 0)
415 link = &(*link)->rb_left;
383 else 416 else
384 link = &(*link)->rb_right; 417 link = &(*link)->rb_right;
385 } 418 }
@@ -389,16 +422,20 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
389} 422}
390 423
391static struct cm_id_private * cm_find_listen(struct ib_device *device, 424static struct cm_id_private * cm_find_listen(struct ib_device *device,
392 __be64 service_id) 425 __be64 service_id,
426 u8 *private_data)
393{ 427{
394 struct rb_node *node = cm.listen_service_table.rb_node; 428 struct rb_node *node = cm.listen_service_table.rb_node;
395 struct cm_id_private *cm_id_priv; 429 struct cm_id_private *cm_id_priv;
430 int data_cmp;
396 431
397 while (node) { 432 while (node) {
398 cm_id_priv = rb_entry(node, struct cm_id_private, service_node); 433 cm_id_priv = rb_entry(node, struct cm_id_private, service_node);
434 data_cmp = cm_compare_private_data(private_data,
435 cm_id_priv->compare_data);
399 if ((cm_id_priv->id.service_mask & service_id) == 436 if ((cm_id_priv->id.service_mask & service_id) ==
400 cm_id_priv->id.service_id && 437 cm_id_priv->id.service_id &&
401 (cm_id_priv->id.device == device)) 438 (cm_id_priv->id.device == device) && !data_cmp)
402 return cm_id_priv; 439 return cm_id_priv;
403 440
404 if (device < cm_id_priv->id.device) 441 if (device < cm_id_priv->id.device)
@@ -407,6 +444,10 @@ static struct cm_id_private * cm_find_listen(struct ib_device *device,
407 node = node->rb_right; 444 node = node->rb_right;
408 else if (service_id < cm_id_priv->id.service_id) 445 else if (service_id < cm_id_priv->id.service_id)
409 node = node->rb_left; 446 node = node->rb_left;
447 else if (service_id > cm_id_priv->id.service_id)
448 node = node->rb_right;
449 else if (data_cmp < 0)
450 node = node->rb_left;
410 else 451 else
411 node = node->rb_right; 452 node = node->rb_right;
412 } 453 }
@@ -730,15 +771,14 @@ retest:
730 wait_for_completion(&cm_id_priv->comp); 771 wait_for_completion(&cm_id_priv->comp);
731 while ((work = cm_dequeue_work(cm_id_priv)) != NULL) 772 while ((work = cm_dequeue_work(cm_id_priv)) != NULL)
732 cm_free_work(work); 773 cm_free_work(work);
733 if (cm_id_priv->private_data && cm_id_priv->private_data_len) 774 kfree(cm_id_priv->compare_data);
734 kfree(cm_id_priv->private_data); 775 kfree(cm_id_priv->private_data);
735 kfree(cm_id_priv); 776 kfree(cm_id_priv);
736} 777}
737EXPORT_SYMBOL(ib_destroy_cm_id); 778EXPORT_SYMBOL(ib_destroy_cm_id);
738 779
739int ib_cm_listen(struct ib_cm_id *cm_id, 780int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id, __be64 service_mask,
740 __be64 service_id, 781 struct ib_cm_compare_data *compare_data)
741 __be64 service_mask)
742{ 782{
743 struct cm_id_private *cm_id_priv, *cur_cm_id_priv; 783 struct cm_id_private *cm_id_priv, *cur_cm_id_priv;
744 unsigned long flags; 784 unsigned long flags;
@@ -752,7 +792,19 @@ int ib_cm_listen(struct ib_cm_id *cm_id,
752 return -EINVAL; 792 return -EINVAL;
753 793
754 cm_id_priv = container_of(cm_id, struct cm_id_private, id); 794 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
755 BUG_ON(cm_id->state != IB_CM_IDLE); 795 if (cm_id->state != IB_CM_IDLE)
796 return -EINVAL;
797
798 if (compare_data) {
799 cm_id_priv->compare_data = kzalloc(sizeof *compare_data,
800 GFP_KERNEL);
801 if (!cm_id_priv->compare_data)
802 return -ENOMEM;
803 cm_mask_copy(cm_id_priv->compare_data->data,
804 compare_data->data, compare_data->mask);
805 memcpy(cm_id_priv->compare_data->mask, compare_data->mask,
806 IB_CM_COMPARE_SIZE);
807 }
756 808
757 cm_id->state = IB_CM_LISTEN; 809 cm_id->state = IB_CM_LISTEN;
758 810
@@ -769,6 +821,8 @@ int ib_cm_listen(struct ib_cm_id *cm_id,
769 821
770 if (cur_cm_id_priv) { 822 if (cur_cm_id_priv) {
771 cm_id->state = IB_CM_IDLE; 823 cm_id->state = IB_CM_IDLE;
824 kfree(cm_id_priv->compare_data);
825 cm_id_priv->compare_data = NULL;
772 ret = -EBUSY; 826 ret = -EBUSY;
773 } 827 }
774 return ret; 828 return ret;
@@ -1241,7 +1295,8 @@ static struct cm_id_private * cm_match_req(struct cm_work *work,
1241 1295
1242 /* Find matching listen request. */ 1296 /* Find matching listen request. */
1243 listen_cm_id_priv = cm_find_listen(cm_id_priv->id.device, 1297 listen_cm_id_priv = cm_find_listen(cm_id_priv->id.device,
1244 req_msg->service_id); 1298 req_msg->service_id,
1299 req_msg->private_data);
1245 if (!listen_cm_id_priv) { 1300 if (!listen_cm_id_priv) {
1246 spin_unlock_irqrestore(&cm.lock, flags); 1301 spin_unlock_irqrestore(&cm.lock, flags);
1247 cm_issue_rej(work->port, work->mad_recv_wc, 1302 cm_issue_rej(work->port, work->mad_recv_wc,
@@ -1276,6 +1331,7 @@ static int cm_req_handler(struct cm_work *work)
1276 cm_id_priv = container_of(cm_id, struct cm_id_private, id); 1331 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1277 cm_id_priv->id.remote_id = req_msg->local_comm_id; 1332 cm_id_priv->id.remote_id = req_msg->local_comm_id;
1278 cm_init_av_for_response(work->port, work->mad_recv_wc->wc, 1333 cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
1334 work->mad_recv_wc->recv_buf.grh,
1279 &cm_id_priv->av); 1335 &cm_id_priv->av);
1280 cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> 1336 cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
1281 id.local_id); 1337 id.local_id);
@@ -2549,7 +2605,7 @@ static void cm_format_sidr_req(struct cm_sidr_req_msg *sidr_req_msg,
2549 cm_format_mad_hdr(&sidr_req_msg->hdr, CM_SIDR_REQ_ATTR_ID, 2605 cm_format_mad_hdr(&sidr_req_msg->hdr, CM_SIDR_REQ_ATTR_ID,
2550 cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_SIDR)); 2606 cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_SIDR));
2551 sidr_req_msg->request_id = cm_id_priv->id.local_id; 2607 sidr_req_msg->request_id = cm_id_priv->id.local_id;
2552 sidr_req_msg->pkey = cpu_to_be16(param->pkey); 2608 sidr_req_msg->pkey = cpu_to_be16(param->path->pkey);
2553 sidr_req_msg->service_id = param->service_id; 2609 sidr_req_msg->service_id = param->service_id;
2554 2610
2555 if (param->private_data && param->private_data_len) 2611 if (param->private_data && param->private_data_len)
@@ -2641,6 +2697,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
2641 cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid); 2697 cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid);
2642 cm_id_priv->av.dgid.global.interface_id = 0; 2698 cm_id_priv->av.dgid.global.interface_id = 0;
2643 cm_init_av_for_response(work->port, work->mad_recv_wc->wc, 2699 cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
2700 work->mad_recv_wc->recv_buf.grh,
2644 &cm_id_priv->av); 2701 &cm_id_priv->av);
2645 cm_id_priv->id.remote_id = sidr_req_msg->request_id; 2702 cm_id_priv->id.remote_id = sidr_req_msg->request_id;
2646 cm_id_priv->id.state = IB_CM_SIDR_REQ_RCVD; 2703 cm_id_priv->id.state = IB_CM_SIDR_REQ_RCVD;
@@ -2654,7 +2711,8 @@ static int cm_sidr_req_handler(struct cm_work *work)
2654 goto out; /* Duplicate message. */ 2711 goto out; /* Duplicate message. */
2655 } 2712 }
2656 cur_cm_id_priv = cm_find_listen(cm_id->device, 2713 cur_cm_id_priv = cm_find_listen(cm_id->device,
2657 sidr_req_msg->service_id); 2714 sidr_req_msg->service_id,
2715 sidr_req_msg->private_data);
2658 if (!cur_cm_id_priv) { 2716 if (!cur_cm_id_priv) {
2659 rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table); 2717 rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
2660 spin_unlock_irqrestore(&cm.lock, flags); 2718 spin_unlock_irqrestore(&cm.lock, flags);
@@ -3291,7 +3349,6 @@ error:
3291 3349
3292static void __exit ib_cm_cleanup(void) 3350static void __exit ib_cm_cleanup(void)
3293{ 3351{
3294 flush_workqueue(cm.wq);
3295 destroy_workqueue(cm.wq); 3352 destroy_workqueue(cm.wq);
3296 ib_unregister_client(&cm_client); 3353 ib_unregister_client(&cm_client);
3297 idr_destroy(&cm.local_id_table); 3354 idr_destroy(&cm.local_id_table);
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
new file mode 100644
index 000000000000..a76834edf608
--- /dev/null
+++ b/drivers/infiniband/core/cma.c
@@ -0,0 +1,1927 @@
1/*
2 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
3 * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
4 * Copyright (c) 1999-2005, Mellanox Technologies, Inc. All rights reserved.
5 * Copyright (c) 2005-2006 Intel Corporation. All rights reserved.
6 *
7 * This Software is licensed under one of the following licenses:
8 *
9 * 1) under the terms of the "Common Public License 1.0" a copy of which is
10 * available from the Open Source Initiative, see
11 * http://www.opensource.org/licenses/cpl.php.
12 *
13 * 2) under the terms of the "The BSD License" a copy of which is
14 * available from the Open Source Initiative, see
15 * http://www.opensource.org/licenses/bsd-license.php.
16 *
17 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
18 * copy of which is available from the Open Source Initiative, see
19 * http://www.opensource.org/licenses/gpl-license.php.
20 *
21 * Licensee has the right to choose one of the above licenses.
22 *
23 * Redistributions of source code must retain the above copyright
24 * notice and one of the license notices.
25 *
26 * Redistributions in binary form must reproduce both the above copyright
27 * notice, one of the license notices in the documentation
28 * and/or other materials provided with the distribution.
29 *
30 */
31
32#include <linux/completion.h>
33#include <linux/in.h>
34#include <linux/in6.h>
35#include <linux/mutex.h>
36#include <linux/random.h>
37#include <linux/idr.h>
38
39#include <net/tcp.h>
40
41#include <rdma/rdma_cm.h>
42#include <rdma/rdma_cm_ib.h>
43#include <rdma/ib_cache.h>
44#include <rdma/ib_cm.h>
45#include <rdma/ib_sa.h>
46
47MODULE_AUTHOR("Sean Hefty");
48MODULE_DESCRIPTION("Generic RDMA CM Agent");
49MODULE_LICENSE("Dual BSD/GPL");
50
51#define CMA_CM_RESPONSE_TIMEOUT 20
52#define CMA_MAX_CM_RETRIES 3
53
54static void cma_add_one(struct ib_device *device);
55static void cma_remove_one(struct ib_device *device);
56
57static struct ib_client cma_client = {
58 .name = "cma",
59 .add = cma_add_one,
60 .remove = cma_remove_one
61};
62
63static LIST_HEAD(dev_list);
64static LIST_HEAD(listen_any_list);
65static DEFINE_MUTEX(lock);
66static struct workqueue_struct *cma_wq;
67static DEFINE_IDR(sdp_ps);
68static DEFINE_IDR(tcp_ps);
69
70struct cma_device {
71 struct list_head list;
72 struct ib_device *device;
73 __be64 node_guid;
74 struct completion comp;
75 atomic_t refcount;
76 struct list_head id_list;
77};
78
79enum cma_state {
80 CMA_IDLE,
81 CMA_ADDR_QUERY,
82 CMA_ADDR_RESOLVED,
83 CMA_ROUTE_QUERY,
84 CMA_ROUTE_RESOLVED,
85 CMA_CONNECT,
86 CMA_DISCONNECT,
87 CMA_ADDR_BOUND,
88 CMA_LISTEN,
89 CMA_DEVICE_REMOVAL,
90 CMA_DESTROYING
91};
92
93struct rdma_bind_list {
94 struct idr *ps;
95 struct hlist_head owners;
96 unsigned short port;
97};
98
99/*
100 * Device removal can occur at anytime, so we need extra handling to
101 * serialize notifying the user of device removal with other callbacks.
102 * We do this by disabling removal notification while a callback is in process,
103 * and reporting it after the callback completes.
104 */
105struct rdma_id_private {
106 struct rdma_cm_id id;
107
108 struct rdma_bind_list *bind_list;
109 struct hlist_node node;
110 struct list_head list;
111 struct list_head listen_list;
112 struct cma_device *cma_dev;
113
114 enum cma_state state;
115 spinlock_t lock;
116 struct completion comp;
117 atomic_t refcount;
118 wait_queue_head_t wait_remove;
119 atomic_t dev_remove;
120
121 int backlog;
122 int timeout_ms;
123 struct ib_sa_query *query;
124 int query_id;
125 union {
126 struct ib_cm_id *ib;
127 } cm_id;
128
129 u32 seq_num;
130 u32 qp_num;
131 enum ib_qp_type qp_type;
132 u8 srq;
133};
134
135struct cma_work {
136 struct work_struct work;
137 struct rdma_id_private *id;
138 enum cma_state old_state;
139 enum cma_state new_state;
140 struct rdma_cm_event event;
141};
142
143union cma_ip_addr {
144 struct in6_addr ip6;
145 struct {
146 __u32 pad[3];
147 __u32 addr;
148 } ip4;
149};
150
151struct cma_hdr {
152 u8 cma_version;
153 u8 ip_version; /* IP version: 7:4 */
154 __u16 port;
155 union cma_ip_addr src_addr;
156 union cma_ip_addr dst_addr;
157};
158
159struct sdp_hh {
160 u8 bsdh[16];
161 u8 sdp_version; /* Major version: 7:4 */
162 u8 ip_version; /* IP version: 7:4 */
163 u8 sdp_specific1[10];
164 __u16 port;
165 __u16 sdp_specific2;
166 union cma_ip_addr src_addr;
167 union cma_ip_addr dst_addr;
168};
169
170struct sdp_hah {
171 u8 bsdh[16];
172 u8 sdp_version;
173};
174
175#define CMA_VERSION 0x00
176#define SDP_MAJ_VERSION 0x2
177
178static int cma_comp(struct rdma_id_private *id_priv, enum cma_state comp)
179{
180 unsigned long flags;
181 int ret;
182
183 spin_lock_irqsave(&id_priv->lock, flags);
184 ret = (id_priv->state == comp);
185 spin_unlock_irqrestore(&id_priv->lock, flags);
186 return ret;
187}
188
189static int cma_comp_exch(struct rdma_id_private *id_priv,
190 enum cma_state comp, enum cma_state exch)
191{
192 unsigned long flags;
193 int ret;
194
195 spin_lock_irqsave(&id_priv->lock, flags);
196 if ((ret = (id_priv->state == comp)))
197 id_priv->state = exch;
198 spin_unlock_irqrestore(&id_priv->lock, flags);
199 return ret;
200}
201
202static enum cma_state cma_exch(struct rdma_id_private *id_priv,
203 enum cma_state exch)
204{
205 unsigned long flags;
206 enum cma_state old;
207
208 spin_lock_irqsave(&id_priv->lock, flags);
209 old = id_priv->state;
210 id_priv->state = exch;
211 spin_unlock_irqrestore(&id_priv->lock, flags);
212 return old;
213}
214
215static inline u8 cma_get_ip_ver(struct cma_hdr *hdr)
216{
217 return hdr->ip_version >> 4;
218}
219
220static inline void cma_set_ip_ver(struct cma_hdr *hdr, u8 ip_ver)
221{
222 hdr->ip_version = (ip_ver << 4) | (hdr->ip_version & 0xF);
223}
224
225static inline u8 sdp_get_majv(u8 sdp_version)
226{
227 return sdp_version >> 4;
228}
229
230static inline u8 sdp_get_ip_ver(struct sdp_hh *hh)
231{
232 return hh->ip_version >> 4;
233}
234
235static inline void sdp_set_ip_ver(struct sdp_hh *hh, u8 ip_ver)
236{
237 hh->ip_version = (ip_ver << 4) | (hh->ip_version & 0xF);
238}
239
240static void cma_attach_to_dev(struct rdma_id_private *id_priv,
241 struct cma_device *cma_dev)
242{
243 atomic_inc(&cma_dev->refcount);
244 id_priv->cma_dev = cma_dev;
245 id_priv->id.device = cma_dev->device;
246 list_add_tail(&id_priv->list, &cma_dev->id_list);
247}
248
249static inline void cma_deref_dev(struct cma_device *cma_dev)
250{
251 if (atomic_dec_and_test(&cma_dev->refcount))
252 complete(&cma_dev->comp);
253}
254
255static void cma_detach_from_dev(struct rdma_id_private *id_priv)
256{
257 list_del(&id_priv->list);
258 cma_deref_dev(id_priv->cma_dev);
259 id_priv->cma_dev = NULL;
260}
261
262static int cma_acquire_ib_dev(struct rdma_id_private *id_priv)
263{
264 struct cma_device *cma_dev;
265 union ib_gid *gid;
266 int ret = -ENODEV;
267
268 gid = ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr);
269
270 mutex_lock(&lock);
271 list_for_each_entry(cma_dev, &dev_list, list) {
272 ret = ib_find_cached_gid(cma_dev->device, gid,
273 &id_priv->id.port_num, NULL);
274 if (!ret) {
275 cma_attach_to_dev(id_priv, cma_dev);
276 break;
277 }
278 }
279 mutex_unlock(&lock);
280 return ret;
281}
282
283static int cma_acquire_dev(struct rdma_id_private *id_priv)
284{
285 switch (id_priv->id.route.addr.dev_addr.dev_type) {
286 case IB_NODE_CA:
287 return cma_acquire_ib_dev(id_priv);
288 default:
289 return -ENODEV;
290 }
291}
292
293static void cma_deref_id(struct rdma_id_private *id_priv)
294{
295 if (atomic_dec_and_test(&id_priv->refcount))
296 complete(&id_priv->comp);
297}
298
299static void cma_release_remove(struct rdma_id_private *id_priv)
300{
301 if (atomic_dec_and_test(&id_priv->dev_remove))
302 wake_up(&id_priv->wait_remove);
303}
304
305struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
306 void *context, enum rdma_port_space ps)
307{
308 struct rdma_id_private *id_priv;
309
310 id_priv = kzalloc(sizeof *id_priv, GFP_KERNEL);
311 if (!id_priv)
312 return ERR_PTR(-ENOMEM);
313
314 id_priv->state = CMA_IDLE;
315 id_priv->id.context = context;
316 id_priv->id.event_handler = event_handler;
317 id_priv->id.ps = ps;
318 spin_lock_init(&id_priv->lock);
319 init_completion(&id_priv->comp);
320 atomic_set(&id_priv->refcount, 1);
321 init_waitqueue_head(&id_priv->wait_remove);
322 atomic_set(&id_priv->dev_remove, 0);
323 INIT_LIST_HEAD(&id_priv->listen_list);
324 get_random_bytes(&id_priv->seq_num, sizeof id_priv->seq_num);
325
326 return &id_priv->id;
327}
328EXPORT_SYMBOL(rdma_create_id);
329
330static int cma_init_ib_qp(struct rdma_id_private *id_priv, struct ib_qp *qp)
331{
332 struct ib_qp_attr qp_attr;
333 struct rdma_dev_addr *dev_addr;
334 int ret;
335
336 dev_addr = &id_priv->id.route.addr.dev_addr;
337 ret = ib_find_cached_pkey(id_priv->id.device, id_priv->id.port_num,
338 ib_addr_get_pkey(dev_addr),
339 &qp_attr.pkey_index);
340 if (ret)
341 return ret;
342
343 qp_attr.qp_state = IB_QPS_INIT;
344 qp_attr.qp_access_flags = IB_ACCESS_LOCAL_WRITE;
345 qp_attr.port_num = id_priv->id.port_num;
346 return ib_modify_qp(qp, &qp_attr, IB_QP_STATE | IB_QP_ACCESS_FLAGS |
347 IB_QP_PKEY_INDEX | IB_QP_PORT);
348}
349
350int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
351 struct ib_qp_init_attr *qp_init_attr)
352{
353 struct rdma_id_private *id_priv;
354 struct ib_qp *qp;
355 int ret;
356
357 id_priv = container_of(id, struct rdma_id_private, id);
358 if (id->device != pd->device)
359 return -EINVAL;
360
361 qp = ib_create_qp(pd, qp_init_attr);
362 if (IS_ERR(qp))
363 return PTR_ERR(qp);
364
365 switch (id->device->node_type) {
366 case IB_NODE_CA:
367 ret = cma_init_ib_qp(id_priv, qp);
368 break;
369 default:
370 ret = -ENOSYS;
371 break;
372 }
373
374 if (ret)
375 goto err;
376
377 id->qp = qp;
378 id_priv->qp_num = qp->qp_num;
379 id_priv->qp_type = qp->qp_type;
380 id_priv->srq = (qp->srq != NULL);
381 return 0;
382err:
383 ib_destroy_qp(qp);
384 return ret;
385}
386EXPORT_SYMBOL(rdma_create_qp);
387
388void rdma_destroy_qp(struct rdma_cm_id *id)
389{
390 ib_destroy_qp(id->qp);
391}
392EXPORT_SYMBOL(rdma_destroy_qp);
393
394static int cma_modify_qp_rtr(struct rdma_cm_id *id)
395{
396 struct ib_qp_attr qp_attr;
397 int qp_attr_mask, ret;
398
399 if (!id->qp)
400 return 0;
401
402 /* Need to update QP attributes from default values. */
403 qp_attr.qp_state = IB_QPS_INIT;
404 ret = rdma_init_qp_attr(id, &qp_attr, &qp_attr_mask);
405 if (ret)
406 return ret;
407
408 ret = ib_modify_qp(id->qp, &qp_attr, qp_attr_mask);
409 if (ret)
410 return ret;
411
412 qp_attr.qp_state = IB_QPS_RTR;
413 ret = rdma_init_qp_attr(id, &qp_attr, &qp_attr_mask);
414 if (ret)
415 return ret;
416
417 return ib_modify_qp(id->qp, &qp_attr, qp_attr_mask);
418}
419
420static int cma_modify_qp_rts(struct rdma_cm_id *id)
421{
422 struct ib_qp_attr qp_attr;
423 int qp_attr_mask, ret;
424
425 if (!id->qp)
426 return 0;
427
428 qp_attr.qp_state = IB_QPS_RTS;
429 ret = rdma_init_qp_attr(id, &qp_attr, &qp_attr_mask);
430 if (ret)
431 return ret;
432
433 return ib_modify_qp(id->qp, &qp_attr, qp_attr_mask);
434}
435
436static int cma_modify_qp_err(struct rdma_cm_id *id)
437{
438 struct ib_qp_attr qp_attr;
439
440 if (!id->qp)
441 return 0;
442
443 qp_attr.qp_state = IB_QPS_ERR;
444 return ib_modify_qp(id->qp, &qp_attr, IB_QP_STATE);
445}
446
447int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
448 int *qp_attr_mask)
449{
450 struct rdma_id_private *id_priv;
451 int ret;
452
453 id_priv = container_of(id, struct rdma_id_private, id);
454 switch (id_priv->id.device->node_type) {
455 case IB_NODE_CA:
456 ret = ib_cm_init_qp_attr(id_priv->cm_id.ib, qp_attr,
457 qp_attr_mask);
458 if (qp_attr->qp_state == IB_QPS_RTR)
459 qp_attr->rq_psn = id_priv->seq_num;
460 break;
461 default:
462 ret = -ENOSYS;
463 break;
464 }
465
466 return ret;
467}
468EXPORT_SYMBOL(rdma_init_qp_attr);
469
470static inline int cma_zero_addr(struct sockaddr *addr)
471{
472 struct in6_addr *ip6;
473
474 if (addr->sa_family == AF_INET)
475 return ZERONET(((struct sockaddr_in *) addr)->sin_addr.s_addr);
476 else {
477 ip6 = &((struct sockaddr_in6 *) addr)->sin6_addr;
478 return (ip6->s6_addr32[0] | ip6->s6_addr32[1] |
479 ip6->s6_addr32[3] | ip6->s6_addr32[4]) == 0;
480 }
481}
482
483static inline int cma_loopback_addr(struct sockaddr *addr)
484{
485 return LOOPBACK(((struct sockaddr_in *) addr)->sin_addr.s_addr);
486}
487
488static inline int cma_any_addr(struct sockaddr *addr)
489{
490 return cma_zero_addr(addr) || cma_loopback_addr(addr);
491}
492
493static inline int cma_any_port(struct sockaddr *addr)
494{
495 return !((struct sockaddr_in *) addr)->sin_port;
496}
497
498static int cma_get_net_info(void *hdr, enum rdma_port_space ps,
499 u8 *ip_ver, __u16 *port,
500 union cma_ip_addr **src, union cma_ip_addr **dst)
501{
502 switch (ps) {
503 case RDMA_PS_SDP:
504 if (sdp_get_majv(((struct sdp_hh *) hdr)->sdp_version) !=
505 SDP_MAJ_VERSION)
506 return -EINVAL;
507
508 *ip_ver = sdp_get_ip_ver(hdr);
509 *port = ((struct sdp_hh *) hdr)->port;
510 *src = &((struct sdp_hh *) hdr)->src_addr;
511 *dst = &((struct sdp_hh *) hdr)->dst_addr;
512 break;
513 default:
514 if (((struct cma_hdr *) hdr)->cma_version != CMA_VERSION)
515 return -EINVAL;
516
517 *ip_ver = cma_get_ip_ver(hdr);
518 *port = ((struct cma_hdr *) hdr)->port;
519 *src = &((struct cma_hdr *) hdr)->src_addr;
520 *dst = &((struct cma_hdr *) hdr)->dst_addr;
521 break;
522 }
523
524 if (*ip_ver != 4 && *ip_ver != 6)
525 return -EINVAL;
526 return 0;
527}
528
529static void cma_save_net_info(struct rdma_addr *addr,
530 struct rdma_addr *listen_addr,
531 u8 ip_ver, __u16 port,
532 union cma_ip_addr *src, union cma_ip_addr *dst)
533{
534 struct sockaddr_in *listen4, *ip4;
535 struct sockaddr_in6 *listen6, *ip6;
536
537 switch (ip_ver) {
538 case 4:
539 listen4 = (struct sockaddr_in *) &listen_addr->src_addr;
540 ip4 = (struct sockaddr_in *) &addr->src_addr;
541 ip4->sin_family = listen4->sin_family;
542 ip4->sin_addr.s_addr = dst->ip4.addr;
543 ip4->sin_port = listen4->sin_port;
544
545 ip4 = (struct sockaddr_in *) &addr->dst_addr;
546 ip4->sin_family = listen4->sin_family;
547 ip4->sin_addr.s_addr = src->ip4.addr;
548 ip4->sin_port = port;
549 break;
550 case 6:
551 listen6 = (struct sockaddr_in6 *) &listen_addr->src_addr;
552 ip6 = (struct sockaddr_in6 *) &addr->src_addr;
553 ip6->sin6_family = listen6->sin6_family;
554 ip6->sin6_addr = dst->ip6;
555 ip6->sin6_port = listen6->sin6_port;
556
557 ip6 = (struct sockaddr_in6 *) &addr->dst_addr;
558 ip6->sin6_family = listen6->sin6_family;
559 ip6->sin6_addr = src->ip6;
560 ip6->sin6_port = port;
561 break;
562 default:
563 break;
564 }
565}
566
567static inline int cma_user_data_offset(enum rdma_port_space ps)
568{
569 switch (ps) {
570 case RDMA_PS_SDP:
571 return 0;
572 default:
573 return sizeof(struct cma_hdr);
574 }
575}
576
577static int cma_notify_user(struct rdma_id_private *id_priv,
578 enum rdma_cm_event_type type, int status,
579 void *data, u8 data_len)
580{
581 struct rdma_cm_event event;
582
583 event.event = type;
584 event.status = status;
585 event.private_data = data;
586 event.private_data_len = data_len;
587
588 return id_priv->id.event_handler(&id_priv->id, &event);
589}
590
591static void cma_cancel_route(struct rdma_id_private *id_priv)
592{
593 switch (id_priv->id.device->node_type) {
594 case IB_NODE_CA:
595 if (id_priv->query)
596 ib_sa_cancel_query(id_priv->query_id, id_priv->query);
597 break;
598 default:
599 break;
600 }
601}
602
603static inline int cma_internal_listen(struct rdma_id_private *id_priv)
604{
605 return (id_priv->state == CMA_LISTEN) && id_priv->cma_dev &&
606 cma_any_addr(&id_priv->id.route.addr.src_addr);
607}
608
609static void cma_destroy_listen(struct rdma_id_private *id_priv)
610{
611 cma_exch(id_priv, CMA_DESTROYING);
612
613 if (id_priv->cma_dev) {
614 switch (id_priv->id.device->node_type) {
615 case IB_NODE_CA:
616 if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib))
617 ib_destroy_cm_id(id_priv->cm_id.ib);
618 break;
619 default:
620 break;
621 }
622 cma_detach_from_dev(id_priv);
623 }
624 list_del(&id_priv->listen_list);
625
626 cma_deref_id(id_priv);
627 wait_for_completion(&id_priv->comp);
628
629 kfree(id_priv);
630}
631
632static void cma_cancel_listens(struct rdma_id_private *id_priv)
633{
634 struct rdma_id_private *dev_id_priv;
635
636 mutex_lock(&lock);
637 list_del(&id_priv->list);
638
639 while (!list_empty(&id_priv->listen_list)) {
640 dev_id_priv = list_entry(id_priv->listen_list.next,
641 struct rdma_id_private, listen_list);
642 cma_destroy_listen(dev_id_priv);
643 }
644 mutex_unlock(&lock);
645}
646
647static void cma_cancel_operation(struct rdma_id_private *id_priv,
648 enum cma_state state)
649{
650 switch (state) {
651 case CMA_ADDR_QUERY:
652 rdma_addr_cancel(&id_priv->id.route.addr.dev_addr);
653 break;
654 case CMA_ROUTE_QUERY:
655 cma_cancel_route(id_priv);
656 break;
657 case CMA_LISTEN:
658 if (cma_any_addr(&id_priv->id.route.addr.src_addr) &&
659 !id_priv->cma_dev)
660 cma_cancel_listens(id_priv);
661 break;
662 default:
663 break;
664 }
665}
666
667static void cma_release_port(struct rdma_id_private *id_priv)
668{
669 struct rdma_bind_list *bind_list = id_priv->bind_list;
670
671 if (!bind_list)
672 return;
673
674 mutex_lock(&lock);
675 hlist_del(&id_priv->node);
676 if (hlist_empty(&bind_list->owners)) {
677 idr_remove(bind_list->ps, bind_list->port);
678 kfree(bind_list);
679 }
680 mutex_unlock(&lock);
681}
682
683void rdma_destroy_id(struct rdma_cm_id *id)
684{
685 struct rdma_id_private *id_priv;
686 enum cma_state state;
687
688 id_priv = container_of(id, struct rdma_id_private, id);
689 state = cma_exch(id_priv, CMA_DESTROYING);
690 cma_cancel_operation(id_priv, state);
691
692 if (id_priv->cma_dev) {
693 switch (id->device->node_type) {
694 case IB_NODE_CA:
695 if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib))
696 ib_destroy_cm_id(id_priv->cm_id.ib);
697 break;
698 default:
699 break;
700 }
701 mutex_lock(&lock);
702 cma_detach_from_dev(id_priv);
703 mutex_unlock(&lock);
704 }
705
706 cma_release_port(id_priv);
707 cma_deref_id(id_priv);
708 wait_for_completion(&id_priv->comp);
709
710 kfree(id_priv->id.route.path_rec);
711 kfree(id_priv);
712}
713EXPORT_SYMBOL(rdma_destroy_id);
714
715static int cma_rep_recv(struct rdma_id_private *id_priv)
716{
717 int ret;
718
719 ret = cma_modify_qp_rtr(&id_priv->id);
720 if (ret)
721 goto reject;
722
723 ret = cma_modify_qp_rts(&id_priv->id);
724 if (ret)
725 goto reject;
726
727 ret = ib_send_cm_rtu(id_priv->cm_id.ib, NULL, 0);
728 if (ret)
729 goto reject;
730
731 return 0;
732reject:
733 cma_modify_qp_err(&id_priv->id);
734 ib_send_cm_rej(id_priv->cm_id.ib, IB_CM_REJ_CONSUMER_DEFINED,
735 NULL, 0, NULL, 0);
736 return ret;
737}
738
739static int cma_verify_rep(struct rdma_id_private *id_priv, void *data)
740{
741 if (id_priv->id.ps == RDMA_PS_SDP &&
742 sdp_get_majv(((struct sdp_hah *) data)->sdp_version) !=
743 SDP_MAJ_VERSION)
744 return -EINVAL;
745
746 return 0;
747}
748
749static int cma_rtu_recv(struct rdma_id_private *id_priv)
750{
751 int ret;
752
753 ret = cma_modify_qp_rts(&id_priv->id);
754 if (ret)
755 goto reject;
756
757 return 0;
758reject:
759 cma_modify_qp_err(&id_priv->id);
760 ib_send_cm_rej(id_priv->cm_id.ib, IB_CM_REJ_CONSUMER_DEFINED,
761 NULL, 0, NULL, 0);
762 return ret;
763}
764
765static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
766{
767 struct rdma_id_private *id_priv = cm_id->context;
768 enum rdma_cm_event_type event;
769 u8 private_data_len = 0;
770 int ret = 0, status = 0;
771
772 atomic_inc(&id_priv->dev_remove);
773 if (!cma_comp(id_priv, CMA_CONNECT))
774 goto out;
775
776 switch (ib_event->event) {
777 case IB_CM_REQ_ERROR:
778 case IB_CM_REP_ERROR:
779 event = RDMA_CM_EVENT_UNREACHABLE;
780 status = -ETIMEDOUT;
781 break;
782 case IB_CM_REP_RECEIVED:
783 status = cma_verify_rep(id_priv, ib_event->private_data);
784 if (status)
785 event = RDMA_CM_EVENT_CONNECT_ERROR;
786 else if (id_priv->id.qp && id_priv->id.ps != RDMA_PS_SDP) {
787 status = cma_rep_recv(id_priv);
788 event = status ? RDMA_CM_EVENT_CONNECT_ERROR :
789 RDMA_CM_EVENT_ESTABLISHED;
790 } else
791 event = RDMA_CM_EVENT_CONNECT_RESPONSE;
792 private_data_len = IB_CM_REP_PRIVATE_DATA_SIZE;
793 break;
794 case IB_CM_RTU_RECEIVED:
795 status = cma_rtu_recv(id_priv);
796 event = status ? RDMA_CM_EVENT_CONNECT_ERROR :
797 RDMA_CM_EVENT_ESTABLISHED;
798 break;
799 case IB_CM_DREQ_ERROR:
800 status = -ETIMEDOUT; /* fall through */
801 case IB_CM_DREQ_RECEIVED:
802 case IB_CM_DREP_RECEIVED:
803 if (!cma_comp_exch(id_priv, CMA_CONNECT, CMA_DISCONNECT))
804 goto out;
805 event = RDMA_CM_EVENT_DISCONNECTED;
806 break;
807 case IB_CM_TIMEWAIT_EXIT:
808 case IB_CM_MRA_RECEIVED:
809 /* ignore event */
810 goto out;
811 case IB_CM_REJ_RECEIVED:
812 cma_modify_qp_err(&id_priv->id);
813 status = ib_event->param.rej_rcvd.reason;
814 event = RDMA_CM_EVENT_REJECTED;
815 break;
816 default:
817 printk(KERN_ERR "RDMA CMA: unexpected IB CM event: %d",
818 ib_event->event);
819 goto out;
820 }
821
822 ret = cma_notify_user(id_priv, event, status, ib_event->private_data,
823 private_data_len);
824 if (ret) {
825 /* Destroy the CM ID by returning a non-zero value. */
826 id_priv->cm_id.ib = NULL;
827 cma_exch(id_priv, CMA_DESTROYING);
828 cma_release_remove(id_priv);
829 rdma_destroy_id(&id_priv->id);
830 return ret;
831 }
832out:
833 cma_release_remove(id_priv);
834 return ret;
835}
836
837static struct rdma_id_private *cma_new_id(struct rdma_cm_id *listen_id,
838 struct ib_cm_event *ib_event)
839{
840 struct rdma_id_private *id_priv;
841 struct rdma_cm_id *id;
842 struct rdma_route *rt;
843 union cma_ip_addr *src, *dst;
844 __u16 port;
845 u8 ip_ver;
846
847 id = rdma_create_id(listen_id->event_handler, listen_id->context,
848 listen_id->ps);
849 if (IS_ERR(id))
850 return NULL;
851
852 rt = &id->route;
853 rt->num_paths = ib_event->param.req_rcvd.alternate_path ? 2 : 1;
854 rt->path_rec = kmalloc(sizeof *rt->path_rec * rt->num_paths, GFP_KERNEL);
855 if (!rt->path_rec)
856 goto err;
857
858 if (cma_get_net_info(ib_event->private_data, listen_id->ps,
859 &ip_ver, &port, &src, &dst))
860 goto err;
861
862 cma_save_net_info(&id->route.addr, &listen_id->route.addr,
863 ip_ver, port, src, dst);
864 rt->path_rec[0] = *ib_event->param.req_rcvd.primary_path;
865 if (rt->num_paths == 2)
866 rt->path_rec[1] = *ib_event->param.req_rcvd.alternate_path;
867
868 ib_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid);
869 ib_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid);
870 ib_addr_set_pkey(&rt->addr.dev_addr, be16_to_cpu(rt->path_rec[0].pkey));
871 rt->addr.dev_addr.dev_type = IB_NODE_CA;
872
873 id_priv = container_of(id, struct rdma_id_private, id);
874 id_priv->state = CMA_CONNECT;
875 return id_priv;
876err:
877 rdma_destroy_id(id);
878 return NULL;
879}
880
881static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
882{
883 struct rdma_id_private *listen_id, *conn_id;
884 int offset, ret;
885
886 listen_id = cm_id->context;
887 atomic_inc(&listen_id->dev_remove);
888 if (!cma_comp(listen_id, CMA_LISTEN)) {
889 ret = -ECONNABORTED;
890 goto out;
891 }
892
893 conn_id = cma_new_id(&listen_id->id, ib_event);
894 if (!conn_id) {
895 ret = -ENOMEM;
896 goto out;
897 }
898
899 atomic_inc(&conn_id->dev_remove);
900 ret = cma_acquire_ib_dev(conn_id);
901 if (ret) {
902 ret = -ENODEV;
903 cma_release_remove(conn_id);
904 rdma_destroy_id(&conn_id->id);
905 goto out;
906 }
907
908 conn_id->cm_id.ib = cm_id;
909 cm_id->context = conn_id;
910 cm_id->cm_handler = cma_ib_handler;
911
912 offset = cma_user_data_offset(listen_id->id.ps);
913 ret = cma_notify_user(conn_id, RDMA_CM_EVENT_CONNECT_REQUEST, 0,
914 ib_event->private_data + offset,
915 IB_CM_REQ_PRIVATE_DATA_SIZE - offset);
916 if (ret) {
917 /* Destroy the CM ID by returning a non-zero value. */
918 conn_id->cm_id.ib = NULL;
919 cma_exch(conn_id, CMA_DESTROYING);
920 cma_release_remove(conn_id);
921 rdma_destroy_id(&conn_id->id);
922 }
923out:
924 cma_release_remove(listen_id);
925 return ret;
926}
927
928static __be64 cma_get_service_id(enum rdma_port_space ps, struct sockaddr *addr)
929{
930 return cpu_to_be64(((u64)ps << 16) +
931 be16_to_cpu(((struct sockaddr_in *) addr)->sin_port));
932}
933
934static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr,
935 struct ib_cm_compare_data *compare)
936{
937 struct cma_hdr *cma_data, *cma_mask;
938 struct sdp_hh *sdp_data, *sdp_mask;
939 __u32 ip4_addr;
940 struct in6_addr ip6_addr;
941
942 memset(compare, 0, sizeof *compare);
943 cma_data = (void *) compare->data;
944 cma_mask = (void *) compare->mask;
945 sdp_data = (void *) compare->data;
946 sdp_mask = (void *) compare->mask;
947
948 switch (addr->sa_family) {
949 case AF_INET:
950 ip4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
951 if (ps == RDMA_PS_SDP) {
952 sdp_set_ip_ver(sdp_data, 4);
953 sdp_set_ip_ver(sdp_mask, 0xF);
954 sdp_data->dst_addr.ip4.addr = ip4_addr;
955 sdp_mask->dst_addr.ip4.addr = ~0;
956 } else {
957 cma_set_ip_ver(cma_data, 4);
958 cma_set_ip_ver(cma_mask, 0xF);
959 cma_data->dst_addr.ip4.addr = ip4_addr;
960 cma_mask->dst_addr.ip4.addr = ~0;
961 }
962 break;
963 case AF_INET6:
964 ip6_addr = ((struct sockaddr_in6 *) addr)->sin6_addr;
965 if (ps == RDMA_PS_SDP) {
966 sdp_set_ip_ver(sdp_data, 6);
967 sdp_set_ip_ver(sdp_mask, 0xF);
968 sdp_data->dst_addr.ip6 = ip6_addr;
969 memset(&sdp_mask->dst_addr.ip6, 0xFF,
970 sizeof sdp_mask->dst_addr.ip6);
971 } else {
972 cma_set_ip_ver(cma_data, 6);
973 cma_set_ip_ver(cma_mask, 0xF);
974 cma_data->dst_addr.ip6 = ip6_addr;
975 memset(&cma_mask->dst_addr.ip6, 0xFF,
976 sizeof cma_mask->dst_addr.ip6);
977 }
978 break;
979 default:
980 break;
981 }
982}
983
984static int cma_ib_listen(struct rdma_id_private *id_priv)
985{
986 struct ib_cm_compare_data compare_data;
987 struct sockaddr *addr;
988 __be64 svc_id;
989 int ret;
990
991 id_priv->cm_id.ib = ib_create_cm_id(id_priv->id.device, cma_req_handler,
992 id_priv);
993 if (IS_ERR(id_priv->cm_id.ib))
994 return PTR_ERR(id_priv->cm_id.ib);
995
996 addr = &id_priv->id.route.addr.src_addr;
997 svc_id = cma_get_service_id(id_priv->id.ps, addr);
998 if (cma_any_addr(addr))
999 ret = ib_cm_listen(id_priv->cm_id.ib, svc_id, 0, NULL);
1000 else {
1001 cma_set_compare_data(id_priv->id.ps, addr, &compare_data);
1002 ret = ib_cm_listen(id_priv->cm_id.ib, svc_id, 0, &compare_data);
1003 }
1004
1005 if (ret) {
1006 ib_destroy_cm_id(id_priv->cm_id.ib);
1007 id_priv->cm_id.ib = NULL;
1008 }
1009
1010 return ret;
1011}
1012
1013static int cma_listen_handler(struct rdma_cm_id *id,
1014 struct rdma_cm_event *event)
1015{
1016 struct rdma_id_private *id_priv = id->context;
1017
1018 id->context = id_priv->id.context;
1019 id->event_handler = id_priv->id.event_handler;
1020 return id_priv->id.event_handler(id, event);
1021}
1022
1023static void cma_listen_on_dev(struct rdma_id_private *id_priv,
1024 struct cma_device *cma_dev)
1025{
1026 struct rdma_id_private *dev_id_priv;
1027 struct rdma_cm_id *id;
1028 int ret;
1029
1030 id = rdma_create_id(cma_listen_handler, id_priv, id_priv->id.ps);
1031 if (IS_ERR(id))
1032 return;
1033
1034 dev_id_priv = container_of(id, struct rdma_id_private, id);
1035
1036 dev_id_priv->state = CMA_ADDR_BOUND;
1037 memcpy(&id->route.addr.src_addr, &id_priv->id.route.addr.src_addr,
1038 ip_addr_size(&id_priv->id.route.addr.src_addr));
1039
1040 cma_attach_to_dev(dev_id_priv, cma_dev);
1041 list_add_tail(&dev_id_priv->listen_list, &id_priv->listen_list);
1042
1043 ret = rdma_listen(id, id_priv->backlog);
1044 if (ret)
1045 goto err;
1046
1047 return;
1048err:
1049 cma_destroy_listen(dev_id_priv);
1050}
1051
1052static void cma_listen_on_all(struct rdma_id_private *id_priv)
1053{
1054 struct cma_device *cma_dev;
1055
1056 mutex_lock(&lock);
1057 list_add_tail(&id_priv->list, &listen_any_list);
1058 list_for_each_entry(cma_dev, &dev_list, list)
1059 cma_listen_on_dev(id_priv, cma_dev);
1060 mutex_unlock(&lock);
1061}
1062
1063static int cma_bind_any(struct rdma_cm_id *id, sa_family_t af)
1064{
1065 struct sockaddr_in addr_in;
1066
1067 memset(&addr_in, 0, sizeof addr_in);
1068 addr_in.sin_family = af;
1069 return rdma_bind_addr(id, (struct sockaddr *) &addr_in);
1070}
1071
1072int rdma_listen(struct rdma_cm_id *id, int backlog)
1073{
1074 struct rdma_id_private *id_priv;
1075 int ret;
1076
1077 id_priv = container_of(id, struct rdma_id_private, id);
1078 if (id_priv->state == CMA_IDLE) {
1079 ret = cma_bind_any(id, AF_INET);
1080 if (ret)
1081 return ret;
1082 }
1083
1084 if (!cma_comp_exch(id_priv, CMA_ADDR_BOUND, CMA_LISTEN))
1085 return -EINVAL;
1086
1087 id_priv->backlog = backlog;
1088 if (id->device) {
1089 switch (id->device->node_type) {
1090 case IB_NODE_CA:
1091 ret = cma_ib_listen(id_priv);
1092 if (ret)
1093 goto err;
1094 break;
1095 default:
1096 ret = -ENOSYS;
1097 goto err;
1098 }
1099 } else
1100 cma_listen_on_all(id_priv);
1101
1102 return 0;
1103err:
1104 id_priv->backlog = 0;
1105 cma_comp_exch(id_priv, CMA_LISTEN, CMA_ADDR_BOUND);
1106 return ret;
1107}
1108EXPORT_SYMBOL(rdma_listen);
1109
1110static void cma_query_handler(int status, struct ib_sa_path_rec *path_rec,
1111 void *context)
1112{
1113 struct cma_work *work = context;
1114 struct rdma_route *route;
1115
1116 route = &work->id->id.route;
1117
1118 if (!status) {
1119 route->num_paths = 1;
1120 *route->path_rec = *path_rec;
1121 } else {
1122 work->old_state = CMA_ROUTE_QUERY;
1123 work->new_state = CMA_ADDR_RESOLVED;
1124 work->event.event = RDMA_CM_EVENT_ROUTE_ERROR;
1125 }
1126
1127 queue_work(cma_wq, &work->work);
1128}
1129
1130static int cma_query_ib_route(struct rdma_id_private *id_priv, int timeout_ms,
1131 struct cma_work *work)
1132{
1133 struct rdma_dev_addr *addr = &id_priv->id.route.addr.dev_addr;
1134 struct ib_sa_path_rec path_rec;
1135
1136 memset(&path_rec, 0, sizeof path_rec);
1137 path_rec.sgid = *ib_addr_get_sgid(addr);
1138 path_rec.dgid = *ib_addr_get_dgid(addr);
1139 path_rec.pkey = cpu_to_be16(ib_addr_get_pkey(addr));
1140 path_rec.numb_path = 1;
1141
1142 id_priv->query_id = ib_sa_path_rec_get(id_priv->id.device,
1143 id_priv->id.port_num, &path_rec,
1144 IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID |
1145 IB_SA_PATH_REC_PKEY | IB_SA_PATH_REC_NUMB_PATH,
1146 timeout_ms, GFP_KERNEL,
1147 cma_query_handler, work, &id_priv->query);
1148
1149 return (id_priv->query_id < 0) ? id_priv->query_id : 0;
1150}
1151
1152static void cma_work_handler(void *data)
1153{
1154 struct cma_work *work = data;
1155 struct rdma_id_private *id_priv = work->id;
1156 int destroy = 0;
1157
1158 atomic_inc(&id_priv->dev_remove);
1159 if (!cma_comp_exch(id_priv, work->old_state, work->new_state))
1160 goto out;
1161
1162 if (id_priv->id.event_handler(&id_priv->id, &work->event)) {
1163 cma_exch(id_priv, CMA_DESTROYING);
1164 destroy = 1;
1165 }
1166out:
1167 cma_release_remove(id_priv);
1168 cma_deref_id(id_priv);
1169 if (destroy)
1170 rdma_destroy_id(&id_priv->id);
1171 kfree(work);
1172}
1173
1174static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms)
1175{
1176 struct rdma_route *route = &id_priv->id.route;
1177 struct cma_work *work;
1178 int ret;
1179
1180 work = kzalloc(sizeof *work, GFP_KERNEL);
1181 if (!work)
1182 return -ENOMEM;
1183
1184 work->id = id_priv;
1185 INIT_WORK(&work->work, cma_work_handler, work);
1186 work->old_state = CMA_ROUTE_QUERY;
1187 work->new_state = CMA_ROUTE_RESOLVED;
1188 work->event.event = RDMA_CM_EVENT_ROUTE_RESOLVED;
1189
1190 route->path_rec = kmalloc(sizeof *route->path_rec, GFP_KERNEL);
1191 if (!route->path_rec) {
1192 ret = -ENOMEM;
1193 goto err1;
1194 }
1195
1196 ret = cma_query_ib_route(id_priv, timeout_ms, work);
1197 if (ret)
1198 goto err2;
1199
1200 return 0;
1201err2:
1202 kfree(route->path_rec);
1203 route->path_rec = NULL;
1204err1:
1205 kfree(work);
1206 return ret;
1207}
1208
1209int rdma_set_ib_paths(struct rdma_cm_id *id,
1210 struct ib_sa_path_rec *path_rec, int num_paths)
1211{
1212 struct rdma_id_private *id_priv;
1213 int ret;
1214
1215 id_priv = container_of(id, struct rdma_id_private, id);
1216 if (!cma_comp_exch(id_priv, CMA_ADDR_RESOLVED, CMA_ROUTE_RESOLVED))
1217 return -EINVAL;
1218
1219 id->route.path_rec = kmalloc(sizeof *path_rec * num_paths, GFP_KERNEL);
1220 if (!id->route.path_rec) {
1221 ret = -ENOMEM;
1222 goto err;
1223 }
1224
1225 memcpy(id->route.path_rec, path_rec, sizeof *path_rec * num_paths);
1226 return 0;
1227err:
1228 cma_comp_exch(id_priv, CMA_ROUTE_RESOLVED, CMA_ADDR_RESOLVED);
1229 return ret;
1230}
1231EXPORT_SYMBOL(rdma_set_ib_paths);
1232
1233int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms)
1234{
1235 struct rdma_id_private *id_priv;
1236 int ret;
1237
1238 id_priv = container_of(id, struct rdma_id_private, id);
1239 if (!cma_comp_exch(id_priv, CMA_ADDR_RESOLVED, CMA_ROUTE_QUERY))
1240 return -EINVAL;
1241
1242 atomic_inc(&id_priv->refcount);
1243 switch (id->device->node_type) {
1244 case IB_NODE_CA:
1245 ret = cma_resolve_ib_route(id_priv, timeout_ms);
1246 break;
1247 default:
1248 ret = -ENOSYS;
1249 break;
1250 }
1251 if (ret)
1252 goto err;
1253
1254 return 0;
1255err:
1256 cma_comp_exch(id_priv, CMA_ROUTE_QUERY, CMA_ADDR_RESOLVED);
1257 cma_deref_id(id_priv);
1258 return ret;
1259}
1260EXPORT_SYMBOL(rdma_resolve_route);
1261
1262static int cma_bind_loopback(struct rdma_id_private *id_priv)
1263{
1264 struct cma_device *cma_dev;
1265 struct ib_port_attr port_attr;
1266 union ib_gid *gid;
1267 u16 pkey;
1268 int ret;
1269 u8 p;
1270
1271 mutex_lock(&lock);
1272 list_for_each_entry(cma_dev, &dev_list, list)
1273 for (p = 1; p <= cma_dev->device->phys_port_cnt; ++p)
1274 if (!ib_query_port (cma_dev->device, p, &port_attr) &&
1275 port_attr.state == IB_PORT_ACTIVE)
1276 goto port_found;
1277
1278 if (!list_empty(&dev_list)) {
1279 p = 1;
1280 cma_dev = list_entry(dev_list.next, struct cma_device, list);
1281 } else {
1282 ret = -ENODEV;
1283 goto out;
1284 }
1285
1286port_found:
1287 gid = ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr);
1288 ret = ib_get_cached_gid(cma_dev->device, p, 0, gid);
1289 if (ret)
1290 goto out;
1291
1292 ret = ib_get_cached_pkey(cma_dev->device, p, 0, &pkey);
1293 if (ret)
1294 goto out;
1295
1296 ib_addr_set_pkey(&id_priv->id.route.addr.dev_addr, pkey);
1297 id_priv->id.port_num = p;
1298 cma_attach_to_dev(id_priv, cma_dev);
1299out:
1300 mutex_unlock(&lock);
1301 return ret;
1302}
1303
1304static void addr_handler(int status, struct sockaddr *src_addr,
1305 struct rdma_dev_addr *dev_addr, void *context)
1306{
1307 struct rdma_id_private *id_priv = context;
1308 enum rdma_cm_event_type event;
1309
1310 atomic_inc(&id_priv->dev_remove);
1311 if (!id_priv->cma_dev && !status)
1312 status = cma_acquire_dev(id_priv);
1313
1314 if (status) {
1315 if (!cma_comp_exch(id_priv, CMA_ADDR_QUERY, CMA_ADDR_BOUND))
1316 goto out;
1317 event = RDMA_CM_EVENT_ADDR_ERROR;
1318 } else {
1319 if (!cma_comp_exch(id_priv, CMA_ADDR_QUERY, CMA_ADDR_RESOLVED))
1320 goto out;
1321 memcpy(&id_priv->id.route.addr.src_addr, src_addr,
1322 ip_addr_size(src_addr));
1323 event = RDMA_CM_EVENT_ADDR_RESOLVED;
1324 }
1325
1326 if (cma_notify_user(id_priv, event, status, NULL, 0)) {
1327 cma_exch(id_priv, CMA_DESTROYING);
1328 cma_release_remove(id_priv);
1329 cma_deref_id(id_priv);
1330 rdma_destroy_id(&id_priv->id);
1331 return;
1332 }
1333out:
1334 cma_release_remove(id_priv);
1335 cma_deref_id(id_priv);
1336}
1337
1338static int cma_resolve_loopback(struct rdma_id_private *id_priv)
1339{
1340 struct cma_work *work;
1341 struct sockaddr_in *src_in, *dst_in;
1342 int ret;
1343
1344 work = kzalloc(sizeof *work, GFP_KERNEL);
1345 if (!work)
1346 return -ENOMEM;
1347
1348 if (!id_priv->cma_dev) {
1349 ret = cma_bind_loopback(id_priv);
1350 if (ret)
1351 goto err;
1352 }
1353
1354 ib_addr_set_dgid(&id_priv->id.route.addr.dev_addr,
1355 ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr));
1356
1357 if (cma_zero_addr(&id_priv->id.route.addr.src_addr)) {
1358 src_in = (struct sockaddr_in *)&id_priv->id.route.addr.src_addr;
1359 dst_in = (struct sockaddr_in *)&id_priv->id.route.addr.dst_addr;
1360 src_in->sin_family = dst_in->sin_family;
1361 src_in->sin_addr.s_addr = dst_in->sin_addr.s_addr;
1362 }
1363
1364 work->id = id_priv;
1365 INIT_WORK(&work->work, cma_work_handler, work);
1366 work->old_state = CMA_ADDR_QUERY;
1367 work->new_state = CMA_ADDR_RESOLVED;
1368 work->event.event = RDMA_CM_EVENT_ADDR_RESOLVED;
1369 queue_work(cma_wq, &work->work);
1370 return 0;
1371err:
1372 kfree(work);
1373 return ret;
1374}
1375
1376static int cma_bind_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
1377 struct sockaddr *dst_addr)
1378{
1379 if (src_addr && src_addr->sa_family)
1380 return rdma_bind_addr(id, src_addr);
1381 else
1382 return cma_bind_any(id, dst_addr->sa_family);
1383}
1384
1385int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
1386 struct sockaddr *dst_addr, int timeout_ms)
1387{
1388 struct rdma_id_private *id_priv;
1389 int ret;
1390
1391 id_priv = container_of(id, struct rdma_id_private, id);
1392 if (id_priv->state == CMA_IDLE) {
1393 ret = cma_bind_addr(id, src_addr, dst_addr);
1394 if (ret)
1395 return ret;
1396 }
1397
1398 if (!cma_comp_exch(id_priv, CMA_ADDR_BOUND, CMA_ADDR_QUERY))
1399 return -EINVAL;
1400
1401 atomic_inc(&id_priv->refcount);
1402 memcpy(&id->route.addr.dst_addr, dst_addr, ip_addr_size(dst_addr));
1403 if (cma_any_addr(dst_addr))
1404 ret = cma_resolve_loopback(id_priv);
1405 else
1406 ret = rdma_resolve_ip(&id->route.addr.src_addr, dst_addr,
1407 &id->route.addr.dev_addr,
1408 timeout_ms, addr_handler, id_priv);
1409 if (ret)
1410 goto err;
1411
1412 return 0;
1413err:
1414 cma_comp_exch(id_priv, CMA_ADDR_QUERY, CMA_ADDR_BOUND);
1415 cma_deref_id(id_priv);
1416 return ret;
1417}
1418EXPORT_SYMBOL(rdma_resolve_addr);
1419
1420static void cma_bind_port(struct rdma_bind_list *bind_list,
1421 struct rdma_id_private *id_priv)
1422{
1423 struct sockaddr_in *sin;
1424
1425 sin = (struct sockaddr_in *) &id_priv->id.route.addr.src_addr;
1426 sin->sin_port = htons(bind_list->port);
1427 id_priv->bind_list = bind_list;
1428 hlist_add_head(&id_priv->node, &bind_list->owners);
1429}
1430
1431static int cma_alloc_port(struct idr *ps, struct rdma_id_private *id_priv,
1432 unsigned short snum)
1433{
1434 struct rdma_bind_list *bind_list;
1435 int port, start, ret;
1436
1437 bind_list = kzalloc(sizeof *bind_list, GFP_KERNEL);
1438 if (!bind_list)
1439 return -ENOMEM;
1440
1441 start = snum ? snum : sysctl_local_port_range[0];
1442
1443 do {
1444 ret = idr_get_new_above(ps, bind_list, start, &port);
1445 } while ((ret == -EAGAIN) && idr_pre_get(ps, GFP_KERNEL));
1446
1447 if (ret)
1448 goto err;
1449
1450 if ((snum && port != snum) ||
1451 (!snum && port > sysctl_local_port_range[1])) {
1452 idr_remove(ps, port);
1453 ret = -EADDRNOTAVAIL;
1454 goto err;
1455 }
1456
1457 bind_list->ps = ps;
1458 bind_list->port = (unsigned short) port;
1459 cma_bind_port(bind_list, id_priv);
1460 return 0;
1461err:
1462 kfree(bind_list);
1463 return ret;
1464}
1465
1466static int cma_use_port(struct idr *ps, struct rdma_id_private *id_priv)
1467{
1468 struct rdma_id_private *cur_id;
1469 struct sockaddr_in *sin, *cur_sin;
1470 struct rdma_bind_list *bind_list;
1471 struct hlist_node *node;
1472 unsigned short snum;
1473
1474 sin = (struct sockaddr_in *) &id_priv->id.route.addr.src_addr;
1475 snum = ntohs(sin->sin_port);
1476 if (snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE))
1477 return -EACCES;
1478
1479 bind_list = idr_find(ps, snum);
1480 if (!bind_list)
1481 return cma_alloc_port(ps, id_priv, snum);
1482
1483 /*
1484 * We don't support binding to any address if anyone is bound to
1485 * a specific address on the same port.
1486 */
1487 if (cma_any_addr(&id_priv->id.route.addr.src_addr))
1488 return -EADDRNOTAVAIL;
1489
1490 hlist_for_each_entry(cur_id, node, &bind_list->owners, node) {
1491 if (cma_any_addr(&cur_id->id.route.addr.src_addr))
1492 return -EADDRNOTAVAIL;
1493
1494 cur_sin = (struct sockaddr_in *) &cur_id->id.route.addr.src_addr;
1495 if (sin->sin_addr.s_addr == cur_sin->sin_addr.s_addr)
1496 return -EADDRINUSE;
1497 }
1498
1499 cma_bind_port(bind_list, id_priv);
1500 return 0;
1501}
1502
1503static int cma_get_port(struct rdma_id_private *id_priv)
1504{
1505 struct idr *ps;
1506 int ret;
1507
1508 switch (id_priv->id.ps) {
1509 case RDMA_PS_SDP:
1510 ps = &sdp_ps;
1511 break;
1512 case RDMA_PS_TCP:
1513 ps = &tcp_ps;
1514 break;
1515 default:
1516 return -EPROTONOSUPPORT;
1517 }
1518
1519 mutex_lock(&lock);
1520 if (cma_any_port(&id_priv->id.route.addr.src_addr))
1521 ret = cma_alloc_port(ps, id_priv, 0);
1522 else
1523 ret = cma_use_port(ps, id_priv);
1524 mutex_unlock(&lock);
1525
1526 return ret;
1527}
1528
1529int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
1530{
1531 struct rdma_id_private *id_priv;
1532 int ret;
1533
1534 if (addr->sa_family != AF_INET)
1535 return -EAFNOSUPPORT;
1536
1537 id_priv = container_of(id, struct rdma_id_private, id);
1538 if (!cma_comp_exch(id_priv, CMA_IDLE, CMA_ADDR_BOUND))
1539 return -EINVAL;
1540
1541 if (!cma_any_addr(addr)) {
1542 ret = rdma_translate_ip(addr, &id->route.addr.dev_addr);
1543 if (!ret)
1544 ret = cma_acquire_dev(id_priv);
1545 if (ret)
1546 goto err;
1547 }
1548
1549 memcpy(&id->route.addr.src_addr, addr, ip_addr_size(addr));
1550 ret = cma_get_port(id_priv);
1551 if (ret)
1552 goto err;
1553
1554 return 0;
1555err:
1556 cma_comp_exch(id_priv, CMA_ADDR_BOUND, CMA_IDLE);
1557 return ret;
1558}
1559EXPORT_SYMBOL(rdma_bind_addr);
1560
1561static int cma_format_hdr(void *hdr, enum rdma_port_space ps,
1562 struct rdma_route *route)
1563{
1564 struct sockaddr_in *src4, *dst4;
1565 struct cma_hdr *cma_hdr;
1566 struct sdp_hh *sdp_hdr;
1567
1568 src4 = (struct sockaddr_in *) &route->addr.src_addr;
1569 dst4 = (struct sockaddr_in *) &route->addr.dst_addr;
1570
1571 switch (ps) {
1572 case RDMA_PS_SDP:
1573 sdp_hdr = hdr;
1574 if (sdp_get_majv(sdp_hdr->sdp_version) != SDP_MAJ_VERSION)
1575 return -EINVAL;
1576 sdp_set_ip_ver(sdp_hdr, 4);
1577 sdp_hdr->src_addr.ip4.addr = src4->sin_addr.s_addr;
1578 sdp_hdr->dst_addr.ip4.addr = dst4->sin_addr.s_addr;
1579 sdp_hdr->port = src4->sin_port;
1580 break;
1581 default:
1582 cma_hdr = hdr;
1583 cma_hdr->cma_version = CMA_VERSION;
1584 cma_set_ip_ver(cma_hdr, 4);
1585 cma_hdr->src_addr.ip4.addr = src4->sin_addr.s_addr;
1586 cma_hdr->dst_addr.ip4.addr = dst4->sin_addr.s_addr;
1587 cma_hdr->port = src4->sin_port;
1588 break;
1589 }
1590 return 0;
1591}
1592
1593static int cma_connect_ib(struct rdma_id_private *id_priv,
1594 struct rdma_conn_param *conn_param)
1595{
1596 struct ib_cm_req_param req;
1597 struct rdma_route *route;
1598 void *private_data;
1599 int offset, ret;
1600
1601 memset(&req, 0, sizeof req);
1602 offset = cma_user_data_offset(id_priv->id.ps);
1603 req.private_data_len = offset + conn_param->private_data_len;
1604 private_data = kzalloc(req.private_data_len, GFP_ATOMIC);
1605 if (!private_data)
1606 return -ENOMEM;
1607
1608 if (conn_param->private_data && conn_param->private_data_len)
1609 memcpy(private_data + offset, conn_param->private_data,
1610 conn_param->private_data_len);
1611
1612 id_priv->cm_id.ib = ib_create_cm_id(id_priv->id.device, cma_ib_handler,
1613 id_priv);
1614 if (IS_ERR(id_priv->cm_id.ib)) {
1615 ret = PTR_ERR(id_priv->cm_id.ib);
1616 goto out;
1617 }
1618
1619 route = &id_priv->id.route;
1620 ret = cma_format_hdr(private_data, id_priv->id.ps, route);
1621 if (ret)
1622 goto out;
1623 req.private_data = private_data;
1624
1625 req.primary_path = &route->path_rec[0];
1626 if (route->num_paths == 2)
1627 req.alternate_path = &route->path_rec[1];
1628
1629 req.service_id = cma_get_service_id(id_priv->id.ps,
1630 &route->addr.dst_addr);
1631 req.qp_num = id_priv->qp_num;
1632 req.qp_type = id_priv->qp_type;
1633 req.starting_psn = id_priv->seq_num;
1634 req.responder_resources = conn_param->responder_resources;
1635 req.initiator_depth = conn_param->initiator_depth;
1636 req.flow_control = conn_param->flow_control;
1637 req.retry_count = conn_param->retry_count;
1638 req.rnr_retry_count = conn_param->rnr_retry_count;
1639 req.remote_cm_response_timeout = CMA_CM_RESPONSE_TIMEOUT;
1640 req.local_cm_response_timeout = CMA_CM_RESPONSE_TIMEOUT;
1641 req.max_cm_retries = CMA_MAX_CM_RETRIES;
1642 req.srq = id_priv->srq ? 1 : 0;
1643
1644 ret = ib_send_cm_req(id_priv->cm_id.ib, &req);
1645out:
1646 kfree(private_data);
1647 return ret;
1648}
1649
1650int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
1651{
1652 struct rdma_id_private *id_priv;
1653 int ret;
1654
1655 id_priv = container_of(id, struct rdma_id_private, id);
1656 if (!cma_comp_exch(id_priv, CMA_ROUTE_RESOLVED, CMA_CONNECT))
1657 return -EINVAL;
1658
1659 if (!id->qp) {
1660 id_priv->qp_num = conn_param->qp_num;
1661 id_priv->qp_type = conn_param->qp_type;
1662 id_priv->srq = conn_param->srq;
1663 }
1664
1665 switch (id->device->node_type) {
1666 case IB_NODE_CA:
1667 ret = cma_connect_ib(id_priv, conn_param);
1668 break;
1669 default:
1670 ret = -ENOSYS;
1671 break;
1672 }
1673 if (ret)
1674 goto err;
1675
1676 return 0;
1677err:
1678 cma_comp_exch(id_priv, CMA_CONNECT, CMA_ROUTE_RESOLVED);
1679 return ret;
1680}
1681EXPORT_SYMBOL(rdma_connect);
1682
1683static int cma_accept_ib(struct rdma_id_private *id_priv,
1684 struct rdma_conn_param *conn_param)
1685{
1686 struct ib_cm_rep_param rep;
1687 int ret;
1688
1689 ret = cma_modify_qp_rtr(&id_priv->id);
1690 if (ret)
1691 return ret;
1692
1693 memset(&rep, 0, sizeof rep);
1694 rep.qp_num = id_priv->qp_num;
1695 rep.starting_psn = id_priv->seq_num;
1696 rep.private_data = conn_param->private_data;
1697 rep.private_data_len = conn_param->private_data_len;
1698 rep.responder_resources = conn_param->responder_resources;
1699 rep.initiator_depth = conn_param->initiator_depth;
1700 rep.target_ack_delay = CMA_CM_RESPONSE_TIMEOUT;
1701 rep.failover_accepted = 0;
1702 rep.flow_control = conn_param->flow_control;
1703 rep.rnr_retry_count = conn_param->rnr_retry_count;
1704 rep.srq = id_priv->srq ? 1 : 0;
1705
1706 return ib_send_cm_rep(id_priv->cm_id.ib, &rep);
1707}
1708
1709int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
1710{
1711 struct rdma_id_private *id_priv;
1712 int ret;
1713
1714 id_priv = container_of(id, struct rdma_id_private, id);
1715 if (!cma_comp(id_priv, CMA_CONNECT))
1716 return -EINVAL;
1717
1718 if (!id->qp && conn_param) {
1719 id_priv->qp_num = conn_param->qp_num;
1720 id_priv->qp_type = conn_param->qp_type;
1721 id_priv->srq = conn_param->srq;
1722 }
1723
1724 switch (id->device->node_type) {
1725 case IB_NODE_CA:
1726 if (conn_param)
1727 ret = cma_accept_ib(id_priv, conn_param);
1728 else
1729 ret = cma_rep_recv(id_priv);
1730 break;
1731 default:
1732 ret = -ENOSYS;
1733 break;
1734 }
1735
1736 if (ret)
1737 goto reject;
1738
1739 return 0;
1740reject:
1741 cma_modify_qp_err(id);
1742 rdma_reject(id, NULL, 0);
1743 return ret;
1744}
1745EXPORT_SYMBOL(rdma_accept);
1746
1747int rdma_reject(struct rdma_cm_id *id, const void *private_data,
1748 u8 private_data_len)
1749{
1750 struct rdma_id_private *id_priv;
1751 int ret;
1752
1753 id_priv = container_of(id, struct rdma_id_private, id);
1754 if (!cma_comp(id_priv, CMA_CONNECT))
1755 return -EINVAL;
1756
1757 switch (id->device->node_type) {
1758 case IB_NODE_CA:
1759 ret = ib_send_cm_rej(id_priv->cm_id.ib,
1760 IB_CM_REJ_CONSUMER_DEFINED, NULL, 0,
1761 private_data, private_data_len);
1762 break;
1763 default:
1764 ret = -ENOSYS;
1765 break;
1766 }
1767 return ret;
1768}
1769EXPORT_SYMBOL(rdma_reject);
1770
1771int rdma_disconnect(struct rdma_cm_id *id)
1772{
1773 struct rdma_id_private *id_priv;
1774 int ret;
1775
1776 id_priv = container_of(id, struct rdma_id_private, id);
1777 if (!cma_comp(id_priv, CMA_CONNECT) &&
1778 !cma_comp(id_priv, CMA_DISCONNECT))
1779 return -EINVAL;
1780
1781 ret = cma_modify_qp_err(id);
1782 if (ret)
1783 goto out;
1784
1785 switch (id->device->node_type) {
1786 case IB_NODE_CA:
1787 /* Initiate or respond to a disconnect. */
1788 if (ib_send_cm_dreq(id_priv->cm_id.ib, NULL, 0))
1789 ib_send_cm_drep(id_priv->cm_id.ib, NULL, 0);
1790 break;
1791 default:
1792 break;
1793 }
1794out:
1795 return ret;
1796}
1797EXPORT_SYMBOL(rdma_disconnect);
1798
1799static void cma_add_one(struct ib_device *device)
1800{
1801 struct cma_device *cma_dev;
1802 struct rdma_id_private *id_priv;
1803
1804 cma_dev = kmalloc(sizeof *cma_dev, GFP_KERNEL);
1805 if (!cma_dev)
1806 return;
1807
1808 cma_dev->device = device;
1809 cma_dev->node_guid = device->node_guid;
1810 if (!cma_dev->node_guid)
1811 goto err;
1812
1813 init_completion(&cma_dev->comp);
1814 atomic_set(&cma_dev->refcount, 1);
1815 INIT_LIST_HEAD(&cma_dev->id_list);
1816 ib_set_client_data(device, &cma_client, cma_dev);
1817
1818 mutex_lock(&lock);
1819 list_add_tail(&cma_dev->list, &dev_list);
1820 list_for_each_entry(id_priv, &listen_any_list, list)
1821 cma_listen_on_dev(id_priv, cma_dev);
1822 mutex_unlock(&lock);
1823 return;
1824err:
1825 kfree(cma_dev);
1826}
1827
1828static int cma_remove_id_dev(struct rdma_id_private *id_priv)
1829{
1830 enum cma_state state;
1831
1832 /* Record that we want to remove the device */
1833 state = cma_exch(id_priv, CMA_DEVICE_REMOVAL);
1834 if (state == CMA_DESTROYING)
1835 return 0;
1836
1837 cma_cancel_operation(id_priv, state);
1838 wait_event(id_priv->wait_remove, !atomic_read(&id_priv->dev_remove));
1839
1840 /* Check for destruction from another callback. */
1841 if (!cma_comp(id_priv, CMA_DEVICE_REMOVAL))
1842 return 0;
1843
1844 return cma_notify_user(id_priv, RDMA_CM_EVENT_DEVICE_REMOVAL,
1845 0, NULL, 0);
1846}
1847
1848static void cma_process_remove(struct cma_device *cma_dev)
1849{
1850 struct list_head remove_list;
1851 struct rdma_id_private *id_priv;
1852 int ret;
1853
1854 INIT_LIST_HEAD(&remove_list);
1855
1856 mutex_lock(&lock);
1857 while (!list_empty(&cma_dev->id_list)) {
1858 id_priv = list_entry(cma_dev->id_list.next,
1859 struct rdma_id_private, list);
1860
1861 if (cma_internal_listen(id_priv)) {
1862 cma_destroy_listen(id_priv);
1863 continue;
1864 }
1865
1866 list_del(&id_priv->list);
1867 list_add_tail(&id_priv->list, &remove_list);
1868 atomic_inc(&id_priv->refcount);
1869 mutex_unlock(&lock);
1870
1871 ret = cma_remove_id_dev(id_priv);
1872 cma_deref_id(id_priv);
1873 if (ret)
1874 rdma_destroy_id(&id_priv->id);
1875
1876 mutex_lock(&lock);
1877 }
1878 mutex_unlock(&lock);
1879
1880 cma_deref_dev(cma_dev);
1881 wait_for_completion(&cma_dev->comp);
1882}
1883
1884static void cma_remove_one(struct ib_device *device)
1885{
1886 struct cma_device *cma_dev;
1887
1888 cma_dev = ib_get_client_data(device, &cma_client);
1889 if (!cma_dev)
1890 return;
1891
1892 mutex_lock(&lock);
1893 list_del(&cma_dev->list);
1894 mutex_unlock(&lock);
1895
1896 cma_process_remove(cma_dev);
1897 kfree(cma_dev);
1898}
1899
1900static int cma_init(void)
1901{
1902 int ret;
1903
1904 cma_wq = create_singlethread_workqueue("rdma_cm_wq");
1905 if (!cma_wq)
1906 return -ENOMEM;
1907
1908 ret = ib_register_client(&cma_client);
1909 if (ret)
1910 goto err;
1911 return 0;
1912
1913err:
1914 destroy_workqueue(cma_wq);
1915 return ret;
1916}
1917
1918static void cma_cleanup(void)
1919{
1920 ib_unregister_client(&cma_client);
1921 destroy_workqueue(cma_wq);
1922 idr_destroy(&sdp_ps);
1923 idr_destroy(&tcp_ps);
1924}
1925
1926module_init(cma_init);
1927module_exit(cma_cleanup);
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index 838bf54458d2..615fe9cc6c56 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
@@ -54,7 +54,7 @@ enum {
54/* 54/*
55 * If an FMR is not in use, then the list member will point to either 55 * If an FMR is not in use, then the list member will point to either
56 * its pool's free_list (if the FMR can be mapped again; that is, 56 * its pool's free_list (if the FMR can be mapped again; that is,
57 * remap_count < IB_FMR_MAX_REMAPS) or its pool's dirty_list (if the 57 * remap_count < pool->max_remaps) or its pool's dirty_list (if the
58 * FMR needs to be unmapped before being remapped). In either of 58 * FMR needs to be unmapped before being remapped). In either of
59 * these cases it is a bug if the ref_count is not 0. In other words, 59 * these cases it is a bug if the ref_count is not 0. In other words,
60 * if ref_count is > 0, then the list member must not be linked into 60 * if ref_count is > 0, then the list member must not be linked into
@@ -84,6 +84,7 @@ struct ib_fmr_pool {
84 84
85 int pool_size; 85 int pool_size;
86 int max_pages; 86 int max_pages;
87 int max_remaps;
87 int dirty_watermark; 88 int dirty_watermark;
88 int dirty_len; 89 int dirty_len;
89 struct list_head free_list; 90 struct list_head free_list;
@@ -214,8 +215,10 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
214{ 215{
215 struct ib_device *device; 216 struct ib_device *device;
216 struct ib_fmr_pool *pool; 217 struct ib_fmr_pool *pool;
218 struct ib_device_attr *attr;
217 int i; 219 int i;
218 int ret; 220 int ret;
221 int max_remaps;
219 222
220 if (!params) 223 if (!params)
221 return ERR_PTR(-EINVAL); 224 return ERR_PTR(-EINVAL);
@@ -228,6 +231,26 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
228 return ERR_PTR(-ENOSYS); 231 return ERR_PTR(-ENOSYS);
229 } 232 }
230 233
234 attr = kmalloc(sizeof *attr, GFP_KERNEL);
235 if (!attr) {
236 printk(KERN_WARNING "couldn't allocate device attr struct");
237 return ERR_PTR(-ENOMEM);
238 }
239
240 ret = ib_query_device(device, attr);
241 if (ret) {
242 printk(KERN_WARNING "couldn't query device");
243 kfree(attr);
244 return ERR_PTR(ret);
245 }
246
247 if (!attr->max_map_per_fmr)
248 max_remaps = IB_FMR_MAX_REMAPS;
249 else
250 max_remaps = attr->max_map_per_fmr;
251
252 kfree(attr);
253
231 pool = kmalloc(sizeof *pool, GFP_KERNEL); 254 pool = kmalloc(sizeof *pool, GFP_KERNEL);
232 if (!pool) { 255 if (!pool) {
233 printk(KERN_WARNING "couldn't allocate pool struct"); 256 printk(KERN_WARNING "couldn't allocate pool struct");
@@ -258,6 +281,7 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
258 281
259 pool->pool_size = 0; 282 pool->pool_size = 0;
260 pool->max_pages = params->max_pages_per_fmr; 283 pool->max_pages = params->max_pages_per_fmr;
284 pool->max_remaps = max_remaps;
261 pool->dirty_watermark = params->dirty_watermark; 285 pool->dirty_watermark = params->dirty_watermark;
262 pool->dirty_len = 0; 286 pool->dirty_len = 0;
263 spin_lock_init(&pool->pool_lock); 287 spin_lock_init(&pool->pool_lock);
@@ -279,7 +303,7 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
279 struct ib_pool_fmr *fmr; 303 struct ib_pool_fmr *fmr;
280 struct ib_fmr_attr attr = { 304 struct ib_fmr_attr attr = {
281 .max_pages = params->max_pages_per_fmr, 305 .max_pages = params->max_pages_per_fmr,
282 .max_maps = IB_FMR_MAX_REMAPS, 306 .max_maps = pool->max_remaps,
283 .page_shift = params->page_shift 307 .page_shift = params->page_shift
284 }; 308 };
285 309
@@ -489,7 +513,7 @@ int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr)
489 513
490 --fmr->ref_count; 514 --fmr->ref_count;
491 if (!fmr->ref_count) { 515 if (!fmr->ref_count) {
492 if (fmr->remap_count < IB_FMR_MAX_REMAPS) { 516 if (fmr->remap_count < pool->max_remaps) {
493 list_add_tail(&fmr->list, &pool->free_list); 517 list_add_tail(&fmr->list, &pool->free_list);
494 } else { 518 } else {
495 list_add_tail(&fmr->list, &pool->dirty_list); 519 list_add_tail(&fmr->list, &pool->dirty_list);
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 5ad41a64314c..b38e02a5db35 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -34,6 +34,7 @@
34 * $Id: mad.c 5596 2006-03-03 01:00:07Z sean.hefty $ 34 * $Id: mad.c 5596 2006-03-03 01:00:07Z sean.hefty $
35 */ 35 */
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <rdma/ib_cache.h>
37 38
38#include "mad_priv.h" 39#include "mad_priv.h"
39#include "mad_rmpp.h" 40#include "mad_rmpp.h"
@@ -45,8 +46,7 @@ MODULE_DESCRIPTION("kernel IB MAD API");
45MODULE_AUTHOR("Hal Rosenstock"); 46MODULE_AUTHOR("Hal Rosenstock");
46MODULE_AUTHOR("Sean Hefty"); 47MODULE_AUTHOR("Sean Hefty");
47 48
48 49static kmem_cache_t *ib_mad_cache;
49kmem_cache_t *ib_mad_cache;
50 50
51static struct list_head ib_mad_port_list; 51static struct list_head ib_mad_port_list;
52static u32 ib_mad_client_id = 0; 52static u32 ib_mad_client_id = 0;
@@ -1673,20 +1673,21 @@ static inline int rcv_has_same_class(struct ib_mad_send_wr_private *wr,
1673 rwc->recv_buf.mad->mad_hdr.mgmt_class; 1673 rwc->recv_buf.mad->mad_hdr.mgmt_class;
1674} 1674}
1675 1675
1676static inline int rcv_has_same_gid(struct ib_mad_send_wr_private *wr, 1676static inline int rcv_has_same_gid(struct ib_mad_agent_private *mad_agent_priv,
1677 struct ib_mad_send_wr_private *wr,
1677 struct ib_mad_recv_wc *rwc ) 1678 struct ib_mad_recv_wc *rwc )
1678{ 1679{
1679 struct ib_ah_attr attr; 1680 struct ib_ah_attr attr;
1680 u8 send_resp, rcv_resp; 1681 u8 send_resp, rcv_resp;
1682 union ib_gid sgid;
1683 struct ib_device *device = mad_agent_priv->agent.device;
1684 u8 port_num = mad_agent_priv->agent.port_num;
1685 u8 lmc;
1681 1686
1682 send_resp = ((struct ib_mad *)(wr->send_buf.mad))-> 1687 send_resp = ((struct ib_mad *)(wr->send_buf.mad))->
1683 mad_hdr.method & IB_MGMT_METHOD_RESP; 1688 mad_hdr.method & IB_MGMT_METHOD_RESP;
1684 rcv_resp = rwc->recv_buf.mad->mad_hdr.method & IB_MGMT_METHOD_RESP; 1689 rcv_resp = rwc->recv_buf.mad->mad_hdr.method & IB_MGMT_METHOD_RESP;
1685 1690
1686 if (!send_resp && rcv_resp)
1687 /* is request/response. GID/LIDs are both local (same). */
1688 return 1;
1689
1690 if (send_resp == rcv_resp) 1691 if (send_resp == rcv_resp)
1691 /* both requests, or both responses. GIDs different */ 1692 /* both requests, or both responses. GIDs different */
1692 return 0; 1693 return 0;
@@ -1695,48 +1696,78 @@ static inline int rcv_has_same_gid(struct ib_mad_send_wr_private *wr,
1695 /* Assume not equal, to avoid false positives. */ 1696 /* Assume not equal, to avoid false positives. */
1696 return 0; 1697 return 0;
1697 1698
1698 if (!(attr.ah_flags & IB_AH_GRH) && !(rwc->wc->wc_flags & IB_WC_GRH)) 1699 if (!!(attr.ah_flags & IB_AH_GRH) !=
1699 return attr.dlid == rwc->wc->slid; 1700 !!(rwc->wc->wc_flags & IB_WC_GRH))
1700 else if ((attr.ah_flags & IB_AH_GRH) &&
1701 (rwc->wc->wc_flags & IB_WC_GRH))
1702 return memcmp(attr.grh.dgid.raw,
1703 rwc->recv_buf.grh->sgid.raw, 16) == 0;
1704 else
1705 /* one has GID, other does not. Assume different */ 1701 /* one has GID, other does not. Assume different */
1706 return 0; 1702 return 0;
1703
1704 if (!send_resp && rcv_resp) {
1705 /* is request/response. */
1706 if (!(attr.ah_flags & IB_AH_GRH)) {
1707 if (ib_get_cached_lmc(device, port_num, &lmc))
1708 return 0;
1709 return (!lmc || !((attr.src_path_bits ^
1710 rwc->wc->dlid_path_bits) &
1711 ((1 << lmc) - 1)));
1712 } else {
1713 if (ib_get_cached_gid(device, port_num,
1714 attr.grh.sgid_index, &sgid))
1715 return 0;
1716 return !memcmp(sgid.raw, rwc->recv_buf.grh->dgid.raw,
1717 16);
1718 }
1719 }
1720
1721 if (!(attr.ah_flags & IB_AH_GRH))
1722 return attr.dlid == rwc->wc->slid;
1723 else
1724 return !memcmp(attr.grh.dgid.raw, rwc->recv_buf.grh->sgid.raw,
1725 16);
1726}
1727
1728static inline int is_direct(u8 class)
1729{
1730 return (class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE);
1707} 1731}
1732
1708struct ib_mad_send_wr_private* 1733struct ib_mad_send_wr_private*
1709ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, 1734ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv,
1710 struct ib_mad_recv_wc *mad_recv_wc) 1735 struct ib_mad_recv_wc *wc)
1711{ 1736{
1712 struct ib_mad_send_wr_private *mad_send_wr; 1737 struct ib_mad_send_wr_private *wr;
1713 struct ib_mad *mad; 1738 struct ib_mad *mad;
1714 1739
1715 mad = (struct ib_mad *)mad_recv_wc->recv_buf.mad; 1740 mad = (struct ib_mad *)wc->recv_buf.mad;
1716 1741
1717 list_for_each_entry(mad_send_wr, &mad_agent_priv->wait_list, 1742 list_for_each_entry(wr, &mad_agent_priv->wait_list, agent_list) {
1718 agent_list) { 1743 if ((wr->tid == mad->mad_hdr.tid) &&
1719 if ((mad_send_wr->tid == mad->mad_hdr.tid) && 1744 rcv_has_same_class(wr, wc) &&
1720 rcv_has_same_class(mad_send_wr, mad_recv_wc) && 1745 /*
1721 rcv_has_same_gid(mad_send_wr, mad_recv_wc)) 1746 * Don't check GID for direct routed MADs.
1722 return mad_send_wr; 1747 * These might have permissive LIDs.
1748 */
1749 (is_direct(wc->recv_buf.mad->mad_hdr.mgmt_class) ||
1750 rcv_has_same_gid(mad_agent_priv, wr, wc)))
1751 return wr;
1723 } 1752 }
1724 1753
1725 /* 1754 /*
1726 * It's possible to receive the response before we've 1755 * It's possible to receive the response before we've
1727 * been notified that the send has completed 1756 * been notified that the send has completed
1728 */ 1757 */
1729 list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list, 1758 list_for_each_entry(wr, &mad_agent_priv->send_list, agent_list) {
1730 agent_list) { 1759 if (is_data_mad(mad_agent_priv, wr->send_buf.mad) &&
1731 if (is_data_mad(mad_agent_priv, mad_send_wr->send_buf.mad) && 1760 wr->tid == mad->mad_hdr.tid &&
1732 mad_send_wr->tid == mad->mad_hdr.tid && 1761 wr->timeout &&
1733 mad_send_wr->timeout && 1762 rcv_has_same_class(wr, wc) &&
1734 rcv_has_same_class(mad_send_wr, mad_recv_wc) && 1763 /*
1735 rcv_has_same_gid(mad_send_wr, mad_recv_wc)) { 1764 * Don't check GID for direct routed MADs.
1765 * These might have permissive LIDs.
1766 */
1767 (is_direct(wc->recv_buf.mad->mad_hdr.mgmt_class) ||
1768 rcv_has_same_gid(mad_agent_priv, wr, wc)))
1736 /* Verify request has not been canceled */ 1769 /* Verify request has not been canceled */
1737 return (mad_send_wr->status == IB_WC_SUCCESS) ? 1770 return (wr->status == IB_WC_SUCCESS) ? wr : NULL;
1738 mad_send_wr : NULL;
1739 }
1740 } 1771 }
1741 return NULL; 1772 return NULL;
1742} 1773}
diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h
index b4fa28d3160f..d147f3bad2ce 100644
--- a/drivers/infiniband/core/mad_priv.h
+++ b/drivers/infiniband/core/mad_priv.h
@@ -212,8 +212,6 @@ struct ib_mad_port_private {
212 struct ib_mad_qp_info qp_info[IB_MAD_QPS_CORE]; 212 struct ib_mad_qp_info qp_info[IB_MAD_QPS_CORE];
213}; 213};
214 214
215extern kmem_cache_t *ib_mad_cache;
216
217int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr); 215int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr);
218 216
219struct ib_mad_send_wr_private * 217struct ib_mad_send_wr_private *
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 501cc054cb3b..e911c99ff843 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -47,6 +47,7 @@
47 47
48#include <rdma/ib_pack.h> 48#include <rdma/ib_pack.h>
49#include <rdma/ib_sa.h> 49#include <rdma/ib_sa.h>
50#include <rdma/ib_cache.h>
50 51
51MODULE_AUTHOR("Roland Dreier"); 52MODULE_AUTHOR("Roland Dreier");
52MODULE_DESCRIPTION("InfiniBand subnet administration query support"); 53MODULE_DESCRIPTION("InfiniBand subnet administration query support");
@@ -441,6 +442,36 @@ void ib_sa_cancel_query(int id, struct ib_sa_query *query)
441} 442}
442EXPORT_SYMBOL(ib_sa_cancel_query); 443EXPORT_SYMBOL(ib_sa_cancel_query);
443 444
445int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
446 struct ib_sa_path_rec *rec, struct ib_ah_attr *ah_attr)
447{
448 int ret;
449 u16 gid_index;
450
451 memset(ah_attr, 0, sizeof *ah_attr);
452 ah_attr->dlid = be16_to_cpu(rec->dlid);
453 ah_attr->sl = rec->sl;
454 ah_attr->src_path_bits = be16_to_cpu(rec->slid) & 0x7f;
455 ah_attr->port_num = port_num;
456
457 if (rec->hop_limit > 1) {
458 ah_attr->ah_flags = IB_AH_GRH;
459 ah_attr->grh.dgid = rec->dgid;
460
461 ret = ib_find_cached_gid(device, &rec->sgid, &port_num,
462 &gid_index);
463 if (ret)
464 return ret;
465
466 ah_attr->grh.sgid_index = gid_index;
467 ah_attr->grh.flow_label = be32_to_cpu(rec->flow_label);
468 ah_attr->grh.hop_limit = rec->hop_limit;
469 ah_attr->grh.traffic_class = rec->traffic_class;
470 }
471 return 0;
472}
473EXPORT_SYMBOL(ib_init_ah_from_path);
474
444static void init_mad(struct ib_sa_mad *mad, struct ib_mad_agent *agent) 475static void init_mad(struct ib_sa_mad *mad, struct ib_mad_agent *agent)
445{ 476{
446 unsigned long flags; 477 unsigned long flags;
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index 9164a09b6ccd..c1c6fda9452c 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -30,7 +30,7 @@
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE. 31 * SOFTWARE.
32 * 32 *
33 * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $ 33 * $Id: ucm.c 4311 2005-12-05 18:42:01Z sean.hefty $
34 */ 34 */
35 35
36#include <linux/completion.h> 36#include <linux/completion.h>
@@ -50,6 +50,7 @@
50 50
51#include <rdma/ib_cm.h> 51#include <rdma/ib_cm.h>
52#include <rdma/ib_user_cm.h> 52#include <rdma/ib_user_cm.h>
53#include <rdma/ib_marshall.h>
53 54
54MODULE_AUTHOR("Libor Michalek"); 55MODULE_AUTHOR("Libor Michalek");
55MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access"); 56MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access");
@@ -63,7 +64,7 @@ struct ib_ucm_device {
63}; 64};
64 65
65struct ib_ucm_file { 66struct ib_ucm_file {
66 struct semaphore mutex; 67 struct mutex file_mutex;
67 struct file *filp; 68 struct file *filp;
68 struct ib_ucm_device *device; 69 struct ib_ucm_device *device;
69 70
@@ -152,7 +153,7 @@ static void ib_ucm_cleanup_events(struct ib_ucm_context *ctx)
152{ 153{
153 struct ib_ucm_event *uevent; 154 struct ib_ucm_event *uevent;
154 155
155 down(&ctx->file->mutex); 156 mutex_lock(&ctx->file->file_mutex);
156 list_del(&ctx->file_list); 157 list_del(&ctx->file_list);
157 while (!list_empty(&ctx->events)) { 158 while (!list_empty(&ctx->events)) {
158 159
@@ -167,7 +168,7 @@ static void ib_ucm_cleanup_events(struct ib_ucm_context *ctx)
167 168
168 kfree(uevent); 169 kfree(uevent);
169 } 170 }
170 up(&ctx->file->mutex); 171 mutex_unlock(&ctx->file->file_mutex);
171} 172}
172 173
173static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file) 174static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file)
@@ -205,36 +206,6 @@ error:
205 return NULL; 206 return NULL;
206} 207}
207 208
208static void ib_ucm_event_path_get(struct ib_ucm_path_rec *upath,
209 struct ib_sa_path_rec *kpath)
210{
211 if (!kpath || !upath)
212 return;
213
214 memcpy(upath->dgid, kpath->dgid.raw, sizeof *upath->dgid);
215 memcpy(upath->sgid, kpath->sgid.raw, sizeof *upath->sgid);
216
217 upath->dlid = kpath->dlid;
218 upath->slid = kpath->slid;
219 upath->raw_traffic = kpath->raw_traffic;
220 upath->flow_label = kpath->flow_label;
221 upath->hop_limit = kpath->hop_limit;
222 upath->traffic_class = kpath->traffic_class;
223 upath->reversible = kpath->reversible;
224 upath->numb_path = kpath->numb_path;
225 upath->pkey = kpath->pkey;
226 upath->sl = kpath->sl;
227 upath->mtu_selector = kpath->mtu_selector;
228 upath->mtu = kpath->mtu;
229 upath->rate_selector = kpath->rate_selector;
230 upath->rate = kpath->rate;
231 upath->packet_life_time = kpath->packet_life_time;
232 upath->preference = kpath->preference;
233
234 upath->packet_life_time_selector =
235 kpath->packet_life_time_selector;
236}
237
238static void ib_ucm_event_req_get(struct ib_ucm_req_event_resp *ureq, 209static void ib_ucm_event_req_get(struct ib_ucm_req_event_resp *ureq,
239 struct ib_cm_req_event_param *kreq) 210 struct ib_cm_req_event_param *kreq)
240{ 211{
@@ -253,8 +224,10 @@ static void ib_ucm_event_req_get(struct ib_ucm_req_event_resp *ureq,
253 ureq->srq = kreq->srq; 224 ureq->srq = kreq->srq;
254 ureq->port = kreq->port; 225 ureq->port = kreq->port;
255 226
256 ib_ucm_event_path_get(&ureq->primary_path, kreq->primary_path); 227 ib_copy_path_rec_to_user(&ureq->primary_path, kreq->primary_path);
257 ib_ucm_event_path_get(&ureq->alternate_path, kreq->alternate_path); 228 if (kreq->alternate_path)
229 ib_copy_path_rec_to_user(&ureq->alternate_path,
230 kreq->alternate_path);
258} 231}
259 232
260static void ib_ucm_event_rep_get(struct ib_ucm_rep_event_resp *urep, 233static void ib_ucm_event_rep_get(struct ib_ucm_rep_event_resp *urep,
@@ -324,8 +297,8 @@ static int ib_ucm_event_process(struct ib_cm_event *evt,
324 info = evt->param.rej_rcvd.ari; 297 info = evt->param.rej_rcvd.ari;
325 break; 298 break;
326 case IB_CM_LAP_RECEIVED: 299 case IB_CM_LAP_RECEIVED:
327 ib_ucm_event_path_get(&uvt->resp.u.lap_resp.path, 300 ib_copy_path_rec_to_user(&uvt->resp.u.lap_resp.path,
328 evt->param.lap_rcvd.alternate_path); 301 evt->param.lap_rcvd.alternate_path);
329 uvt->data_len = IB_CM_LAP_PRIVATE_DATA_SIZE; 302 uvt->data_len = IB_CM_LAP_PRIVATE_DATA_SIZE;
330 uvt->resp.present = IB_UCM_PRES_ALTERNATE; 303 uvt->resp.present = IB_UCM_PRES_ALTERNATE;
331 break; 304 break;
@@ -402,11 +375,11 @@ static int ib_ucm_event_handler(struct ib_cm_id *cm_id,
402 if (result) 375 if (result)
403 goto err2; 376 goto err2;
404 377
405 down(&ctx->file->mutex); 378 mutex_lock(&ctx->file->file_mutex);
406 list_add_tail(&uevent->file_list, &ctx->file->events); 379 list_add_tail(&uevent->file_list, &ctx->file->events);
407 list_add_tail(&uevent->ctx_list, &ctx->events); 380 list_add_tail(&uevent->ctx_list, &ctx->events);
408 wake_up_interruptible(&ctx->file->poll_wait); 381 wake_up_interruptible(&ctx->file->poll_wait);
409 up(&ctx->file->mutex); 382 mutex_unlock(&ctx->file->file_mutex);
410 return 0; 383 return 0;
411 384
412err2: 385err2:
@@ -432,7 +405,7 @@ static ssize_t ib_ucm_event(struct ib_ucm_file *file,
432 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) 405 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
433 return -EFAULT; 406 return -EFAULT;
434 407
435 down(&file->mutex); 408 mutex_lock(&file->file_mutex);
436 while (list_empty(&file->events)) { 409 while (list_empty(&file->events)) {
437 410
438 if (file->filp->f_flags & O_NONBLOCK) { 411 if (file->filp->f_flags & O_NONBLOCK) {
@@ -447,9 +420,9 @@ static ssize_t ib_ucm_event(struct ib_ucm_file *file,
447 420
448 prepare_to_wait(&file->poll_wait, &wait, TASK_INTERRUPTIBLE); 421 prepare_to_wait(&file->poll_wait, &wait, TASK_INTERRUPTIBLE);
449 422
450 up(&file->mutex); 423 mutex_unlock(&file->file_mutex);
451 schedule(); 424 schedule();
452 down(&file->mutex); 425 mutex_lock(&file->file_mutex);
453 426
454 finish_wait(&file->poll_wait, &wait); 427 finish_wait(&file->poll_wait, &wait);
455 } 428 }
@@ -509,7 +482,7 @@ static ssize_t ib_ucm_event(struct ib_ucm_file *file,
509 kfree(uevent->info); 482 kfree(uevent->info);
510 kfree(uevent); 483 kfree(uevent);
511done: 484done:
512 up(&file->mutex); 485 mutex_unlock(&file->file_mutex);
513 return result; 486 return result;
514} 487}
515 488
@@ -528,9 +501,9 @@ static ssize_t ib_ucm_create_id(struct ib_ucm_file *file,
528 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) 501 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
529 return -EFAULT; 502 return -EFAULT;
530 503
531 down(&file->mutex); 504 mutex_lock(&file->file_mutex);
532 ctx = ib_ucm_ctx_alloc(file); 505 ctx = ib_ucm_ctx_alloc(file);
533 up(&file->mutex); 506 mutex_unlock(&file->file_mutex);
534 if (!ctx) 507 if (!ctx)
535 return -ENOMEM; 508 return -ENOMEM;
536 509
@@ -637,65 +610,11 @@ static ssize_t ib_ucm_attr_id(struct ib_ucm_file *file,
637 return result; 610 return result;
638} 611}
639 612
640static void ib_ucm_copy_ah_attr(struct ib_ucm_ah_attr *dest_attr,
641 struct ib_ah_attr *src_attr)
642{
643 memcpy(dest_attr->grh_dgid, src_attr->grh.dgid.raw,
644 sizeof src_attr->grh.dgid);
645 dest_attr->grh_flow_label = src_attr->grh.flow_label;
646 dest_attr->grh_sgid_index = src_attr->grh.sgid_index;
647 dest_attr->grh_hop_limit = src_attr->grh.hop_limit;
648 dest_attr->grh_traffic_class = src_attr->grh.traffic_class;
649
650 dest_attr->dlid = src_attr->dlid;
651 dest_attr->sl = src_attr->sl;
652 dest_attr->src_path_bits = src_attr->src_path_bits;
653 dest_attr->static_rate = src_attr->static_rate;
654 dest_attr->is_global = (src_attr->ah_flags & IB_AH_GRH);
655 dest_attr->port_num = src_attr->port_num;
656}
657
658static void ib_ucm_copy_qp_attr(struct ib_ucm_init_qp_attr_resp *dest_attr,
659 struct ib_qp_attr *src_attr)
660{
661 dest_attr->cur_qp_state = src_attr->cur_qp_state;
662 dest_attr->path_mtu = src_attr->path_mtu;
663 dest_attr->path_mig_state = src_attr->path_mig_state;
664 dest_attr->qkey = src_attr->qkey;
665 dest_attr->rq_psn = src_attr->rq_psn;
666 dest_attr->sq_psn = src_attr->sq_psn;
667 dest_attr->dest_qp_num = src_attr->dest_qp_num;
668 dest_attr->qp_access_flags = src_attr->qp_access_flags;
669
670 dest_attr->max_send_wr = src_attr->cap.max_send_wr;
671 dest_attr->max_recv_wr = src_attr->cap.max_recv_wr;
672 dest_attr->max_send_sge = src_attr->cap.max_send_sge;
673 dest_attr->max_recv_sge = src_attr->cap.max_recv_sge;
674 dest_attr->max_inline_data = src_attr->cap.max_inline_data;
675
676 ib_ucm_copy_ah_attr(&dest_attr->ah_attr, &src_attr->ah_attr);
677 ib_ucm_copy_ah_attr(&dest_attr->alt_ah_attr, &src_attr->alt_ah_attr);
678
679 dest_attr->pkey_index = src_attr->pkey_index;
680 dest_attr->alt_pkey_index = src_attr->alt_pkey_index;
681 dest_attr->en_sqd_async_notify = src_attr->en_sqd_async_notify;
682 dest_attr->sq_draining = src_attr->sq_draining;
683 dest_attr->max_rd_atomic = src_attr->max_rd_atomic;
684 dest_attr->max_dest_rd_atomic = src_attr->max_dest_rd_atomic;
685 dest_attr->min_rnr_timer = src_attr->min_rnr_timer;
686 dest_attr->port_num = src_attr->port_num;
687 dest_attr->timeout = src_attr->timeout;
688 dest_attr->retry_cnt = src_attr->retry_cnt;
689 dest_attr->rnr_retry = src_attr->rnr_retry;
690 dest_attr->alt_port_num = src_attr->alt_port_num;
691 dest_attr->alt_timeout = src_attr->alt_timeout;
692}
693
694static ssize_t ib_ucm_init_qp_attr(struct ib_ucm_file *file, 613static ssize_t ib_ucm_init_qp_attr(struct ib_ucm_file *file,
695 const char __user *inbuf, 614 const char __user *inbuf,
696 int in_len, int out_len) 615 int in_len, int out_len)
697{ 616{
698 struct ib_ucm_init_qp_attr_resp resp; 617 struct ib_uverbs_qp_attr resp;
699 struct ib_ucm_init_qp_attr cmd; 618 struct ib_ucm_init_qp_attr cmd;
700 struct ib_ucm_context *ctx; 619 struct ib_ucm_context *ctx;
701 struct ib_qp_attr qp_attr; 620 struct ib_qp_attr qp_attr;
@@ -718,7 +637,7 @@ static ssize_t ib_ucm_init_qp_attr(struct ib_ucm_file *file,
718 if (result) 637 if (result)
719 goto out; 638 goto out;
720 639
721 ib_ucm_copy_qp_attr(&resp, &qp_attr); 640 ib_copy_qp_attr_to_user(&resp, &qp_attr);
722 641
723 if (copy_to_user((void __user *)(unsigned long)cmd.response, 642 if (copy_to_user((void __user *)(unsigned long)cmd.response,
724 &resp, sizeof(resp))) 643 &resp, sizeof(resp)))
@@ -729,6 +648,17 @@ out:
729 return result; 648 return result;
730} 649}
731 650
651static int ucm_validate_listen(__be64 service_id, __be64 service_mask)
652{
653 service_id &= service_mask;
654
655 if (((service_id & IB_CMA_SERVICE_ID_MASK) == IB_CMA_SERVICE_ID) ||
656 ((service_id & IB_SDP_SERVICE_ID_MASK) == IB_SDP_SERVICE_ID))
657 return -EINVAL;
658
659 return 0;
660}
661
732static ssize_t ib_ucm_listen(struct ib_ucm_file *file, 662static ssize_t ib_ucm_listen(struct ib_ucm_file *file,
733 const char __user *inbuf, 663 const char __user *inbuf,
734 int in_len, int out_len) 664 int in_len, int out_len)
@@ -744,7 +674,13 @@ static ssize_t ib_ucm_listen(struct ib_ucm_file *file,
744 if (IS_ERR(ctx)) 674 if (IS_ERR(ctx))
745 return PTR_ERR(ctx); 675 return PTR_ERR(ctx);
746 676
747 result = ib_cm_listen(ctx->cm_id, cmd.service_id, cmd.service_mask); 677 result = ucm_validate_listen(cmd.service_id, cmd.service_mask);
678 if (result)
679 goto out;
680
681 result = ib_cm_listen(ctx->cm_id, cmd.service_id, cmd.service_mask,
682 NULL);
683out:
748 ib_ucm_ctx_put(ctx); 684 ib_ucm_ctx_put(ctx);
749 return result; 685 return result;
750} 686}
@@ -793,7 +729,7 @@ static int ib_ucm_alloc_data(const void **dest, u64 src, u32 len)
793 729
794static int ib_ucm_path_get(struct ib_sa_path_rec **path, u64 src) 730static int ib_ucm_path_get(struct ib_sa_path_rec **path, u64 src)
795{ 731{
796 struct ib_ucm_path_rec ucm_path; 732 struct ib_user_path_rec upath;
797 struct ib_sa_path_rec *sa_path; 733 struct ib_sa_path_rec *sa_path;
798 734
799 *path = NULL; 735 *path = NULL;
@@ -805,36 +741,14 @@ static int ib_ucm_path_get(struct ib_sa_path_rec **path, u64 src)
805 if (!sa_path) 741 if (!sa_path)
806 return -ENOMEM; 742 return -ENOMEM;
807 743
808 if (copy_from_user(&ucm_path, (void __user *)(unsigned long)src, 744 if (copy_from_user(&upath, (void __user *)(unsigned long)src,
809 sizeof(ucm_path))) { 745 sizeof(upath))) {
810 746
811 kfree(sa_path); 747 kfree(sa_path);
812 return -EFAULT; 748 return -EFAULT;
813 } 749 }
814 750
815 memcpy(sa_path->dgid.raw, ucm_path.dgid, sizeof sa_path->dgid); 751 ib_copy_path_rec_from_user(sa_path, &upath);
816 memcpy(sa_path->sgid.raw, ucm_path.sgid, sizeof sa_path->sgid);
817
818 sa_path->dlid = ucm_path.dlid;
819 sa_path->slid = ucm_path.slid;
820 sa_path->raw_traffic = ucm_path.raw_traffic;
821 sa_path->flow_label = ucm_path.flow_label;
822 sa_path->hop_limit = ucm_path.hop_limit;
823 sa_path->traffic_class = ucm_path.traffic_class;
824 sa_path->reversible = ucm_path.reversible;
825 sa_path->numb_path = ucm_path.numb_path;
826 sa_path->pkey = ucm_path.pkey;
827 sa_path->sl = ucm_path.sl;
828 sa_path->mtu_selector = ucm_path.mtu_selector;
829 sa_path->mtu = ucm_path.mtu;
830 sa_path->rate_selector = ucm_path.rate_selector;
831 sa_path->rate = ucm_path.rate;
832 sa_path->packet_life_time = ucm_path.packet_life_time;
833 sa_path->preference = ucm_path.preference;
834
835 sa_path->packet_life_time_selector =
836 ucm_path.packet_life_time_selector;
837
838 *path = sa_path; 752 *path = sa_path;
839 return 0; 753 return 0;
840} 754}
@@ -1130,7 +1044,6 @@ static ssize_t ib_ucm_send_sidr_req(struct ib_ucm_file *file,
1130 param.service_id = cmd.sid; 1044 param.service_id = cmd.sid;
1131 param.timeout_ms = cmd.timeout; 1045 param.timeout_ms = cmd.timeout;
1132 param.max_cm_retries = cmd.max_cm_retries; 1046 param.max_cm_retries = cmd.max_cm_retries;
1133 param.pkey = cmd.pkey;
1134 1047
1135 ctx = ib_ucm_ctx_get(file, cmd.id); 1048 ctx = ib_ucm_ctx_get(file, cmd.id);
1136 if (!IS_ERR(ctx)) { 1049 if (!IS_ERR(ctx)) {
@@ -1263,7 +1176,7 @@ static int ib_ucm_open(struct inode *inode, struct file *filp)
1263 INIT_LIST_HEAD(&file->ctxs); 1176 INIT_LIST_HEAD(&file->ctxs);
1264 init_waitqueue_head(&file->poll_wait); 1177 init_waitqueue_head(&file->poll_wait);
1265 1178
1266 init_MUTEX(&file->mutex); 1179 mutex_init(&file->file_mutex);
1267 1180
1268 filp->private_data = file; 1181 filp->private_data = file;
1269 file->filp = filp; 1182 file->filp = filp;
@@ -1277,11 +1190,11 @@ static int ib_ucm_close(struct inode *inode, struct file *filp)
1277 struct ib_ucm_file *file = filp->private_data; 1190 struct ib_ucm_file *file = filp->private_data;
1278 struct ib_ucm_context *ctx; 1191 struct ib_ucm_context *ctx;
1279 1192
1280 down(&file->mutex); 1193 mutex_lock(&file->file_mutex);
1281 while (!list_empty(&file->ctxs)) { 1194 while (!list_empty(&file->ctxs)) {
1282 ctx = list_entry(file->ctxs.next, 1195 ctx = list_entry(file->ctxs.next,
1283 struct ib_ucm_context, file_list); 1196 struct ib_ucm_context, file_list);
1284 up(&file->mutex); 1197 mutex_unlock(&file->file_mutex);
1285 1198
1286 mutex_lock(&ctx_id_mutex); 1199 mutex_lock(&ctx_id_mutex);
1287 idr_remove(&ctx_id_table, ctx->id); 1200 idr_remove(&ctx_id_table, ctx->id);
@@ -1291,9 +1204,9 @@ static int ib_ucm_close(struct inode *inode, struct file *filp)
1291 ib_ucm_cleanup_events(ctx); 1204 ib_ucm_cleanup_events(ctx);
1292 kfree(ctx); 1205 kfree(ctx);
1293 1206
1294 down(&file->mutex); 1207 mutex_lock(&file->file_mutex);
1295 } 1208 }
1296 up(&file->mutex); 1209 mutex_unlock(&file->file_mutex);
1297 kfree(file); 1210 kfree(file);
1298 return 0; 1211 return 0;
1299} 1212}
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index 3372d67ff139..bb9bee56a824 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -132,7 +132,7 @@ struct ib_ucq_object {
132 u32 async_events_reported; 132 u32 async_events_reported;
133}; 133};
134 134
135extern struct mutex ib_uverbs_idr_mutex; 135extern spinlock_t ib_uverbs_idr_lock;
136extern struct idr ib_uverbs_pd_idr; 136extern struct idr ib_uverbs_pd_idr;
137extern struct idr ib_uverbs_mr_idr; 137extern struct idr ib_uverbs_mr_idr;
138extern struct idr ib_uverbs_mw_idr; 138extern struct idr ib_uverbs_mw_idr;
@@ -141,6 +141,8 @@ extern struct idr ib_uverbs_cq_idr;
141extern struct idr ib_uverbs_qp_idr; 141extern struct idr ib_uverbs_qp_idr;
142extern struct idr ib_uverbs_srq_idr; 142extern struct idr ib_uverbs_srq_idr;
143 143
144void idr_remove_uobj(struct idr *idp, struct ib_uobject *uobj);
145
144struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file, 146struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
145 int is_async, int *fd); 147 int is_async, int *fd);
146void ib_uverbs_release_event_file(struct kref *ref); 148void ib_uverbs_release_event_file(struct kref *ref);
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 9f69bd48eb1b..76bf61e9b552 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -50,6 +50,196 @@
50 (udata)->outlen = (olen); \ 50 (udata)->outlen = (olen); \
51 } while (0) 51 } while (0)
52 52
53/*
54 * The ib_uobject locking scheme is as follows:
55 *
56 * - ib_uverbs_idr_lock protects the uverbs idrs themselves, so it
57 * needs to be held during all idr operations. When an object is
58 * looked up, a reference must be taken on the object's kref before
59 * dropping this lock.
60 *
61 * - Each object also has an rwsem. This rwsem must be held for
62 * reading while an operation that uses the object is performed.
63 * For example, while registering an MR, the associated PD's
64 * uobject.mutex must be held for reading. The rwsem must be held
65 * for writing while initializing or destroying an object.
66 *
67 * - In addition, each object has a "live" flag. If this flag is not
68 * set, then lookups of the object will fail even if it is found in
69 * the idr. This handles a reader that blocks and does not acquire
70 * the rwsem until after the object is destroyed. The destroy
71 * operation will set the live flag to 0 and then drop the rwsem;
72 * this will allow the reader to acquire the rwsem, see that the
73 * live flag is 0, and then drop the rwsem and its reference to
74 * object. The underlying storage will not be freed until the last
75 * reference to the object is dropped.
76 */
77
78static void init_uobj(struct ib_uobject *uobj, u64 user_handle,
79 struct ib_ucontext *context)
80{
81 uobj->user_handle = user_handle;
82 uobj->context = context;
83 kref_init(&uobj->ref);
84 init_rwsem(&uobj->mutex);
85 uobj->live = 0;
86}
87
88static void release_uobj(struct kref *kref)
89{
90 kfree(container_of(kref, struct ib_uobject, ref));
91}
92
93static void put_uobj(struct ib_uobject *uobj)
94{
95 kref_put(&uobj->ref, release_uobj);
96}
97
98static void put_uobj_read(struct ib_uobject *uobj)
99{
100 up_read(&uobj->mutex);
101 put_uobj(uobj);
102}
103
104static void put_uobj_write(struct ib_uobject *uobj)
105{
106 up_write(&uobj->mutex);
107 put_uobj(uobj);
108}
109
110static int idr_add_uobj(struct idr *idr, struct ib_uobject *uobj)
111{
112 int ret;
113
114retry:
115 if (!idr_pre_get(idr, GFP_KERNEL))
116 return -ENOMEM;
117
118 spin_lock(&ib_uverbs_idr_lock);
119 ret = idr_get_new(idr, uobj, &uobj->id);
120 spin_unlock(&ib_uverbs_idr_lock);
121
122 if (ret == -EAGAIN)
123 goto retry;
124
125 return ret;
126}
127
128void idr_remove_uobj(struct idr *idr, struct ib_uobject *uobj)
129{
130 spin_lock(&ib_uverbs_idr_lock);
131 idr_remove(idr, uobj->id);
132 spin_unlock(&ib_uverbs_idr_lock);
133}
134
135static struct ib_uobject *__idr_get_uobj(struct idr *idr, int id,
136 struct ib_ucontext *context)
137{
138 struct ib_uobject *uobj;
139
140 spin_lock(&ib_uverbs_idr_lock);
141 uobj = idr_find(idr, id);
142 if (uobj)
143 kref_get(&uobj->ref);
144 spin_unlock(&ib_uverbs_idr_lock);
145
146 return uobj;
147}
148
149static struct ib_uobject *idr_read_uobj(struct idr *idr, int id,
150 struct ib_ucontext *context)
151{
152 struct ib_uobject *uobj;
153
154 uobj = __idr_get_uobj(idr, id, context);
155 if (!uobj)
156 return NULL;
157
158 down_read(&uobj->mutex);
159 if (!uobj->live) {
160 put_uobj_read(uobj);
161 return NULL;
162 }
163
164 return uobj;
165}
166
167static struct ib_uobject *idr_write_uobj(struct idr *idr, int id,
168 struct ib_ucontext *context)
169{
170 struct ib_uobject *uobj;
171
172 uobj = __idr_get_uobj(idr, id, context);
173 if (!uobj)
174 return NULL;
175
176 down_write(&uobj->mutex);
177 if (!uobj->live) {
178 put_uobj_write(uobj);
179 return NULL;
180 }
181
182 return uobj;
183}
184
185static void *idr_read_obj(struct idr *idr, int id, struct ib_ucontext *context)
186{
187 struct ib_uobject *uobj;
188
189 uobj = idr_read_uobj(idr, id, context);
190 return uobj ? uobj->object : NULL;
191}
192
193static struct ib_pd *idr_read_pd(int pd_handle, struct ib_ucontext *context)
194{
195 return idr_read_obj(&ib_uverbs_pd_idr, pd_handle, context);
196}
197
198static void put_pd_read(struct ib_pd *pd)
199{
200 put_uobj_read(pd->uobject);
201}
202
203static struct ib_cq *idr_read_cq(int cq_handle, struct ib_ucontext *context)
204{
205 return idr_read_obj(&ib_uverbs_cq_idr, cq_handle, context);
206}
207
208static void put_cq_read(struct ib_cq *cq)
209{
210 put_uobj_read(cq->uobject);
211}
212
213static struct ib_ah *idr_read_ah(int ah_handle, struct ib_ucontext *context)
214{
215 return idr_read_obj(&ib_uverbs_ah_idr, ah_handle, context);
216}
217
218static void put_ah_read(struct ib_ah *ah)
219{
220 put_uobj_read(ah->uobject);
221}
222
223static struct ib_qp *idr_read_qp(int qp_handle, struct ib_ucontext *context)
224{
225 return idr_read_obj(&ib_uverbs_qp_idr, qp_handle, context);
226}
227
228static void put_qp_read(struct ib_qp *qp)
229{
230 put_uobj_read(qp->uobject);
231}
232
233static struct ib_srq *idr_read_srq(int srq_handle, struct ib_ucontext *context)
234{
235 return idr_read_obj(&ib_uverbs_srq_idr, srq_handle, context);
236}
237
238static void put_srq_read(struct ib_srq *srq)
239{
240 put_uobj_read(srq->uobject);
241}
242
53ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, 243ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file,
54 const char __user *buf, 244 const char __user *buf,
55 int in_len, int out_len) 245 int in_len, int out_len)
@@ -80,8 +270,10 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file,
80 in_len - sizeof cmd, out_len - sizeof resp); 270 in_len - sizeof cmd, out_len - sizeof resp);
81 271
82 ucontext = ibdev->alloc_ucontext(ibdev, &udata); 272 ucontext = ibdev->alloc_ucontext(ibdev, &udata);
83 if (IS_ERR(ucontext)) 273 if (IS_ERR(ucontext)) {
84 return PTR_ERR(file->ucontext); 274 ret = PTR_ERR(file->ucontext);
275 goto err;
276 }
85 277
86 ucontext->device = ibdev; 278 ucontext->device = ibdev;
87 INIT_LIST_HEAD(&ucontext->pd_list); 279 INIT_LIST_HEAD(&ucontext->pd_list);
@@ -278,7 +470,8 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file,
278 if (!uobj) 470 if (!uobj)
279 return -ENOMEM; 471 return -ENOMEM;
280 472
281 uobj->context = file->ucontext; 473 init_uobj(uobj, 0, file->ucontext);
474 down_write(&uobj->mutex);
282 475
283 pd = file->device->ib_dev->alloc_pd(file->device->ib_dev, 476 pd = file->device->ib_dev->alloc_pd(file->device->ib_dev,
284 file->ucontext, &udata); 477 file->ucontext, &udata);
@@ -291,20 +484,10 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file,
291 pd->uobject = uobj; 484 pd->uobject = uobj;
292 atomic_set(&pd->usecnt, 0); 485 atomic_set(&pd->usecnt, 0);
293 486
294 mutex_lock(&ib_uverbs_idr_mutex); 487 uobj->object = pd;
295 488 ret = idr_add_uobj(&ib_uverbs_pd_idr, uobj);
296retry:
297 if (!idr_pre_get(&ib_uverbs_pd_idr, GFP_KERNEL)) {
298 ret = -ENOMEM;
299 goto err_up;
300 }
301
302 ret = idr_get_new(&ib_uverbs_pd_idr, pd, &uobj->id);
303
304 if (ret == -EAGAIN)
305 goto retry;
306 if (ret) 489 if (ret)
307 goto err_up; 490 goto err_idr;
308 491
309 memset(&resp, 0, sizeof resp); 492 memset(&resp, 0, sizeof resp);
310 resp.pd_handle = uobj->id; 493 resp.pd_handle = uobj->id;
@@ -312,26 +495,27 @@ retry:
312 if (copy_to_user((void __user *) (unsigned long) cmd.response, 495 if (copy_to_user((void __user *) (unsigned long) cmd.response,
313 &resp, sizeof resp)) { 496 &resp, sizeof resp)) {
314 ret = -EFAULT; 497 ret = -EFAULT;
315 goto err_idr; 498 goto err_copy;
316 } 499 }
317 500
318 mutex_lock(&file->mutex); 501 mutex_lock(&file->mutex);
319 list_add_tail(&uobj->list, &file->ucontext->pd_list); 502 list_add_tail(&uobj->list, &file->ucontext->pd_list);
320 mutex_unlock(&file->mutex); 503 mutex_unlock(&file->mutex);
321 504
322 mutex_unlock(&ib_uverbs_idr_mutex); 505 uobj->live = 1;
506
507 up_write(&uobj->mutex);
323 508
324 return in_len; 509 return in_len;
325 510
326err_idr: 511err_copy:
327 idr_remove(&ib_uverbs_pd_idr, uobj->id); 512 idr_remove_uobj(&ib_uverbs_pd_idr, uobj);
328 513
329err_up: 514err_idr:
330 mutex_unlock(&ib_uverbs_idr_mutex);
331 ib_dealloc_pd(pd); 515 ib_dealloc_pd(pd);
332 516
333err: 517err:
334 kfree(uobj); 518 put_uobj_write(uobj);
335 return ret; 519 return ret;
336} 520}
337 521
@@ -340,37 +524,34 @@ ssize_t ib_uverbs_dealloc_pd(struct ib_uverbs_file *file,
340 int in_len, int out_len) 524 int in_len, int out_len)
341{ 525{
342 struct ib_uverbs_dealloc_pd cmd; 526 struct ib_uverbs_dealloc_pd cmd;
343 struct ib_pd *pd;
344 struct ib_uobject *uobj; 527 struct ib_uobject *uobj;
345 int ret = -EINVAL; 528 int ret;
346 529
347 if (copy_from_user(&cmd, buf, sizeof cmd)) 530 if (copy_from_user(&cmd, buf, sizeof cmd))
348 return -EFAULT; 531 return -EFAULT;
349 532
350 mutex_lock(&ib_uverbs_idr_mutex); 533 uobj = idr_write_uobj(&ib_uverbs_pd_idr, cmd.pd_handle, file->ucontext);
534 if (!uobj)
535 return -EINVAL;
351 536
352 pd = idr_find(&ib_uverbs_pd_idr, cmd.pd_handle); 537 ret = ib_dealloc_pd(uobj->object);
353 if (!pd || pd->uobject->context != file->ucontext) 538 if (!ret)
354 goto out; 539 uobj->live = 0;
355 540
356 uobj = pd->uobject; 541 put_uobj_write(uobj);
357 542
358 ret = ib_dealloc_pd(pd);
359 if (ret) 543 if (ret)
360 goto out; 544 return ret;
361 545
362 idr_remove(&ib_uverbs_pd_idr, cmd.pd_handle); 546 idr_remove_uobj(&ib_uverbs_pd_idr, uobj);
363 547
364 mutex_lock(&file->mutex); 548 mutex_lock(&file->mutex);
365 list_del(&uobj->list); 549 list_del(&uobj->list);
366 mutex_unlock(&file->mutex); 550 mutex_unlock(&file->mutex);
367 551
368 kfree(uobj); 552 put_uobj(uobj);
369
370out:
371 mutex_unlock(&ib_uverbs_idr_mutex);
372 553
373 return ret ? ret : in_len; 554 return in_len;
374} 555}
375 556
376ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, 557ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
@@ -410,7 +591,8 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
410 if (!obj) 591 if (!obj)
411 return -ENOMEM; 592 return -ENOMEM;
412 593
413 obj->uobject.context = file->ucontext; 594 init_uobj(&obj->uobject, 0, file->ucontext);
595 down_write(&obj->uobject.mutex);
414 596
415 /* 597 /*
416 * We ask for writable memory if any access flags other than 598 * We ask for writable memory if any access flags other than
@@ -427,23 +609,14 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
427 609
428 obj->umem.virt_base = cmd.hca_va; 610 obj->umem.virt_base = cmd.hca_va;
429 611
430 mutex_lock(&ib_uverbs_idr_mutex); 612 pd = idr_read_pd(cmd.pd_handle, file->ucontext);
431 613 if (!pd)
432 pd = idr_find(&ib_uverbs_pd_idr, cmd.pd_handle); 614 goto err_release;
433 if (!pd || pd->uobject->context != file->ucontext) {
434 ret = -EINVAL;
435 goto err_up;
436 }
437
438 if (!pd->device->reg_user_mr) {
439 ret = -ENOSYS;
440 goto err_up;
441 }
442 615
443 mr = pd->device->reg_user_mr(pd, &obj->umem, cmd.access_flags, &udata); 616 mr = pd->device->reg_user_mr(pd, &obj->umem, cmd.access_flags, &udata);
444 if (IS_ERR(mr)) { 617 if (IS_ERR(mr)) {
445 ret = PTR_ERR(mr); 618 ret = PTR_ERR(mr);
446 goto err_up; 619 goto err_put;
447 } 620 }
448 621
449 mr->device = pd->device; 622 mr->device = pd->device;
@@ -452,53 +625,48 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
452 atomic_inc(&pd->usecnt); 625 atomic_inc(&pd->usecnt);
453 atomic_set(&mr->usecnt, 0); 626 atomic_set(&mr->usecnt, 0);
454 627
455 memset(&resp, 0, sizeof resp); 628 obj->uobject.object = mr;
456 resp.lkey = mr->lkey; 629 ret = idr_add_uobj(&ib_uverbs_mr_idr, &obj->uobject);
457 resp.rkey = mr->rkey;
458
459retry:
460 if (!idr_pre_get(&ib_uverbs_mr_idr, GFP_KERNEL)) {
461 ret = -ENOMEM;
462 goto err_unreg;
463 }
464
465 ret = idr_get_new(&ib_uverbs_mr_idr, mr, &obj->uobject.id);
466
467 if (ret == -EAGAIN)
468 goto retry;
469 if (ret) 630 if (ret)
470 goto err_unreg; 631 goto err_unreg;
471 632
633 memset(&resp, 0, sizeof resp);
634 resp.lkey = mr->lkey;
635 resp.rkey = mr->rkey;
472 resp.mr_handle = obj->uobject.id; 636 resp.mr_handle = obj->uobject.id;
473 637
474 if (copy_to_user((void __user *) (unsigned long) cmd.response, 638 if (copy_to_user((void __user *) (unsigned long) cmd.response,
475 &resp, sizeof resp)) { 639 &resp, sizeof resp)) {
476 ret = -EFAULT; 640 ret = -EFAULT;
477 goto err_idr; 641 goto err_copy;
478 } 642 }
479 643
644 put_pd_read(pd);
645
480 mutex_lock(&file->mutex); 646 mutex_lock(&file->mutex);
481 list_add_tail(&obj->uobject.list, &file->ucontext->mr_list); 647 list_add_tail(&obj->uobject.list, &file->ucontext->mr_list);
482 mutex_unlock(&file->mutex); 648 mutex_unlock(&file->mutex);
483 649
484 mutex_unlock(&ib_uverbs_idr_mutex); 650 obj->uobject.live = 1;
651
652 up_write(&obj->uobject.mutex);
485 653
486 return in_len; 654 return in_len;
487 655
488err_idr: 656err_copy:
489 idr_remove(&ib_uverbs_mr_idr, obj->uobject.id); 657 idr_remove_uobj(&ib_uverbs_mr_idr, &obj->uobject);
490 658
491err_unreg: 659err_unreg:
492 ib_dereg_mr(mr); 660 ib_dereg_mr(mr);
493 atomic_dec(&pd->usecnt);
494 661
495err_up: 662err_put:
496 mutex_unlock(&ib_uverbs_idr_mutex); 663 put_pd_read(pd);
497 664
665err_release:
498 ib_umem_release(file->device->ib_dev, &obj->umem); 666 ib_umem_release(file->device->ib_dev, &obj->umem);
499 667
500err_free: 668err_free:
501 kfree(obj); 669 put_uobj_write(&obj->uobject);
502 return ret; 670 return ret;
503} 671}
504 672
@@ -508,37 +676,40 @@ ssize_t ib_uverbs_dereg_mr(struct ib_uverbs_file *file,
508{ 676{
509 struct ib_uverbs_dereg_mr cmd; 677 struct ib_uverbs_dereg_mr cmd;
510 struct ib_mr *mr; 678 struct ib_mr *mr;
679 struct ib_uobject *uobj;
511 struct ib_umem_object *memobj; 680 struct ib_umem_object *memobj;
512 int ret = -EINVAL; 681 int ret = -EINVAL;
513 682
514 if (copy_from_user(&cmd, buf, sizeof cmd)) 683 if (copy_from_user(&cmd, buf, sizeof cmd))
515 return -EFAULT; 684 return -EFAULT;
516 685
517 mutex_lock(&ib_uverbs_idr_mutex); 686 uobj = idr_write_uobj(&ib_uverbs_mr_idr, cmd.mr_handle, file->ucontext);
518 687 if (!uobj)
519 mr = idr_find(&ib_uverbs_mr_idr, cmd.mr_handle); 688 return -EINVAL;
520 if (!mr || mr->uobject->context != file->ucontext)
521 goto out;
522 689
523 memobj = container_of(mr->uobject, struct ib_umem_object, uobject); 690 memobj = container_of(uobj, struct ib_umem_object, uobject);
691 mr = uobj->object;
524 692
525 ret = ib_dereg_mr(mr); 693 ret = ib_dereg_mr(mr);
694 if (!ret)
695 uobj->live = 0;
696
697 put_uobj_write(uobj);
698
526 if (ret) 699 if (ret)
527 goto out; 700 return ret;
528 701
529 idr_remove(&ib_uverbs_mr_idr, cmd.mr_handle); 702 idr_remove_uobj(&ib_uverbs_mr_idr, uobj);
530 703
531 mutex_lock(&file->mutex); 704 mutex_lock(&file->mutex);
532 list_del(&memobj->uobject.list); 705 list_del(&uobj->list);
533 mutex_unlock(&file->mutex); 706 mutex_unlock(&file->mutex);
534 707
535 ib_umem_release(file->device->ib_dev, &memobj->umem); 708 ib_umem_release(file->device->ib_dev, &memobj->umem);
536 kfree(memobj);
537 709
538out: 710 put_uobj(uobj);
539 mutex_unlock(&ib_uverbs_idr_mutex);
540 711
541 return ret ? ret : in_len; 712 return in_len;
542} 713}
543 714
544ssize_t ib_uverbs_create_comp_channel(struct ib_uverbs_file *file, 715ssize_t ib_uverbs_create_comp_channel(struct ib_uverbs_file *file,
@@ -577,7 +748,7 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
577 struct ib_uverbs_create_cq cmd; 748 struct ib_uverbs_create_cq cmd;
578 struct ib_uverbs_create_cq_resp resp; 749 struct ib_uverbs_create_cq_resp resp;
579 struct ib_udata udata; 750 struct ib_udata udata;
580 struct ib_ucq_object *uobj; 751 struct ib_ucq_object *obj;
581 struct ib_uverbs_event_file *ev_file = NULL; 752 struct ib_uverbs_event_file *ev_file = NULL;
582 struct ib_cq *cq; 753 struct ib_cq *cq;
583 int ret; 754 int ret;
@@ -595,10 +766,13 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
595 if (cmd.comp_vector >= file->device->num_comp_vectors) 766 if (cmd.comp_vector >= file->device->num_comp_vectors)
596 return -EINVAL; 767 return -EINVAL;
597 768
598 uobj = kmalloc(sizeof *uobj, GFP_KERNEL); 769 obj = kmalloc(sizeof *obj, GFP_KERNEL);
599 if (!uobj) 770 if (!obj)
600 return -ENOMEM; 771 return -ENOMEM;
601 772
773 init_uobj(&obj->uobject, cmd.user_handle, file->ucontext);
774 down_write(&obj->uobject.mutex);
775
602 if (cmd.comp_channel >= 0) { 776 if (cmd.comp_channel >= 0) {
603 ev_file = ib_uverbs_lookup_comp_file(cmd.comp_channel); 777 ev_file = ib_uverbs_lookup_comp_file(cmd.comp_channel);
604 if (!ev_file) { 778 if (!ev_file) {
@@ -607,72 +781,64 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
607 } 781 }
608 } 782 }
609 783
610 uobj->uobject.user_handle = cmd.user_handle; 784 obj->uverbs_file = file;
611 uobj->uobject.context = file->ucontext; 785 obj->comp_events_reported = 0;
612 uobj->uverbs_file = file; 786 obj->async_events_reported = 0;
613 uobj->comp_events_reported = 0; 787 INIT_LIST_HEAD(&obj->comp_list);
614 uobj->async_events_reported = 0; 788 INIT_LIST_HEAD(&obj->async_list);
615 INIT_LIST_HEAD(&uobj->comp_list);
616 INIT_LIST_HEAD(&uobj->async_list);
617 789
618 cq = file->device->ib_dev->create_cq(file->device->ib_dev, cmd.cqe, 790 cq = file->device->ib_dev->create_cq(file->device->ib_dev, cmd.cqe,
619 file->ucontext, &udata); 791 file->ucontext, &udata);
620 if (IS_ERR(cq)) { 792 if (IS_ERR(cq)) {
621 ret = PTR_ERR(cq); 793 ret = PTR_ERR(cq);
622 goto err; 794 goto err_file;
623 } 795 }
624 796
625 cq->device = file->device->ib_dev; 797 cq->device = file->device->ib_dev;
626 cq->uobject = &uobj->uobject; 798 cq->uobject = &obj->uobject;
627 cq->comp_handler = ib_uverbs_comp_handler; 799 cq->comp_handler = ib_uverbs_comp_handler;
628 cq->event_handler = ib_uverbs_cq_event_handler; 800 cq->event_handler = ib_uverbs_cq_event_handler;
629 cq->cq_context = ev_file; 801 cq->cq_context = ev_file;
630 atomic_set(&cq->usecnt, 0); 802 atomic_set(&cq->usecnt, 0);
631 803
632 mutex_lock(&ib_uverbs_idr_mutex); 804 obj->uobject.object = cq;
633 805 ret = idr_add_uobj(&ib_uverbs_cq_idr, &obj->uobject);
634retry:
635 if (!idr_pre_get(&ib_uverbs_cq_idr, GFP_KERNEL)) {
636 ret = -ENOMEM;
637 goto err_up;
638 }
639
640 ret = idr_get_new(&ib_uverbs_cq_idr, cq, &uobj->uobject.id);
641
642 if (ret == -EAGAIN)
643 goto retry;
644 if (ret) 806 if (ret)
645 goto err_up; 807 goto err_free;
646 808
647 memset(&resp, 0, sizeof resp); 809 memset(&resp, 0, sizeof resp);
648 resp.cq_handle = uobj->uobject.id; 810 resp.cq_handle = obj->uobject.id;
649 resp.cqe = cq->cqe; 811 resp.cqe = cq->cqe;
650 812
651 if (copy_to_user((void __user *) (unsigned long) cmd.response, 813 if (copy_to_user((void __user *) (unsigned long) cmd.response,
652 &resp, sizeof resp)) { 814 &resp, sizeof resp)) {
653 ret = -EFAULT; 815 ret = -EFAULT;
654 goto err_idr; 816 goto err_copy;
655 } 817 }
656 818
657 mutex_lock(&file->mutex); 819 mutex_lock(&file->mutex);
658 list_add_tail(&uobj->uobject.list, &file->ucontext->cq_list); 820 list_add_tail(&obj->uobject.list, &file->ucontext->cq_list);
659 mutex_unlock(&file->mutex); 821 mutex_unlock(&file->mutex);
660 822
661 mutex_unlock(&ib_uverbs_idr_mutex); 823 obj->uobject.live = 1;
824
825 up_write(&obj->uobject.mutex);
662 826
663 return in_len; 827 return in_len;
664 828
665err_idr: 829err_copy:
666 idr_remove(&ib_uverbs_cq_idr, uobj->uobject.id); 830 idr_remove_uobj(&ib_uverbs_cq_idr, &obj->uobject);
831
667 832
668err_up: 833err_free:
669 mutex_unlock(&ib_uverbs_idr_mutex);
670 ib_destroy_cq(cq); 834 ib_destroy_cq(cq);
671 835
672err: 836err_file:
673 if (ev_file) 837 if (ev_file)
674 ib_uverbs_release_ucq(file, ev_file, uobj); 838 ib_uverbs_release_ucq(file, ev_file, obj);
675 kfree(uobj); 839
840err:
841 put_uobj_write(&obj->uobject);
676 return ret; 842 return ret;
677} 843}
678 844
@@ -693,11 +859,9 @@ ssize_t ib_uverbs_resize_cq(struct ib_uverbs_file *file,
693 (unsigned long) cmd.response + sizeof resp, 859 (unsigned long) cmd.response + sizeof resp,
694 in_len - sizeof cmd, out_len - sizeof resp); 860 in_len - sizeof cmd, out_len - sizeof resp);
695 861
696 mutex_lock(&ib_uverbs_idr_mutex); 862 cq = idr_read_cq(cmd.cq_handle, file->ucontext);
697 863 if (!cq)
698 cq = idr_find(&ib_uverbs_cq_idr, cmd.cq_handle); 864 return -EINVAL;
699 if (!cq || cq->uobject->context != file->ucontext || !cq->device->resize_cq)
700 goto out;
701 865
702 ret = cq->device->resize_cq(cq, cmd.cqe, &udata); 866 ret = cq->device->resize_cq(cq, cmd.cqe, &udata);
703 if (ret) 867 if (ret)
@@ -711,7 +875,7 @@ ssize_t ib_uverbs_resize_cq(struct ib_uverbs_file *file,
711 ret = -EFAULT; 875 ret = -EFAULT;
712 876
713out: 877out:
714 mutex_unlock(&ib_uverbs_idr_mutex); 878 put_cq_read(cq);
715 879
716 return ret ? ret : in_len; 880 return ret ? ret : in_len;
717} 881}
@@ -722,6 +886,7 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,
722{ 886{
723 struct ib_uverbs_poll_cq cmd; 887 struct ib_uverbs_poll_cq cmd;
724 struct ib_uverbs_poll_cq_resp *resp; 888 struct ib_uverbs_poll_cq_resp *resp;
889 struct ib_uobject *uobj;
725 struct ib_cq *cq; 890 struct ib_cq *cq;
726 struct ib_wc *wc; 891 struct ib_wc *wc;
727 int ret = 0; 892 int ret = 0;
@@ -742,15 +907,17 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,
742 goto out_wc; 907 goto out_wc;
743 } 908 }
744 909
745 mutex_lock(&ib_uverbs_idr_mutex); 910 uobj = idr_read_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext);
746 cq = idr_find(&ib_uverbs_cq_idr, cmd.cq_handle); 911 if (!uobj) {
747 if (!cq || cq->uobject->context != file->ucontext) {
748 ret = -EINVAL; 912 ret = -EINVAL;
749 goto out; 913 goto out;
750 } 914 }
915 cq = uobj->object;
751 916
752 resp->count = ib_poll_cq(cq, cmd.ne, wc); 917 resp->count = ib_poll_cq(cq, cmd.ne, wc);
753 918
919 put_uobj_read(uobj);
920
754 for (i = 0; i < resp->count; i++) { 921 for (i = 0; i < resp->count; i++) {
755 resp->wc[i].wr_id = wc[i].wr_id; 922 resp->wc[i].wr_id = wc[i].wr_id;
756 resp->wc[i].status = wc[i].status; 923 resp->wc[i].status = wc[i].status;
@@ -772,7 +939,6 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,
772 ret = -EFAULT; 939 ret = -EFAULT;
773 940
774out: 941out:
775 mutex_unlock(&ib_uverbs_idr_mutex);
776 kfree(resp); 942 kfree(resp);
777 943
778out_wc: 944out_wc:
@@ -785,22 +951,23 @@ ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file,
785 int out_len) 951 int out_len)
786{ 952{
787 struct ib_uverbs_req_notify_cq cmd; 953 struct ib_uverbs_req_notify_cq cmd;
954 struct ib_uobject *uobj;
788 struct ib_cq *cq; 955 struct ib_cq *cq;
789 int ret = -EINVAL;
790 956
791 if (copy_from_user(&cmd, buf, sizeof cmd)) 957 if (copy_from_user(&cmd, buf, sizeof cmd))
792 return -EFAULT; 958 return -EFAULT;
793 959
794 mutex_lock(&ib_uverbs_idr_mutex); 960 uobj = idr_read_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext);
795 cq = idr_find(&ib_uverbs_cq_idr, cmd.cq_handle); 961 if (!uobj)
796 if (cq && cq->uobject->context == file->ucontext) { 962 return -EINVAL;
797 ib_req_notify_cq(cq, cmd.solicited_only ? 963 cq = uobj->object;
798 IB_CQ_SOLICITED : IB_CQ_NEXT_COMP);
799 ret = in_len;
800 }
801 mutex_unlock(&ib_uverbs_idr_mutex);
802 964
803 return ret; 965 ib_req_notify_cq(cq, cmd.solicited_only ?
966 IB_CQ_SOLICITED : IB_CQ_NEXT_COMP);
967
968 put_uobj_read(uobj);
969
970 return in_len;
804} 971}
805 972
806ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file, 973ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file,
@@ -809,52 +976,50 @@ ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file,
809{ 976{
810 struct ib_uverbs_destroy_cq cmd; 977 struct ib_uverbs_destroy_cq cmd;
811 struct ib_uverbs_destroy_cq_resp resp; 978 struct ib_uverbs_destroy_cq_resp resp;
979 struct ib_uobject *uobj;
812 struct ib_cq *cq; 980 struct ib_cq *cq;
813 struct ib_ucq_object *uobj; 981 struct ib_ucq_object *obj;
814 struct ib_uverbs_event_file *ev_file; 982 struct ib_uverbs_event_file *ev_file;
815 u64 user_handle;
816 int ret = -EINVAL; 983 int ret = -EINVAL;
817 984
818 if (copy_from_user(&cmd, buf, sizeof cmd)) 985 if (copy_from_user(&cmd, buf, sizeof cmd))
819 return -EFAULT; 986 return -EFAULT;
820 987
821 memset(&resp, 0, sizeof resp); 988 uobj = idr_write_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext);
822 989 if (!uobj)
823 mutex_lock(&ib_uverbs_idr_mutex); 990 return -EINVAL;
991 cq = uobj->object;
992 ev_file = cq->cq_context;
993 obj = container_of(cq->uobject, struct ib_ucq_object, uobject);
824 994
825 cq = idr_find(&ib_uverbs_cq_idr, cmd.cq_handle); 995 ret = ib_destroy_cq(cq);
826 if (!cq || cq->uobject->context != file->ucontext) 996 if (!ret)
827 goto out; 997 uobj->live = 0;
828 998
829 user_handle = cq->uobject->user_handle; 999 put_uobj_write(uobj);
830 uobj = container_of(cq->uobject, struct ib_ucq_object, uobject);
831 ev_file = cq->cq_context;
832 1000
833 ret = ib_destroy_cq(cq);
834 if (ret) 1001 if (ret)
835 goto out; 1002 return ret;
836 1003
837 idr_remove(&ib_uverbs_cq_idr, cmd.cq_handle); 1004 idr_remove_uobj(&ib_uverbs_cq_idr, uobj);
838 1005
839 mutex_lock(&file->mutex); 1006 mutex_lock(&file->mutex);
840 list_del(&uobj->uobject.list); 1007 list_del(&uobj->list);
841 mutex_unlock(&file->mutex); 1008 mutex_unlock(&file->mutex);
842 1009
843 ib_uverbs_release_ucq(file, ev_file, uobj); 1010 ib_uverbs_release_ucq(file, ev_file, obj);
844 1011
845 resp.comp_events_reported = uobj->comp_events_reported; 1012 memset(&resp, 0, sizeof resp);
846 resp.async_events_reported = uobj->async_events_reported; 1013 resp.comp_events_reported = obj->comp_events_reported;
1014 resp.async_events_reported = obj->async_events_reported;
847 1015
848 kfree(uobj); 1016 put_uobj(uobj);
849 1017
850 if (copy_to_user((void __user *) (unsigned long) cmd.response, 1018 if (copy_to_user((void __user *) (unsigned long) cmd.response,
851 &resp, sizeof resp)) 1019 &resp, sizeof resp))
852 ret = -EFAULT; 1020 return -EFAULT;
853
854out:
855 mutex_unlock(&ib_uverbs_idr_mutex);
856 1021
857 return ret ? ret : in_len; 1022 return in_len;
858} 1023}
859 1024
860ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, 1025ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
@@ -864,7 +1029,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
864 struct ib_uverbs_create_qp cmd; 1029 struct ib_uverbs_create_qp cmd;
865 struct ib_uverbs_create_qp_resp resp; 1030 struct ib_uverbs_create_qp_resp resp;
866 struct ib_udata udata; 1031 struct ib_udata udata;
867 struct ib_uqp_object *uobj; 1032 struct ib_uqp_object *obj;
868 struct ib_pd *pd; 1033 struct ib_pd *pd;
869 struct ib_cq *scq, *rcq; 1034 struct ib_cq *scq, *rcq;
870 struct ib_srq *srq; 1035 struct ib_srq *srq;
@@ -882,23 +1047,21 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
882 (unsigned long) cmd.response + sizeof resp, 1047 (unsigned long) cmd.response + sizeof resp,
883 in_len - sizeof cmd, out_len - sizeof resp); 1048 in_len - sizeof cmd, out_len - sizeof resp);
884 1049
885 uobj = kmalloc(sizeof *uobj, GFP_KERNEL); 1050 obj = kmalloc(sizeof *obj, GFP_KERNEL);
886 if (!uobj) 1051 if (!obj)
887 return -ENOMEM; 1052 return -ENOMEM;
888 1053
889 mutex_lock(&ib_uverbs_idr_mutex); 1054 init_uobj(&obj->uevent.uobject, cmd.user_handle, file->ucontext);
1055 down_write(&obj->uevent.uobject.mutex);
890 1056
891 pd = idr_find(&ib_uverbs_pd_idr, cmd.pd_handle); 1057 pd = idr_read_pd(cmd.pd_handle, file->ucontext);
892 scq = idr_find(&ib_uverbs_cq_idr, cmd.send_cq_handle); 1058 scq = idr_read_cq(cmd.send_cq_handle, file->ucontext);
893 rcq = idr_find(&ib_uverbs_cq_idr, cmd.recv_cq_handle); 1059 rcq = idr_read_cq(cmd.recv_cq_handle, file->ucontext);
894 srq = cmd.is_srq ? idr_find(&ib_uverbs_srq_idr, cmd.srq_handle) : NULL; 1060 srq = cmd.is_srq ? idr_read_srq(cmd.srq_handle, file->ucontext) : NULL;
895 1061
896 if (!pd || pd->uobject->context != file->ucontext || 1062 if (!pd || !scq || !rcq || (cmd.is_srq && !srq)) {
897 !scq || scq->uobject->context != file->ucontext ||
898 !rcq || rcq->uobject->context != file->ucontext ||
899 (cmd.is_srq && (!srq || srq->uobject->context != file->ucontext))) {
900 ret = -EINVAL; 1063 ret = -EINVAL;
901 goto err_up; 1064 goto err_put;
902 } 1065 }
903 1066
904 attr.event_handler = ib_uverbs_qp_event_handler; 1067 attr.event_handler = ib_uverbs_qp_event_handler;
@@ -915,16 +1078,14 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
915 attr.cap.max_recv_sge = cmd.max_recv_sge; 1078 attr.cap.max_recv_sge = cmd.max_recv_sge;
916 attr.cap.max_inline_data = cmd.max_inline_data; 1079 attr.cap.max_inline_data = cmd.max_inline_data;
917 1080
918 uobj->uevent.uobject.user_handle = cmd.user_handle; 1081 obj->uevent.events_reported = 0;
919 uobj->uevent.uobject.context = file->ucontext; 1082 INIT_LIST_HEAD(&obj->uevent.event_list);
920 uobj->uevent.events_reported = 0; 1083 INIT_LIST_HEAD(&obj->mcast_list);
921 INIT_LIST_HEAD(&uobj->uevent.event_list);
922 INIT_LIST_HEAD(&uobj->mcast_list);
923 1084
924 qp = pd->device->create_qp(pd, &attr, &udata); 1085 qp = pd->device->create_qp(pd, &attr, &udata);
925 if (IS_ERR(qp)) { 1086 if (IS_ERR(qp)) {
926 ret = PTR_ERR(qp); 1087 ret = PTR_ERR(qp);
927 goto err_up; 1088 goto err_put;
928 } 1089 }
929 1090
930 qp->device = pd->device; 1091 qp->device = pd->device;
@@ -932,7 +1093,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
932 qp->send_cq = attr.send_cq; 1093 qp->send_cq = attr.send_cq;
933 qp->recv_cq = attr.recv_cq; 1094 qp->recv_cq = attr.recv_cq;
934 qp->srq = attr.srq; 1095 qp->srq = attr.srq;
935 qp->uobject = &uobj->uevent.uobject; 1096 qp->uobject = &obj->uevent.uobject;
936 qp->event_handler = attr.event_handler; 1097 qp->event_handler = attr.event_handler;
937 qp->qp_context = attr.qp_context; 1098 qp->qp_context = attr.qp_context;
938 qp->qp_type = attr.qp_type; 1099 qp->qp_type = attr.qp_type;
@@ -942,23 +1103,14 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
942 if (attr.srq) 1103 if (attr.srq)
943 atomic_inc(&attr.srq->usecnt); 1104 atomic_inc(&attr.srq->usecnt);
944 1105
945 memset(&resp, 0, sizeof resp); 1106 obj->uevent.uobject.object = qp;
946 resp.qpn = qp->qp_num; 1107 ret = idr_add_uobj(&ib_uverbs_qp_idr, &obj->uevent.uobject);
947
948retry:
949 if (!idr_pre_get(&ib_uverbs_qp_idr, GFP_KERNEL)) {
950 ret = -ENOMEM;
951 goto err_destroy;
952 }
953
954 ret = idr_get_new(&ib_uverbs_qp_idr, qp, &uobj->uevent.uobject.id);
955
956 if (ret == -EAGAIN)
957 goto retry;
958 if (ret) 1108 if (ret)
959 goto err_destroy; 1109 goto err_destroy;
960 1110
961 resp.qp_handle = uobj->uevent.uobject.id; 1111 memset(&resp, 0, sizeof resp);
1112 resp.qpn = qp->qp_num;
1113 resp.qp_handle = obj->uevent.uobject.id;
962 resp.max_recv_sge = attr.cap.max_recv_sge; 1114 resp.max_recv_sge = attr.cap.max_recv_sge;
963 resp.max_send_sge = attr.cap.max_send_sge; 1115 resp.max_send_sge = attr.cap.max_send_sge;
964 resp.max_recv_wr = attr.cap.max_recv_wr; 1116 resp.max_recv_wr = attr.cap.max_recv_wr;
@@ -968,32 +1120,42 @@ retry:
968 if (copy_to_user((void __user *) (unsigned long) cmd.response, 1120 if (copy_to_user((void __user *) (unsigned long) cmd.response,
969 &resp, sizeof resp)) { 1121 &resp, sizeof resp)) {
970 ret = -EFAULT; 1122 ret = -EFAULT;
971 goto err_idr; 1123 goto err_copy;
972 } 1124 }
973 1125
1126 put_pd_read(pd);
1127 put_cq_read(scq);
1128 put_cq_read(rcq);
1129 if (srq)
1130 put_srq_read(srq);
1131
974 mutex_lock(&file->mutex); 1132 mutex_lock(&file->mutex);
975 list_add_tail(&uobj->uevent.uobject.list, &file->ucontext->qp_list); 1133 list_add_tail(&obj->uevent.uobject.list, &file->ucontext->qp_list);
976 mutex_unlock(&file->mutex); 1134 mutex_unlock(&file->mutex);
977 1135
978 mutex_unlock(&ib_uverbs_idr_mutex); 1136 obj->uevent.uobject.live = 1;
1137
1138 up_write(&obj->uevent.uobject.mutex);
979 1139
980 return in_len; 1140 return in_len;
981 1141
982err_idr: 1142err_copy:
983 idr_remove(&ib_uverbs_qp_idr, uobj->uevent.uobject.id); 1143 idr_remove_uobj(&ib_uverbs_qp_idr, &obj->uevent.uobject);
984 1144
985err_destroy: 1145err_destroy:
986 ib_destroy_qp(qp); 1146 ib_destroy_qp(qp);
987 atomic_dec(&pd->usecnt);
988 atomic_dec(&attr.send_cq->usecnt);
989 atomic_dec(&attr.recv_cq->usecnt);
990 if (attr.srq)
991 atomic_dec(&attr.srq->usecnt);
992
993err_up:
994 mutex_unlock(&ib_uverbs_idr_mutex);
995 1147
996 kfree(uobj); 1148err_put:
1149 if (pd)
1150 put_pd_read(pd);
1151 if (scq)
1152 put_cq_read(scq);
1153 if (rcq)
1154 put_cq_read(rcq);
1155 if (srq)
1156 put_srq_read(srq);
1157
1158 put_uobj_write(&obj->uevent.uobject);
997 return ret; 1159 return ret;
998} 1160}
999 1161
@@ -1018,15 +1180,15 @@ ssize_t ib_uverbs_query_qp(struct ib_uverbs_file *file,
1018 goto out; 1180 goto out;
1019 } 1181 }
1020 1182
1021 mutex_lock(&ib_uverbs_idr_mutex); 1183 qp = idr_read_qp(cmd.qp_handle, file->ucontext);
1022 1184 if (!qp) {
1023 qp = idr_find(&ib_uverbs_qp_idr, cmd.qp_handle);
1024 if (qp && qp->uobject->context == file->ucontext)
1025 ret = ib_query_qp(qp, attr, cmd.attr_mask, init_attr);
1026 else
1027 ret = -EINVAL; 1185 ret = -EINVAL;
1186 goto out;
1187 }
1028 1188
1029 mutex_unlock(&ib_uverbs_idr_mutex); 1189 ret = ib_query_qp(qp, attr, cmd.attr_mask, init_attr);
1190
1191 put_qp_read(qp);
1030 1192
1031 if (ret) 1193 if (ret)
1032 goto out; 1194 goto out;
@@ -1113,10 +1275,8 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
1113 if (!attr) 1275 if (!attr)
1114 return -ENOMEM; 1276 return -ENOMEM;
1115 1277
1116 mutex_lock(&ib_uverbs_idr_mutex); 1278 qp = idr_read_qp(cmd.qp_handle, file->ucontext);
1117 1279 if (!qp) {
1118 qp = idr_find(&ib_uverbs_qp_idr, cmd.qp_handle);
1119 if (!qp || qp->uobject->context != file->ucontext) {
1120 ret = -EINVAL; 1280 ret = -EINVAL;
1121 goto out; 1281 goto out;
1122 } 1282 }
@@ -1168,13 +1328,15 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
1168 attr->alt_ah_attr.port_num = cmd.alt_dest.port_num; 1328 attr->alt_ah_attr.port_num = cmd.alt_dest.port_num;
1169 1329
1170 ret = ib_modify_qp(qp, attr, cmd.attr_mask); 1330 ret = ib_modify_qp(qp, attr, cmd.attr_mask);
1331
1332 put_qp_read(qp);
1333
1171 if (ret) 1334 if (ret)
1172 goto out; 1335 goto out;
1173 1336
1174 ret = in_len; 1337 ret = in_len;
1175 1338
1176out: 1339out:
1177 mutex_unlock(&ib_uverbs_idr_mutex);
1178 kfree(attr); 1340 kfree(attr);
1179 1341
1180 return ret; 1342 return ret;
@@ -1186,8 +1348,9 @@ ssize_t ib_uverbs_destroy_qp(struct ib_uverbs_file *file,
1186{ 1348{
1187 struct ib_uverbs_destroy_qp cmd; 1349 struct ib_uverbs_destroy_qp cmd;
1188 struct ib_uverbs_destroy_qp_resp resp; 1350 struct ib_uverbs_destroy_qp_resp resp;
1351 struct ib_uobject *uobj;
1189 struct ib_qp *qp; 1352 struct ib_qp *qp;
1190 struct ib_uqp_object *uobj; 1353 struct ib_uqp_object *obj;
1191 int ret = -EINVAL; 1354 int ret = -EINVAL;
1192 1355
1193 if (copy_from_user(&cmd, buf, sizeof cmd)) 1356 if (copy_from_user(&cmd, buf, sizeof cmd))
@@ -1195,43 +1358,43 @@ ssize_t ib_uverbs_destroy_qp(struct ib_uverbs_file *file,
1195 1358
1196 memset(&resp, 0, sizeof resp); 1359 memset(&resp, 0, sizeof resp);
1197 1360
1198 mutex_lock(&ib_uverbs_idr_mutex); 1361 uobj = idr_write_uobj(&ib_uverbs_qp_idr, cmd.qp_handle, file->ucontext);
1199 1362 if (!uobj)
1200 qp = idr_find(&ib_uverbs_qp_idr, cmd.qp_handle); 1363 return -EINVAL;
1201 if (!qp || qp->uobject->context != file->ucontext) 1364 qp = uobj->object;
1202 goto out; 1365 obj = container_of(uobj, struct ib_uqp_object, uevent.uobject);
1203
1204 uobj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject);
1205 1366
1206 if (!list_empty(&uobj->mcast_list)) { 1367 if (!list_empty(&obj->mcast_list)) {
1207 ret = -EBUSY; 1368 put_uobj_write(uobj);
1208 goto out; 1369 return -EBUSY;
1209 } 1370 }
1210 1371
1211 ret = ib_destroy_qp(qp); 1372 ret = ib_destroy_qp(qp);
1373 if (!ret)
1374 uobj->live = 0;
1375
1376 put_uobj_write(uobj);
1377
1212 if (ret) 1378 if (ret)
1213 goto out; 1379 return ret;
1214 1380
1215 idr_remove(&ib_uverbs_qp_idr, cmd.qp_handle); 1381 idr_remove_uobj(&ib_uverbs_qp_idr, uobj);
1216 1382
1217 mutex_lock(&file->mutex); 1383 mutex_lock(&file->mutex);
1218 list_del(&uobj->uevent.uobject.list); 1384 list_del(&uobj->list);
1219 mutex_unlock(&file->mutex); 1385 mutex_unlock(&file->mutex);
1220 1386
1221 ib_uverbs_release_uevent(file, &uobj->uevent); 1387 ib_uverbs_release_uevent(file, &obj->uevent);
1222 1388
1223 resp.events_reported = uobj->uevent.events_reported; 1389 resp.events_reported = obj->uevent.events_reported;
1224 1390
1225 kfree(uobj); 1391 put_uobj(uobj);
1226 1392
1227 if (copy_to_user((void __user *) (unsigned long) cmd.response, 1393 if (copy_to_user((void __user *) (unsigned long) cmd.response,
1228 &resp, sizeof resp)) 1394 &resp, sizeof resp))
1229 ret = -EFAULT; 1395 return -EFAULT;
1230
1231out:
1232 mutex_unlock(&ib_uverbs_idr_mutex);
1233 1396
1234 return ret ? ret : in_len; 1397 return in_len;
1235} 1398}
1236 1399
1237ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, 1400ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
@@ -1244,6 +1407,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
1244 struct ib_send_wr *wr = NULL, *last, *next, *bad_wr; 1407 struct ib_send_wr *wr = NULL, *last, *next, *bad_wr;
1245 struct ib_qp *qp; 1408 struct ib_qp *qp;
1246 int i, sg_ind; 1409 int i, sg_ind;
1410 int is_ud;
1247 ssize_t ret = -EINVAL; 1411 ssize_t ret = -EINVAL;
1248 1412
1249 if (copy_from_user(&cmd, buf, sizeof cmd)) 1413 if (copy_from_user(&cmd, buf, sizeof cmd))
@@ -1260,12 +1424,11 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
1260 if (!user_wr) 1424 if (!user_wr)
1261 return -ENOMEM; 1425 return -ENOMEM;
1262 1426
1263 mutex_lock(&ib_uverbs_idr_mutex); 1427 qp = idr_read_qp(cmd.qp_handle, file->ucontext);
1264 1428 if (!qp)
1265 qp = idr_find(&ib_uverbs_qp_idr, cmd.qp_handle);
1266 if (!qp || qp->uobject->context != file->ucontext)
1267 goto out; 1429 goto out;
1268 1430
1431 is_ud = qp->qp_type == IB_QPT_UD;
1269 sg_ind = 0; 1432 sg_ind = 0;
1270 last = NULL; 1433 last = NULL;
1271 for (i = 0; i < cmd.wr_count; ++i) { 1434 for (i = 0; i < cmd.wr_count; ++i) {
@@ -1273,12 +1436,12 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
1273 buf + sizeof cmd + i * cmd.wqe_size, 1436 buf + sizeof cmd + i * cmd.wqe_size,
1274 cmd.wqe_size)) { 1437 cmd.wqe_size)) {
1275 ret = -EFAULT; 1438 ret = -EFAULT;
1276 goto out; 1439 goto out_put;
1277 } 1440 }
1278 1441
1279 if (user_wr->num_sge + sg_ind > cmd.sge_count) { 1442 if (user_wr->num_sge + sg_ind > cmd.sge_count) {
1280 ret = -EINVAL; 1443 ret = -EINVAL;
1281 goto out; 1444 goto out_put;
1282 } 1445 }
1283 1446
1284 next = kmalloc(ALIGN(sizeof *next, sizeof (struct ib_sge)) + 1447 next = kmalloc(ALIGN(sizeof *next, sizeof (struct ib_sge)) +
@@ -1286,7 +1449,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
1286 GFP_KERNEL); 1449 GFP_KERNEL);
1287 if (!next) { 1450 if (!next) {
1288 ret = -ENOMEM; 1451 ret = -ENOMEM;
1289 goto out; 1452 goto out_put;
1290 } 1453 }
1291 1454
1292 if (!last) 1455 if (!last)
@@ -1302,12 +1465,12 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
1302 next->send_flags = user_wr->send_flags; 1465 next->send_flags = user_wr->send_flags;
1303 next->imm_data = (__be32 __force) user_wr->imm_data; 1466 next->imm_data = (__be32 __force) user_wr->imm_data;
1304 1467
1305 if (qp->qp_type == IB_QPT_UD) { 1468 if (is_ud) {
1306 next->wr.ud.ah = idr_find(&ib_uverbs_ah_idr, 1469 next->wr.ud.ah = idr_read_ah(user_wr->wr.ud.ah,
1307 user_wr->wr.ud.ah); 1470 file->ucontext);
1308 if (!next->wr.ud.ah) { 1471 if (!next->wr.ud.ah) {
1309 ret = -EINVAL; 1472 ret = -EINVAL;
1310 goto out; 1473 goto out_put;
1311 } 1474 }
1312 next->wr.ud.remote_qpn = user_wr->wr.ud.remote_qpn; 1475 next->wr.ud.remote_qpn = user_wr->wr.ud.remote_qpn;
1313 next->wr.ud.remote_qkey = user_wr->wr.ud.remote_qkey; 1476 next->wr.ud.remote_qkey = user_wr->wr.ud.remote_qkey;
@@ -1344,7 +1507,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
1344 sg_ind * sizeof (struct ib_sge), 1507 sg_ind * sizeof (struct ib_sge),
1345 next->num_sge * sizeof (struct ib_sge))) { 1508 next->num_sge * sizeof (struct ib_sge))) {
1346 ret = -EFAULT; 1509 ret = -EFAULT;
1347 goto out; 1510 goto out_put;
1348 } 1511 }
1349 sg_ind += next->num_sge; 1512 sg_ind += next->num_sge;
1350 } else 1513 } else
@@ -1364,10 +1527,13 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
1364 &resp, sizeof resp)) 1527 &resp, sizeof resp))
1365 ret = -EFAULT; 1528 ret = -EFAULT;
1366 1529
1367out: 1530out_put:
1368 mutex_unlock(&ib_uverbs_idr_mutex); 1531 put_qp_read(qp);
1369 1532
1533out:
1370 while (wr) { 1534 while (wr) {
1535 if (is_ud && wr->wr.ud.ah)
1536 put_ah_read(wr->wr.ud.ah);
1371 next = wr->next; 1537 next = wr->next;
1372 kfree(wr); 1538 kfree(wr);
1373 wr = next; 1539 wr = next;
@@ -1482,14 +1648,15 @@ ssize_t ib_uverbs_post_recv(struct ib_uverbs_file *file,
1482 if (IS_ERR(wr)) 1648 if (IS_ERR(wr))
1483 return PTR_ERR(wr); 1649 return PTR_ERR(wr);
1484 1650
1485 mutex_lock(&ib_uverbs_idr_mutex); 1651 qp = idr_read_qp(cmd.qp_handle, file->ucontext);
1486 1652 if (!qp)
1487 qp = idr_find(&ib_uverbs_qp_idr, cmd.qp_handle);
1488 if (!qp || qp->uobject->context != file->ucontext)
1489 goto out; 1653 goto out;
1490 1654
1491 resp.bad_wr = 0; 1655 resp.bad_wr = 0;
1492 ret = qp->device->post_recv(qp, wr, &bad_wr); 1656 ret = qp->device->post_recv(qp, wr, &bad_wr);
1657
1658 put_qp_read(qp);
1659
1493 if (ret) 1660 if (ret)
1494 for (next = wr; next; next = next->next) { 1661 for (next = wr; next; next = next->next) {
1495 ++resp.bad_wr; 1662 ++resp.bad_wr;
@@ -1503,8 +1670,6 @@ ssize_t ib_uverbs_post_recv(struct ib_uverbs_file *file,
1503 ret = -EFAULT; 1670 ret = -EFAULT;
1504 1671
1505out: 1672out:
1506 mutex_unlock(&ib_uverbs_idr_mutex);
1507
1508 while (wr) { 1673 while (wr) {
1509 next = wr->next; 1674 next = wr->next;
1510 kfree(wr); 1675 kfree(wr);
@@ -1533,14 +1698,15 @@ ssize_t ib_uverbs_post_srq_recv(struct ib_uverbs_file *file,
1533 if (IS_ERR(wr)) 1698 if (IS_ERR(wr))
1534 return PTR_ERR(wr); 1699 return PTR_ERR(wr);
1535 1700
1536 mutex_lock(&ib_uverbs_idr_mutex); 1701 srq = idr_read_srq(cmd.srq_handle, file->ucontext);
1537 1702 if (!srq)
1538 srq = idr_find(&ib_uverbs_srq_idr, cmd.srq_handle);
1539 if (!srq || srq->uobject->context != file->ucontext)
1540 goto out; 1703 goto out;
1541 1704
1542 resp.bad_wr = 0; 1705 resp.bad_wr = 0;
1543 ret = srq->device->post_srq_recv(srq, wr, &bad_wr); 1706 ret = srq->device->post_srq_recv(srq, wr, &bad_wr);
1707
1708 put_srq_read(srq);
1709
1544 if (ret) 1710 if (ret)
1545 for (next = wr; next; next = next->next) { 1711 for (next = wr; next; next = next->next) {
1546 ++resp.bad_wr; 1712 ++resp.bad_wr;
@@ -1554,8 +1720,6 @@ ssize_t ib_uverbs_post_srq_recv(struct ib_uverbs_file *file,
1554 ret = -EFAULT; 1720 ret = -EFAULT;
1555 1721
1556out: 1722out:
1557 mutex_unlock(&ib_uverbs_idr_mutex);
1558
1559 while (wr) { 1723 while (wr) {
1560 next = wr->next; 1724 next = wr->next;
1561 kfree(wr); 1725 kfree(wr);
@@ -1587,17 +1751,15 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
1587 if (!uobj) 1751 if (!uobj)
1588 return -ENOMEM; 1752 return -ENOMEM;
1589 1753
1590 mutex_lock(&ib_uverbs_idr_mutex); 1754 init_uobj(uobj, cmd.user_handle, file->ucontext);
1755 down_write(&uobj->mutex);
1591 1756
1592 pd = idr_find(&ib_uverbs_pd_idr, cmd.pd_handle); 1757 pd = idr_read_pd(cmd.pd_handle, file->ucontext);
1593 if (!pd || pd->uobject->context != file->ucontext) { 1758 if (!pd) {
1594 ret = -EINVAL; 1759 ret = -EINVAL;
1595 goto err_up; 1760 goto err;
1596 } 1761 }
1597 1762
1598 uobj->user_handle = cmd.user_handle;
1599 uobj->context = file->ucontext;
1600
1601 attr.dlid = cmd.attr.dlid; 1763 attr.dlid = cmd.attr.dlid;
1602 attr.sl = cmd.attr.sl; 1764 attr.sl = cmd.attr.sl;
1603 attr.src_path_bits = cmd.attr.src_path_bits; 1765 attr.src_path_bits = cmd.attr.src_path_bits;
@@ -1613,21 +1775,13 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
1613 ah = ib_create_ah(pd, &attr); 1775 ah = ib_create_ah(pd, &attr);
1614 if (IS_ERR(ah)) { 1776 if (IS_ERR(ah)) {
1615 ret = PTR_ERR(ah); 1777 ret = PTR_ERR(ah);
1616 goto err_up; 1778 goto err;
1617 }
1618
1619 ah->uobject = uobj;
1620
1621retry:
1622 if (!idr_pre_get(&ib_uverbs_ah_idr, GFP_KERNEL)) {
1623 ret = -ENOMEM;
1624 goto err_destroy;
1625 } 1779 }
1626 1780
1627 ret = idr_get_new(&ib_uverbs_ah_idr, ah, &uobj->id); 1781 ah->uobject = uobj;
1782 uobj->object = ah;
1628 1783
1629 if (ret == -EAGAIN) 1784 ret = idr_add_uobj(&ib_uverbs_ah_idr, uobj);
1630 goto retry;
1631 if (ret) 1785 if (ret)
1632 goto err_destroy; 1786 goto err_destroy;
1633 1787
@@ -1636,27 +1790,29 @@ retry:
1636 if (copy_to_user((void __user *) (unsigned long) cmd.response, 1790 if (copy_to_user((void __user *) (unsigned long) cmd.response,
1637 &resp, sizeof resp)) { 1791 &resp, sizeof resp)) {
1638 ret = -EFAULT; 1792 ret = -EFAULT;
1639 goto err_idr; 1793 goto err_copy;
1640 } 1794 }
1641 1795
1796 put_pd_read(pd);
1797
1642 mutex_lock(&file->mutex); 1798 mutex_lock(&file->mutex);
1643 list_add_tail(&uobj->list, &file->ucontext->ah_list); 1799 list_add_tail(&uobj->list, &file->ucontext->ah_list);
1644 mutex_unlock(&file->mutex); 1800 mutex_unlock(&file->mutex);
1645 1801
1646 mutex_unlock(&ib_uverbs_idr_mutex); 1802 uobj->live = 1;
1803
1804 up_write(&uobj->mutex);
1647 1805
1648 return in_len; 1806 return in_len;
1649 1807
1650err_idr: 1808err_copy:
1651 idr_remove(&ib_uverbs_ah_idr, uobj->id); 1809 idr_remove_uobj(&ib_uverbs_ah_idr, uobj);
1652 1810
1653err_destroy: 1811err_destroy:
1654 ib_destroy_ah(ah); 1812 ib_destroy_ah(ah);
1655 1813
1656err_up: 1814err:
1657 mutex_unlock(&ib_uverbs_idr_mutex); 1815 put_uobj_write(uobj);
1658
1659 kfree(uobj);
1660 return ret; 1816 return ret;
1661} 1817}
1662 1818
@@ -1666,35 +1822,34 @@ ssize_t ib_uverbs_destroy_ah(struct ib_uverbs_file *file,
1666 struct ib_uverbs_destroy_ah cmd; 1822 struct ib_uverbs_destroy_ah cmd;
1667 struct ib_ah *ah; 1823 struct ib_ah *ah;
1668 struct ib_uobject *uobj; 1824 struct ib_uobject *uobj;
1669 int ret = -EINVAL; 1825 int ret;
1670 1826
1671 if (copy_from_user(&cmd, buf, sizeof cmd)) 1827 if (copy_from_user(&cmd, buf, sizeof cmd))
1672 return -EFAULT; 1828 return -EFAULT;
1673 1829
1674 mutex_lock(&ib_uverbs_idr_mutex); 1830 uobj = idr_write_uobj(&ib_uverbs_ah_idr, cmd.ah_handle, file->ucontext);
1831 if (!uobj)
1832 return -EINVAL;
1833 ah = uobj->object;
1675 1834
1676 ah = idr_find(&ib_uverbs_ah_idr, cmd.ah_handle); 1835 ret = ib_destroy_ah(ah);
1677 if (!ah || ah->uobject->context != file->ucontext) 1836 if (!ret)
1678 goto out; 1837 uobj->live = 0;
1679 1838
1680 uobj = ah->uobject; 1839 put_uobj_write(uobj);
1681 1840
1682 ret = ib_destroy_ah(ah);
1683 if (ret) 1841 if (ret)
1684 goto out; 1842 return ret;
1685 1843
1686 idr_remove(&ib_uverbs_ah_idr, cmd.ah_handle); 1844 idr_remove_uobj(&ib_uverbs_ah_idr, uobj);
1687 1845
1688 mutex_lock(&file->mutex); 1846 mutex_lock(&file->mutex);
1689 list_del(&uobj->list); 1847 list_del(&uobj->list);
1690 mutex_unlock(&file->mutex); 1848 mutex_unlock(&file->mutex);
1691 1849
1692 kfree(uobj); 1850 put_uobj(uobj);
1693 1851
1694out: 1852 return in_len;
1695 mutex_unlock(&ib_uverbs_idr_mutex);
1696
1697 return ret ? ret : in_len;
1698} 1853}
1699 1854
1700ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file, 1855ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
@@ -1703,47 +1858,43 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
1703{ 1858{
1704 struct ib_uverbs_attach_mcast cmd; 1859 struct ib_uverbs_attach_mcast cmd;
1705 struct ib_qp *qp; 1860 struct ib_qp *qp;
1706 struct ib_uqp_object *uobj; 1861 struct ib_uqp_object *obj;
1707 struct ib_uverbs_mcast_entry *mcast; 1862 struct ib_uverbs_mcast_entry *mcast;
1708 int ret = -EINVAL; 1863 int ret;
1709 1864
1710 if (copy_from_user(&cmd, buf, sizeof cmd)) 1865 if (copy_from_user(&cmd, buf, sizeof cmd))
1711 return -EFAULT; 1866 return -EFAULT;
1712 1867
1713 mutex_lock(&ib_uverbs_idr_mutex); 1868 qp = idr_read_qp(cmd.qp_handle, file->ucontext);
1714 1869 if (!qp)
1715 qp = idr_find(&ib_uverbs_qp_idr, cmd.qp_handle); 1870 return -EINVAL;
1716 if (!qp || qp->uobject->context != file->ucontext)
1717 goto out;
1718 1871
1719 uobj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject); 1872 obj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject);
1720 1873
1721 list_for_each_entry(mcast, &uobj->mcast_list, list) 1874 list_for_each_entry(mcast, &obj->mcast_list, list)
1722 if (cmd.mlid == mcast->lid && 1875 if (cmd.mlid == mcast->lid &&
1723 !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) { 1876 !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) {
1724 ret = 0; 1877 ret = 0;
1725 goto out; 1878 goto out_put;
1726 } 1879 }
1727 1880
1728 mcast = kmalloc(sizeof *mcast, GFP_KERNEL); 1881 mcast = kmalloc(sizeof *mcast, GFP_KERNEL);
1729 if (!mcast) { 1882 if (!mcast) {
1730 ret = -ENOMEM; 1883 ret = -ENOMEM;
1731 goto out; 1884 goto out_put;
1732 } 1885 }
1733 1886
1734 mcast->lid = cmd.mlid; 1887 mcast->lid = cmd.mlid;
1735 memcpy(mcast->gid.raw, cmd.gid, sizeof mcast->gid.raw); 1888 memcpy(mcast->gid.raw, cmd.gid, sizeof mcast->gid.raw);
1736 1889
1737 ret = ib_attach_mcast(qp, &mcast->gid, cmd.mlid); 1890 ret = ib_attach_mcast(qp, &mcast->gid, cmd.mlid);
1738 if (!ret) { 1891 if (!ret)
1739 uobj = container_of(qp->uobject, struct ib_uqp_object, 1892 list_add_tail(&mcast->list, &obj->mcast_list);
1740 uevent.uobject); 1893 else
1741 list_add_tail(&mcast->list, &uobj->mcast_list);
1742 } else
1743 kfree(mcast); 1894 kfree(mcast);
1744 1895
1745out: 1896out_put:
1746 mutex_unlock(&ib_uverbs_idr_mutex); 1897 put_qp_read(qp);
1747 1898
1748 return ret ? ret : in_len; 1899 return ret ? ret : in_len;
1749} 1900}
@@ -1753,7 +1904,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
1753 int out_len) 1904 int out_len)
1754{ 1905{
1755 struct ib_uverbs_detach_mcast cmd; 1906 struct ib_uverbs_detach_mcast cmd;
1756 struct ib_uqp_object *uobj; 1907 struct ib_uqp_object *obj;
1757 struct ib_qp *qp; 1908 struct ib_qp *qp;
1758 struct ib_uverbs_mcast_entry *mcast; 1909 struct ib_uverbs_mcast_entry *mcast;
1759 int ret = -EINVAL; 1910 int ret = -EINVAL;
@@ -1761,19 +1912,17 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
1761 if (copy_from_user(&cmd, buf, sizeof cmd)) 1912 if (copy_from_user(&cmd, buf, sizeof cmd))
1762 return -EFAULT; 1913 return -EFAULT;
1763 1914
1764 mutex_lock(&ib_uverbs_idr_mutex); 1915 qp = idr_read_qp(cmd.qp_handle, file->ucontext);
1765 1916 if (!qp)
1766 qp = idr_find(&ib_uverbs_qp_idr, cmd.qp_handle); 1917 return -EINVAL;
1767 if (!qp || qp->uobject->context != file->ucontext)
1768 goto out;
1769 1918
1770 ret = ib_detach_mcast(qp, (union ib_gid *) cmd.gid, cmd.mlid); 1919 ret = ib_detach_mcast(qp, (union ib_gid *) cmd.gid, cmd.mlid);
1771 if (ret) 1920 if (ret)
1772 goto out; 1921 goto out_put;
1773 1922
1774 uobj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject); 1923 obj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject);
1775 1924
1776 list_for_each_entry(mcast, &uobj->mcast_list, list) 1925 list_for_each_entry(mcast, &obj->mcast_list, list)
1777 if (cmd.mlid == mcast->lid && 1926 if (cmd.mlid == mcast->lid &&
1778 !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) { 1927 !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) {
1779 list_del(&mcast->list); 1928 list_del(&mcast->list);
@@ -1781,8 +1930,8 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
1781 break; 1930 break;
1782 } 1931 }
1783 1932
1784out: 1933out_put:
1785 mutex_unlock(&ib_uverbs_idr_mutex); 1934 put_qp_read(qp);
1786 1935
1787 return ret ? ret : in_len; 1936 return ret ? ret : in_len;
1788} 1937}
@@ -1794,7 +1943,7 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file,
1794 struct ib_uverbs_create_srq cmd; 1943 struct ib_uverbs_create_srq cmd;
1795 struct ib_uverbs_create_srq_resp resp; 1944 struct ib_uverbs_create_srq_resp resp;
1796 struct ib_udata udata; 1945 struct ib_udata udata;
1797 struct ib_uevent_object *uobj; 1946 struct ib_uevent_object *obj;
1798 struct ib_pd *pd; 1947 struct ib_pd *pd;
1799 struct ib_srq *srq; 1948 struct ib_srq *srq;
1800 struct ib_srq_init_attr attr; 1949 struct ib_srq_init_attr attr;
@@ -1810,17 +1959,17 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file,
1810 (unsigned long) cmd.response + sizeof resp, 1959 (unsigned long) cmd.response + sizeof resp,
1811 in_len - sizeof cmd, out_len - sizeof resp); 1960 in_len - sizeof cmd, out_len - sizeof resp);
1812 1961
1813 uobj = kmalloc(sizeof *uobj, GFP_KERNEL); 1962 obj = kmalloc(sizeof *obj, GFP_KERNEL);
1814 if (!uobj) 1963 if (!obj)
1815 return -ENOMEM; 1964 return -ENOMEM;
1816 1965
1817 mutex_lock(&ib_uverbs_idr_mutex); 1966 init_uobj(&obj->uobject, 0, file->ucontext);
1967 down_write(&obj->uobject.mutex);
1818 1968
1819 pd = idr_find(&ib_uverbs_pd_idr, cmd.pd_handle); 1969 pd = idr_read_pd(cmd.pd_handle, file->ucontext);
1820 1970 if (!pd) {
1821 if (!pd || pd->uobject->context != file->ucontext) {
1822 ret = -EINVAL; 1971 ret = -EINVAL;
1823 goto err_up; 1972 goto err;
1824 } 1973 }
1825 1974
1826 attr.event_handler = ib_uverbs_srq_event_handler; 1975 attr.event_handler = ib_uverbs_srq_event_handler;
@@ -1829,69 +1978,59 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file,
1829 attr.attr.max_sge = cmd.max_sge; 1978 attr.attr.max_sge = cmd.max_sge;
1830 attr.attr.srq_limit = cmd.srq_limit; 1979 attr.attr.srq_limit = cmd.srq_limit;
1831 1980
1832 uobj->uobject.user_handle = cmd.user_handle; 1981 obj->events_reported = 0;
1833 uobj->uobject.context = file->ucontext; 1982 INIT_LIST_HEAD(&obj->event_list);
1834 uobj->events_reported = 0;
1835 INIT_LIST_HEAD(&uobj->event_list);
1836 1983
1837 srq = pd->device->create_srq(pd, &attr, &udata); 1984 srq = pd->device->create_srq(pd, &attr, &udata);
1838 if (IS_ERR(srq)) { 1985 if (IS_ERR(srq)) {
1839 ret = PTR_ERR(srq); 1986 ret = PTR_ERR(srq);
1840 goto err_up; 1987 goto err;
1841 } 1988 }
1842 1989
1843 srq->device = pd->device; 1990 srq->device = pd->device;
1844 srq->pd = pd; 1991 srq->pd = pd;
1845 srq->uobject = &uobj->uobject; 1992 srq->uobject = &obj->uobject;
1846 srq->event_handler = attr.event_handler; 1993 srq->event_handler = attr.event_handler;
1847 srq->srq_context = attr.srq_context; 1994 srq->srq_context = attr.srq_context;
1848 atomic_inc(&pd->usecnt); 1995 atomic_inc(&pd->usecnt);
1849 atomic_set(&srq->usecnt, 0); 1996 atomic_set(&srq->usecnt, 0);
1850 1997
1851 memset(&resp, 0, sizeof resp); 1998 obj->uobject.object = srq;
1852 1999 ret = idr_add_uobj(&ib_uverbs_srq_idr, &obj->uobject);
1853retry:
1854 if (!idr_pre_get(&ib_uverbs_srq_idr, GFP_KERNEL)) {
1855 ret = -ENOMEM;
1856 goto err_destroy;
1857 }
1858
1859 ret = idr_get_new(&ib_uverbs_srq_idr, srq, &uobj->uobject.id);
1860
1861 if (ret == -EAGAIN)
1862 goto retry;
1863 if (ret) 2000 if (ret)
1864 goto err_destroy; 2001 goto err_destroy;
1865 2002
1866 resp.srq_handle = uobj->uobject.id; 2003 memset(&resp, 0, sizeof resp);
2004 resp.srq_handle = obj->uobject.id;
1867 resp.max_wr = attr.attr.max_wr; 2005 resp.max_wr = attr.attr.max_wr;
1868 resp.max_sge = attr.attr.max_sge; 2006 resp.max_sge = attr.attr.max_sge;
1869 2007
1870 if (copy_to_user((void __user *) (unsigned long) cmd.response, 2008 if (copy_to_user((void __user *) (unsigned long) cmd.response,
1871 &resp, sizeof resp)) { 2009 &resp, sizeof resp)) {
1872 ret = -EFAULT; 2010 ret = -EFAULT;
1873 goto err_idr; 2011 goto err_copy;
1874 } 2012 }
1875 2013
2014 put_pd_read(pd);
2015
1876 mutex_lock(&file->mutex); 2016 mutex_lock(&file->mutex);
1877 list_add_tail(&uobj->uobject.list, &file->ucontext->srq_list); 2017 list_add_tail(&obj->uobject.list, &file->ucontext->srq_list);
1878 mutex_unlock(&file->mutex); 2018 mutex_unlock(&file->mutex);
1879 2019
1880 mutex_unlock(&ib_uverbs_idr_mutex); 2020 obj->uobject.live = 1;
2021
2022 up_write(&obj->uobject.mutex);
1881 2023
1882 return in_len; 2024 return in_len;
1883 2025
1884err_idr: 2026err_copy:
1885 idr_remove(&ib_uverbs_srq_idr, uobj->uobject.id); 2027 idr_remove_uobj(&ib_uverbs_srq_idr, &obj->uobject);
1886 2028
1887err_destroy: 2029err_destroy:
1888 ib_destroy_srq(srq); 2030 ib_destroy_srq(srq);
1889 atomic_dec(&pd->usecnt);
1890
1891err_up:
1892 mutex_unlock(&ib_uverbs_idr_mutex);
1893 2031
1894 kfree(uobj); 2032err:
2033 put_uobj_write(&obj->uobject);
1895 return ret; 2034 return ret;
1896} 2035}
1897 2036
@@ -1907,21 +2046,16 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file,
1907 if (copy_from_user(&cmd, buf, sizeof cmd)) 2046 if (copy_from_user(&cmd, buf, sizeof cmd))
1908 return -EFAULT; 2047 return -EFAULT;
1909 2048
1910 mutex_lock(&ib_uverbs_idr_mutex); 2049 srq = idr_read_srq(cmd.srq_handle, file->ucontext);
1911 2050 if (!srq)
1912 srq = idr_find(&ib_uverbs_srq_idr, cmd.srq_handle); 2051 return -EINVAL;
1913 if (!srq || srq->uobject->context != file->ucontext) {
1914 ret = -EINVAL;
1915 goto out;
1916 }
1917 2052
1918 attr.max_wr = cmd.max_wr; 2053 attr.max_wr = cmd.max_wr;
1919 attr.srq_limit = cmd.srq_limit; 2054 attr.srq_limit = cmd.srq_limit;
1920 2055
1921 ret = ib_modify_srq(srq, &attr, cmd.attr_mask); 2056 ret = ib_modify_srq(srq, &attr, cmd.attr_mask);
1922 2057
1923out: 2058 put_srq_read(srq);
1924 mutex_unlock(&ib_uverbs_idr_mutex);
1925 2059
1926 return ret ? ret : in_len; 2060 return ret ? ret : in_len;
1927} 2061}
@@ -1942,18 +2076,16 @@ ssize_t ib_uverbs_query_srq(struct ib_uverbs_file *file,
1942 if (copy_from_user(&cmd, buf, sizeof cmd)) 2076 if (copy_from_user(&cmd, buf, sizeof cmd))
1943 return -EFAULT; 2077 return -EFAULT;
1944 2078
1945 mutex_lock(&ib_uverbs_idr_mutex); 2079 srq = idr_read_srq(cmd.srq_handle, file->ucontext);
2080 if (!srq)
2081 return -EINVAL;
1946 2082
1947 srq = idr_find(&ib_uverbs_srq_idr, cmd.srq_handle); 2083 ret = ib_query_srq(srq, &attr);
1948 if (srq && srq->uobject->context == file->ucontext)
1949 ret = ib_query_srq(srq, &attr);
1950 else
1951 ret = -EINVAL;
1952 2084
1953 mutex_unlock(&ib_uverbs_idr_mutex); 2085 put_srq_read(srq);
1954 2086
1955 if (ret) 2087 if (ret)
1956 goto out; 2088 return ret;
1957 2089
1958 memset(&resp, 0, sizeof resp); 2090 memset(&resp, 0, sizeof resp);
1959 2091
@@ -1963,10 +2095,9 @@ ssize_t ib_uverbs_query_srq(struct ib_uverbs_file *file,
1963 2095
1964 if (copy_to_user((void __user *) (unsigned long) cmd.response, 2096 if (copy_to_user((void __user *) (unsigned long) cmd.response,
1965 &resp, sizeof resp)) 2097 &resp, sizeof resp))
1966 ret = -EFAULT; 2098 return -EFAULT;
1967 2099
1968out: 2100 return in_len;
1969 return ret ? ret : in_len;
1970} 2101}
1971 2102
1972ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file, 2103ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file,
@@ -1975,45 +2106,45 @@ ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file,
1975{ 2106{
1976 struct ib_uverbs_destroy_srq cmd; 2107 struct ib_uverbs_destroy_srq cmd;
1977 struct ib_uverbs_destroy_srq_resp resp; 2108 struct ib_uverbs_destroy_srq_resp resp;
2109 struct ib_uobject *uobj;
1978 struct ib_srq *srq; 2110 struct ib_srq *srq;
1979 struct ib_uevent_object *uobj; 2111 struct ib_uevent_object *obj;
1980 int ret = -EINVAL; 2112 int ret = -EINVAL;
1981 2113
1982 if (copy_from_user(&cmd, buf, sizeof cmd)) 2114 if (copy_from_user(&cmd, buf, sizeof cmd))
1983 return -EFAULT; 2115 return -EFAULT;
1984 2116
1985 mutex_lock(&ib_uverbs_idr_mutex); 2117 uobj = idr_write_uobj(&ib_uverbs_srq_idr, cmd.srq_handle, file->ucontext);
1986 2118 if (!uobj)
1987 memset(&resp, 0, sizeof resp); 2119 return -EINVAL;
2120 srq = uobj->object;
2121 obj = container_of(uobj, struct ib_uevent_object, uobject);
1988 2122
1989 srq = idr_find(&ib_uverbs_srq_idr, cmd.srq_handle); 2123 ret = ib_destroy_srq(srq);
1990 if (!srq || srq->uobject->context != file->ucontext) 2124 if (!ret)
1991 goto out; 2125 uobj->live = 0;
1992 2126
1993 uobj = container_of(srq->uobject, struct ib_uevent_object, uobject); 2127 put_uobj_write(uobj);
1994 2128
1995 ret = ib_destroy_srq(srq);
1996 if (ret) 2129 if (ret)
1997 goto out; 2130 return ret;
1998 2131
1999 idr_remove(&ib_uverbs_srq_idr, cmd.srq_handle); 2132 idr_remove_uobj(&ib_uverbs_srq_idr, uobj);
2000 2133
2001 mutex_lock(&file->mutex); 2134 mutex_lock(&file->mutex);
2002 list_del(&uobj->uobject.list); 2135 list_del(&uobj->list);
2003 mutex_unlock(&file->mutex); 2136 mutex_unlock(&file->mutex);
2004 2137
2005 ib_uverbs_release_uevent(file, uobj); 2138 ib_uverbs_release_uevent(file, obj);
2006 2139
2007 resp.events_reported = uobj->events_reported; 2140 memset(&resp, 0, sizeof resp);
2141 resp.events_reported = obj->events_reported;
2008 2142
2009 kfree(uobj); 2143 put_uobj(uobj);
2010 2144
2011 if (copy_to_user((void __user *) (unsigned long) cmd.response, 2145 if (copy_to_user((void __user *) (unsigned long) cmd.response,
2012 &resp, sizeof resp)) 2146 &resp, sizeof resp))
2013 ret = -EFAULT; 2147 ret = -EFAULT;
2014 2148
2015out:
2016 mutex_unlock(&ib_uverbs_idr_mutex);
2017
2018 return ret ? ret : in_len; 2149 return ret ? ret : in_len;
2019} 2150}
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index ff092a0a94da..5ec2d49e9bb6 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -66,7 +66,7 @@ enum {
66 66
67static struct class *uverbs_class; 67static struct class *uverbs_class;
68 68
69DEFINE_MUTEX(ib_uverbs_idr_mutex); 69DEFINE_SPINLOCK(ib_uverbs_idr_lock);
70DEFINE_IDR(ib_uverbs_pd_idr); 70DEFINE_IDR(ib_uverbs_pd_idr);
71DEFINE_IDR(ib_uverbs_mr_idr); 71DEFINE_IDR(ib_uverbs_mr_idr);
72DEFINE_IDR(ib_uverbs_mw_idr); 72DEFINE_IDR(ib_uverbs_mw_idr);
@@ -183,21 +183,21 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
183 if (!context) 183 if (!context)
184 return 0; 184 return 0;
185 185
186 mutex_lock(&ib_uverbs_idr_mutex);
187
188 list_for_each_entry_safe(uobj, tmp, &context->ah_list, list) { 186 list_for_each_entry_safe(uobj, tmp, &context->ah_list, list) {
189 struct ib_ah *ah = idr_find(&ib_uverbs_ah_idr, uobj->id); 187 struct ib_ah *ah = uobj->object;
190 idr_remove(&ib_uverbs_ah_idr, uobj->id); 188
189 idr_remove_uobj(&ib_uverbs_ah_idr, uobj);
191 ib_destroy_ah(ah); 190 ib_destroy_ah(ah);
192 list_del(&uobj->list); 191 list_del(&uobj->list);
193 kfree(uobj); 192 kfree(uobj);
194 } 193 }
195 194
196 list_for_each_entry_safe(uobj, tmp, &context->qp_list, list) { 195 list_for_each_entry_safe(uobj, tmp, &context->qp_list, list) {
197 struct ib_qp *qp = idr_find(&ib_uverbs_qp_idr, uobj->id); 196 struct ib_qp *qp = uobj->object;
198 struct ib_uqp_object *uqp = 197 struct ib_uqp_object *uqp =
199 container_of(uobj, struct ib_uqp_object, uevent.uobject); 198 container_of(uobj, struct ib_uqp_object, uevent.uobject);
200 idr_remove(&ib_uverbs_qp_idr, uobj->id); 199
200 idr_remove_uobj(&ib_uverbs_qp_idr, uobj);
201 ib_uverbs_detach_umcast(qp, uqp); 201 ib_uverbs_detach_umcast(qp, uqp);
202 ib_destroy_qp(qp); 202 ib_destroy_qp(qp);
203 list_del(&uobj->list); 203 list_del(&uobj->list);
@@ -206,11 +206,12 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
206 } 206 }
207 207
208 list_for_each_entry_safe(uobj, tmp, &context->cq_list, list) { 208 list_for_each_entry_safe(uobj, tmp, &context->cq_list, list) {
209 struct ib_cq *cq = idr_find(&ib_uverbs_cq_idr, uobj->id); 209 struct ib_cq *cq = uobj->object;
210 struct ib_uverbs_event_file *ev_file = cq->cq_context; 210 struct ib_uverbs_event_file *ev_file = cq->cq_context;
211 struct ib_ucq_object *ucq = 211 struct ib_ucq_object *ucq =
212 container_of(uobj, struct ib_ucq_object, uobject); 212 container_of(uobj, struct ib_ucq_object, uobject);
213 idr_remove(&ib_uverbs_cq_idr, uobj->id); 213
214 idr_remove_uobj(&ib_uverbs_cq_idr, uobj);
214 ib_destroy_cq(cq); 215 ib_destroy_cq(cq);
215 list_del(&uobj->list); 216 list_del(&uobj->list);
216 ib_uverbs_release_ucq(file, ev_file, ucq); 217 ib_uverbs_release_ucq(file, ev_file, ucq);
@@ -218,10 +219,11 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
218 } 219 }
219 220
220 list_for_each_entry_safe(uobj, tmp, &context->srq_list, list) { 221 list_for_each_entry_safe(uobj, tmp, &context->srq_list, list) {
221 struct ib_srq *srq = idr_find(&ib_uverbs_srq_idr, uobj->id); 222 struct ib_srq *srq = uobj->object;
222 struct ib_uevent_object *uevent = 223 struct ib_uevent_object *uevent =
223 container_of(uobj, struct ib_uevent_object, uobject); 224 container_of(uobj, struct ib_uevent_object, uobject);
224 idr_remove(&ib_uverbs_srq_idr, uobj->id); 225
226 idr_remove_uobj(&ib_uverbs_srq_idr, uobj);
225 ib_destroy_srq(srq); 227 ib_destroy_srq(srq);
226 list_del(&uobj->list); 228 list_del(&uobj->list);
227 ib_uverbs_release_uevent(file, uevent); 229 ib_uverbs_release_uevent(file, uevent);
@@ -231,11 +233,11 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
231 /* XXX Free MWs */ 233 /* XXX Free MWs */
232 234
233 list_for_each_entry_safe(uobj, tmp, &context->mr_list, list) { 235 list_for_each_entry_safe(uobj, tmp, &context->mr_list, list) {
234 struct ib_mr *mr = idr_find(&ib_uverbs_mr_idr, uobj->id); 236 struct ib_mr *mr = uobj->object;
235 struct ib_device *mrdev = mr->device; 237 struct ib_device *mrdev = mr->device;
236 struct ib_umem_object *memobj; 238 struct ib_umem_object *memobj;
237 239
238 idr_remove(&ib_uverbs_mr_idr, uobj->id); 240 idr_remove_uobj(&ib_uverbs_mr_idr, uobj);
239 ib_dereg_mr(mr); 241 ib_dereg_mr(mr);
240 242
241 memobj = container_of(uobj, struct ib_umem_object, uobject); 243 memobj = container_of(uobj, struct ib_umem_object, uobject);
@@ -246,15 +248,14 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
246 } 248 }
247 249
248 list_for_each_entry_safe(uobj, tmp, &context->pd_list, list) { 250 list_for_each_entry_safe(uobj, tmp, &context->pd_list, list) {
249 struct ib_pd *pd = idr_find(&ib_uverbs_pd_idr, uobj->id); 251 struct ib_pd *pd = uobj->object;
250 idr_remove(&ib_uverbs_pd_idr, uobj->id); 252
253 idr_remove_uobj(&ib_uverbs_pd_idr, uobj);
251 ib_dealloc_pd(pd); 254 ib_dealloc_pd(pd);
252 list_del(&uobj->list); 255 list_del(&uobj->list);
253 kfree(uobj); 256 kfree(uobj);
254 } 257 }
255 258
256 mutex_unlock(&ib_uverbs_idr_mutex);
257
258 return context->device->dealloc_ucontext(context); 259 return context->device->dealloc_ucontext(context);
259} 260}
260 261
diff --git a/drivers/infiniband/core/uverbs_marshall.c b/drivers/infiniband/core/uverbs_marshall.c
new file mode 100644
index 000000000000..ce46b13ae02b
--- /dev/null
+++ b/drivers/infiniband/core/uverbs_marshall.c
@@ -0,0 +1,138 @@
1/*
2 * Copyright (c) 2005 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#include <rdma/ib_marshall.h>
34
35static void ib_copy_ah_attr_to_user(struct ib_uverbs_ah_attr *dst,
36 struct ib_ah_attr *src)
37{
38 memcpy(dst->grh.dgid, src->grh.dgid.raw, sizeof src->grh.dgid);
39 dst->grh.flow_label = src->grh.flow_label;
40 dst->grh.sgid_index = src->grh.sgid_index;
41 dst->grh.hop_limit = src->grh.hop_limit;
42 dst->grh.traffic_class = src->grh.traffic_class;
43 dst->dlid = src->dlid;
44 dst->sl = src->sl;
45 dst->src_path_bits = src->src_path_bits;
46 dst->static_rate = src->static_rate;
47 dst->is_global = src->ah_flags & IB_AH_GRH ? 1 : 0;
48 dst->port_num = src->port_num;
49}
50
51void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst,
52 struct ib_qp_attr *src)
53{
54 dst->cur_qp_state = src->cur_qp_state;
55 dst->path_mtu = src->path_mtu;
56 dst->path_mig_state = src->path_mig_state;
57 dst->qkey = src->qkey;
58 dst->rq_psn = src->rq_psn;
59 dst->sq_psn = src->sq_psn;
60 dst->dest_qp_num = src->dest_qp_num;
61 dst->qp_access_flags = src->qp_access_flags;
62
63 dst->max_send_wr = src->cap.max_send_wr;
64 dst->max_recv_wr = src->cap.max_recv_wr;
65 dst->max_send_sge = src->cap.max_send_sge;
66 dst->max_recv_sge = src->cap.max_recv_sge;
67 dst->max_inline_data = src->cap.max_inline_data;
68
69 ib_copy_ah_attr_to_user(&dst->ah_attr, &src->ah_attr);
70 ib_copy_ah_attr_to_user(&dst->alt_ah_attr, &src->alt_ah_attr);
71
72 dst->pkey_index = src->pkey_index;
73 dst->alt_pkey_index = src->alt_pkey_index;
74 dst->en_sqd_async_notify = src->en_sqd_async_notify;
75 dst->sq_draining = src->sq_draining;
76 dst->max_rd_atomic = src->max_rd_atomic;
77 dst->max_dest_rd_atomic = src->max_dest_rd_atomic;
78 dst->min_rnr_timer = src->min_rnr_timer;
79 dst->port_num = src->port_num;
80 dst->timeout = src->timeout;
81 dst->retry_cnt = src->retry_cnt;
82 dst->rnr_retry = src->rnr_retry;
83 dst->alt_port_num = src->alt_port_num;
84 dst->alt_timeout = src->alt_timeout;
85}
86EXPORT_SYMBOL(ib_copy_qp_attr_to_user);
87
88void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst,
89 struct ib_sa_path_rec *src)
90{
91 memcpy(dst->dgid, src->dgid.raw, sizeof src->dgid);
92 memcpy(dst->sgid, src->sgid.raw, sizeof src->sgid);
93
94 dst->dlid = src->dlid;
95 dst->slid = src->slid;
96 dst->raw_traffic = src->raw_traffic;
97 dst->flow_label = src->flow_label;
98 dst->hop_limit = src->hop_limit;
99 dst->traffic_class = src->traffic_class;
100 dst->reversible = src->reversible;
101 dst->numb_path = src->numb_path;
102 dst->pkey = src->pkey;
103 dst->sl = src->sl;
104 dst->mtu_selector = src->mtu_selector;
105 dst->mtu = src->mtu;
106 dst->rate_selector = src->rate_selector;
107 dst->rate = src->rate;
108 dst->packet_life_time = src->packet_life_time;
109 dst->preference = src->preference;
110 dst->packet_life_time_selector = src->packet_life_time_selector;
111}
112EXPORT_SYMBOL(ib_copy_path_rec_to_user);
113
114void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst,
115 struct ib_user_path_rec *src)
116{
117 memcpy(dst->dgid.raw, src->dgid, sizeof dst->dgid);
118 memcpy(dst->sgid.raw, src->sgid, sizeof dst->sgid);
119
120 dst->dlid = src->dlid;
121 dst->slid = src->slid;
122 dst->raw_traffic = src->raw_traffic;
123 dst->flow_label = src->flow_label;
124 dst->hop_limit = src->hop_limit;
125 dst->traffic_class = src->traffic_class;
126 dst->reversible = src->reversible;
127 dst->numb_path = src->numb_path;
128 dst->pkey = src->pkey;
129 dst->sl = src->sl;
130 dst->mtu_selector = src->mtu_selector;
131 dst->mtu = src->mtu;
132 dst->rate_selector = src->rate_selector;
133 dst->rate = src->rate;
134 dst->packet_life_time = src->packet_life_time;
135 dst->preference = src->preference;
136 dst->packet_life_time_selector = src->packet_life_time_selector;
137}
138EXPORT_SYMBOL(ib_copy_path_rec_from_user);
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index b78e7dc69330..468999c38803 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -125,35 +125,47 @@ struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
125} 125}
126EXPORT_SYMBOL(ib_create_ah); 126EXPORT_SYMBOL(ib_create_ah);
127 127
128struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, struct ib_wc *wc, 128int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, struct ib_wc *wc,
129 struct ib_grh *grh, u8 port_num) 129 struct ib_grh *grh, struct ib_ah_attr *ah_attr)
130{ 130{
131 struct ib_ah_attr ah_attr;
132 u32 flow_class; 131 u32 flow_class;
133 u16 gid_index; 132 u16 gid_index;
134 int ret; 133 int ret;
135 134
136 memset(&ah_attr, 0, sizeof ah_attr); 135 memset(ah_attr, 0, sizeof *ah_attr);
137 ah_attr.dlid = wc->slid; 136 ah_attr->dlid = wc->slid;
138 ah_attr.sl = wc->sl; 137 ah_attr->sl = wc->sl;
139 ah_attr.src_path_bits = wc->dlid_path_bits; 138 ah_attr->src_path_bits = wc->dlid_path_bits;
140 ah_attr.port_num = port_num; 139 ah_attr->port_num = port_num;
141 140
142 if (wc->wc_flags & IB_WC_GRH) { 141 if (wc->wc_flags & IB_WC_GRH) {
143 ah_attr.ah_flags = IB_AH_GRH; 142 ah_attr->ah_flags = IB_AH_GRH;
144 ah_attr.grh.dgid = grh->sgid; 143 ah_attr->grh.dgid = grh->sgid;
145 144
146 ret = ib_find_cached_gid(pd->device, &grh->dgid, &port_num, 145 ret = ib_find_cached_gid(device, &grh->dgid, &port_num,
147 &gid_index); 146 &gid_index);
148 if (ret) 147 if (ret)
149 return ERR_PTR(ret); 148 return ret;
150 149
151 ah_attr.grh.sgid_index = (u8) gid_index; 150 ah_attr->grh.sgid_index = (u8) gid_index;
152 flow_class = be32_to_cpu(grh->version_tclass_flow); 151 flow_class = be32_to_cpu(grh->version_tclass_flow);
153 ah_attr.grh.flow_label = flow_class & 0xFFFFF; 152 ah_attr->grh.flow_label = flow_class & 0xFFFFF;
154 ah_attr.grh.traffic_class = (flow_class >> 20) & 0xFF; 153 ah_attr->grh.hop_limit = grh->hop_limit;
155 ah_attr.grh.hop_limit = grh->hop_limit; 154 ah_attr->grh.traffic_class = (flow_class >> 20) & 0xFF;
156 } 155 }
156 return 0;
157}
158EXPORT_SYMBOL(ib_init_ah_from_wc);
159
160struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, struct ib_wc *wc,
161 struct ib_grh *grh, u8 port_num)
162{
163 struct ib_ah_attr ah_attr;
164 int ret;
165
166 ret = ib_init_ah_from_wc(pd->device, port_num, wc, grh, &ah_attr);
167 if (ret)
168 return ERR_PTR(ret);
157 169
158 return ib_create_ah(pd, &ah_attr); 170 return ib_create_ah(pd, &ah_attr);
159} 171}
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c
index f7f8391fe43f..1a9d0a2c33c3 100644
--- a/drivers/infiniband/hw/ipath/ipath_mad.c
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c
@@ -137,47 +137,11 @@ static int recv_subn_get_guidinfo(struct ib_smp *smp,
137 return reply(smp); 137 return reply(smp);
138} 138}
139 139
140struct port_info {
141 __be64 mkey;
142 __be64 gid_prefix;
143 __be16 lid;
144 __be16 sm_lid;
145 __be32 cap_mask;
146 __be16 diag_code;
147 __be16 mkey_lease_period;
148 u8 local_port_num;
149 u8 link_width_enabled;
150 u8 link_width_supported;
151 u8 link_width_active;
152 u8 linkspeed_portstate; /* 4 bits, 4 bits */
153 u8 portphysstate_linkdown; /* 4 bits, 4 bits */
154 u8 mkeyprot_resv_lmc; /* 2 bits, 3, 3 */
155 u8 linkspeedactive_enabled; /* 4 bits, 4 bits */
156 u8 neighbormtu_mastersmsl; /* 4 bits, 4 bits */
157 u8 vlcap_inittype; /* 4 bits, 4 bits */
158 u8 vl_high_limit;
159 u8 vl_arb_high_cap;
160 u8 vl_arb_low_cap;
161 u8 inittypereply_mtucap; /* 4 bits, 4 bits */
162 u8 vlstallcnt_hoqlife; /* 3 bits, 5 bits */
163 u8 operationalvl_pei_peo_fpi_fpo; /* 4 bits, 1, 1, 1, 1 */
164 __be16 mkey_violations;
165 __be16 pkey_violations;
166 __be16 qkey_violations;
167 u8 guid_cap;
168 u8 clientrereg_resv_subnetto; /* 1 bit, 2 bits, 5 */
169 u8 resv_resptimevalue; /* 3 bits, 5 bits */
170 u8 localphyerrors_overrunerrors; /* 4 bits, 4 bits */
171 __be16 max_credit_hint;
172 u8 resv;
173 u8 link_roundtrip_latency[3];
174} __attribute__ ((packed));
175
176static int recv_subn_get_portinfo(struct ib_smp *smp, 140static int recv_subn_get_portinfo(struct ib_smp *smp,
177 struct ib_device *ibdev, u8 port) 141 struct ib_device *ibdev, u8 port)
178{ 142{
179 struct ipath_ibdev *dev; 143 struct ipath_ibdev *dev;
180 struct port_info *pip = (struct port_info *)smp->data; 144 struct ib_port_info *pip = (struct ib_port_info *)smp->data;
181 u16 lid; 145 u16 lid;
182 u8 ibcstat; 146 u8 ibcstat;
183 u8 mtu; 147 u8 mtu;
@@ -312,7 +276,7 @@ static int recv_subn_set_guidinfo(struct ib_smp *smp,
312static int recv_subn_set_portinfo(struct ib_smp *smp, 276static int recv_subn_set_portinfo(struct ib_smp *smp,
313 struct ib_device *ibdev, u8 port) 277 struct ib_device *ibdev, u8 port)
314{ 278{
315 struct port_info *pip = (struct port_info *)smp->data; 279 struct ib_port_info *pip = (struct ib_port_info *)smp->data;
316 struct ib_event event; 280 struct ib_event event;
317 struct ipath_ibdev *dev; 281 struct ipath_ibdev *dev;
318 u32 flags; 282 u32 flags;
@@ -445,7 +409,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp,
445 409
446 if (pip->clientrereg_resv_subnetto & 0x80) { 410 if (pip->clientrereg_resv_subnetto & 0x80) {
447 clientrereg = 1; 411 clientrereg = 1;
448 event.event = IB_EVENT_LID_CHANGE; 412 event.event = IB_EVENT_CLIENT_REREGISTER;
449 ib_dispatch_event(&event); 413 ib_dispatch_event(&event);
450 } 414 }
451 415
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
index 798e13e14faf..d0f7731802c9 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -174,7 +174,6 @@ enum {
174 174
175struct mthca_cmd_context { 175struct mthca_cmd_context {
176 struct completion done; 176 struct completion done;
177 struct timer_list timer;
178 int result; 177 int result;
179 int next; 178 int next;
180 u64 out_param; 179 u64 out_param;
@@ -362,15 +361,6 @@ void mthca_cmd_event(struct mthca_dev *dev,
362 complete(&context->done); 361 complete(&context->done);
363} 362}
364 363
365static void event_timeout(unsigned long context_ptr)
366{
367 struct mthca_cmd_context *context =
368 (struct mthca_cmd_context *) context_ptr;
369
370 context->result = -EBUSY;
371 complete(&context->done);
372}
373
374static int mthca_cmd_wait(struct mthca_dev *dev, 364static int mthca_cmd_wait(struct mthca_dev *dev,
375 u64 in_param, 365 u64 in_param,
376 u64 *out_param, 366 u64 *out_param,
@@ -401,11 +391,10 @@ static int mthca_cmd_wait(struct mthca_dev *dev,
401 if (err) 391 if (err)
402 goto out; 392 goto out;
403 393
404 context->timer.expires = jiffies + timeout; 394 if (!wait_for_completion_timeout(&context->done, timeout)) {
405 add_timer(&context->timer); 395 err = -EBUSY;
406 396 goto out;
407 wait_for_completion(&context->done); 397 }
408 del_timer_sync(&context->timer);
409 398
410 err = context->result; 399 err = context->result;
411 if (err) 400 if (err)
@@ -535,10 +524,6 @@ int mthca_cmd_use_events(struct mthca_dev *dev)
535 for (i = 0; i < dev->cmd.max_cmds; ++i) { 524 for (i = 0; i < dev->cmd.max_cmds; ++i) {
536 dev->cmd.context[i].token = i; 525 dev->cmd.context[i].token = i;
537 dev->cmd.context[i].next = i + 1; 526 dev->cmd.context[i].next = i + 1;
538 init_timer(&dev->cmd.context[i].timer);
539 dev->cmd.context[i].timer.data =
540 (unsigned long) &dev->cmd.context[i];
541 dev->cmd.context[i].timer.function = event_timeout;
542 } 527 }
543 528
544 dev->cmd.context[dev->cmd.max_cmds - 1].next = -1; 529 dev->cmd.context[dev->cmd.max_cmds - 1].next = -1;
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 205854e9c662..3e27a084257e 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -540,8 +540,17 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
540 entry->wr_id = srq->wrid[wqe_index]; 540 entry->wr_id = srq->wrid[wqe_index];
541 mthca_free_srq_wqe(srq, wqe); 541 mthca_free_srq_wqe(srq, wqe);
542 } else { 542 } else {
543 s32 wqe;
543 wq = &(*cur_qp)->rq; 544 wq = &(*cur_qp)->rq;
544 wqe_index = be32_to_cpu(cqe->wqe) >> wq->wqe_shift; 545 wqe = be32_to_cpu(cqe->wqe);
546 wqe_index = wqe >> wq->wqe_shift;
547 /*
548 * WQE addr == base - 1 might be reported in receive completion
549 * with error instead of (rq size - 1) by Sinai FW 1.0.800 and
550 * Arbel FW 5.1.400. This bug should be fixed in later FW revs.
551 */
552 if (unlikely(wqe_index < 0))
553 wqe_index = wq->max - 1;
545 entry->wr_id = (*cur_qp)->wrid[wqe_index]; 554 entry->wr_id = (*cur_qp)->wrid[wqe_index];
546 } 555 }
547 556
@@ -813,6 +822,7 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
813 spin_lock_init(&cq->lock); 822 spin_lock_init(&cq->lock);
814 cq->refcount = 1; 823 cq->refcount = 1;
815 init_waitqueue_head(&cq->wait); 824 init_waitqueue_head(&cq->wait);
825 mutex_init(&cq->mutex);
816 826
817 memset(cq_context, 0, sizeof *cq_context); 827 memset(cq_context, 0, sizeof *cq_context);
818 cq_context->flags = cpu_to_be32(MTHCA_CQ_STATUS_OK | 828 cq_context->flags = cpu_to_be32(MTHCA_CQ_STATUS_OK |
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
index 99f109c3815d..d536217e700e 100644
--- a/drivers/infiniband/hw/mthca/mthca_eq.c
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c
@@ -695,10 +695,6 @@ static void mthca_unmap_reg(struct mthca_dev *dev, unsigned long offset,
695 695
696static int __devinit mthca_map_eq_regs(struct mthca_dev *dev) 696static int __devinit mthca_map_eq_regs(struct mthca_dev *dev)
697{ 697{
698 unsigned long mthca_base;
699
700 mthca_base = pci_resource_start(dev->pdev, 0);
701
702 if (mthca_is_memfree(dev)) { 698 if (mthca_is_memfree(dev)) {
703 /* 699 /*
704 * We assume that the EQ arm and EQ set CI registers 700 * We assume that the EQ arm and EQ set CI registers
diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c
index 4730863ece9a..d9bc030bcccc 100644
--- a/drivers/infiniband/hw/mthca/mthca_mad.c
+++ b/drivers/infiniband/hw/mthca/mthca_mad.c
@@ -114,14 +114,22 @@ static void smp_snoop(struct ib_device *ibdev,
114 mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) && 114 mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) &&
115 mad->mad_hdr.method == IB_MGMT_METHOD_SET) { 115 mad->mad_hdr.method == IB_MGMT_METHOD_SET) {
116 if (mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO) { 116 if (mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO) {
117 struct ib_port_info *pinfo =
118 (struct ib_port_info *) ((struct ib_smp *) mad)->data;
119
117 mthca_update_rate(to_mdev(ibdev), port_num); 120 mthca_update_rate(to_mdev(ibdev), port_num);
118 update_sm_ah(to_mdev(ibdev), port_num, 121 update_sm_ah(to_mdev(ibdev), port_num,
119 be16_to_cpup((__be16 *) (mad->data + 58)), 122 be16_to_cpu(pinfo->lid),
120 (*(u8 *) (mad->data + 76)) & 0xf); 123 pinfo->neighbormtu_mastersmsl & 0xf);
121 124
122 event.device = ibdev; 125 event.device = ibdev;
123 event.event = IB_EVENT_LID_CHANGE;
124 event.element.port_num = port_num; 126 event.element.port_num = port_num;
127
128 if(pinfo->clientrereg_resv_subnetto & 0x80)
129 event.event = IB_EVENT_CLIENT_REREGISTER;
130 else
131 event.event = IB_EVENT_LID_CHANGE;
132
125 ib_dispatch_event(&event); 133 ib_dispatch_event(&event);
126 } 134 }
127 135
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index a2eae8a30167..230ae21db8fd 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -115,6 +115,16 @@ static int mthca_query_device(struct ib_device *ibdev,
115 props->max_mcast_qp_attach = MTHCA_QP_PER_MGM; 115 props->max_mcast_qp_attach = MTHCA_QP_PER_MGM;
116 props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * 116 props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
117 props->max_mcast_grp; 117 props->max_mcast_grp;
118 /*
119 * If Sinai memory key optimization is being used, then only
120 * the 8-bit key portion will change. For other HCAs, the
121 * unused index bits will also be used for FMR remapping.
122 */
123 if (mdev->mthca_flags & MTHCA_FLAG_SINAI_OPT)
124 props->max_map_per_fmr = 255;
125 else
126 props->max_map_per_fmr =
127 (1 << (32 - long_log2(mdev->limits.num_mpts))) - 1;
118 128
119 err = 0; 129 err = 0;
120 out: 130 out:
@@ -783,18 +793,24 @@ static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *uda
783 if (entries < 1 || entries > dev->limits.max_cqes) 793 if (entries < 1 || entries > dev->limits.max_cqes)
784 return -EINVAL; 794 return -EINVAL;
785 795
796 mutex_lock(&cq->mutex);
797
786 entries = roundup_pow_of_two(entries + 1); 798 entries = roundup_pow_of_two(entries + 1);
787 if (entries == ibcq->cqe + 1) 799 if (entries == ibcq->cqe + 1) {
788 return 0; 800 ret = 0;
801 goto out;
802 }
789 803
790 if (cq->is_kernel) { 804 if (cq->is_kernel) {
791 ret = mthca_alloc_resize_buf(dev, cq, entries); 805 ret = mthca_alloc_resize_buf(dev, cq, entries);
792 if (ret) 806 if (ret)
793 return ret; 807 goto out;
794 lkey = cq->resize_buf->buf.mr.ibmr.lkey; 808 lkey = cq->resize_buf->buf.mr.ibmr.lkey;
795 } else { 809 } else {
796 if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) 810 if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) {
797 return -EFAULT; 811 ret = -EFAULT;
812 goto out;
813 }
798 lkey = ucmd.lkey; 814 lkey = ucmd.lkey;
799 } 815 }
800 816
@@ -811,7 +827,7 @@ static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *uda
811 cq->resize_buf = NULL; 827 cq->resize_buf = NULL;
812 spin_unlock_irq(&cq->lock); 828 spin_unlock_irq(&cq->lock);
813 } 829 }
814 return ret; 830 goto out;
815 } 831 }
816 832
817 if (cq->is_kernel) { 833 if (cq->is_kernel) {
@@ -838,7 +854,10 @@ static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *uda
838 } else 854 } else
839 ibcq->cqe = entries - 1; 855 ibcq->cqe = entries - 1;
840 856
841 return 0; 857out:
858 mutex_unlock(&cq->mutex);
859
860 return ret;
842} 861}
843 862
844static int mthca_destroy_cq(struct ib_cq *cq) 863static int mthca_destroy_cq(struct ib_cq *cq)
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.h b/drivers/infiniband/hw/mthca/mthca_provider.h
index 179a8f610d0f..8de2887ba15c 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.h
+++ b/drivers/infiniband/hw/mthca/mthca_provider.h
@@ -214,6 +214,7 @@ struct mthca_cq {
214 int arm_sn; 214 int arm_sn;
215 215
216 wait_queue_head_t wait; 216 wait_queue_head_t wait;
217 struct mutex mutex;
217}; 218};
218 219
219struct mthca_srq { 220struct mthca_srq {
@@ -237,6 +238,7 @@ struct mthca_srq {
237 struct mthca_mr mr; 238 struct mthca_mr mr;
238 239
239 wait_queue_head_t wait; 240 wait_queue_head_t wait;
241 struct mutex mutex;
240}; 242};
241 243
242struct mthca_wq { 244struct mthca_wq {
@@ -278,6 +280,7 @@ struct mthca_qp {
278 union mthca_buf queue; 280 union mthca_buf queue;
279 281
280 wait_queue_head_t wait; 282 wait_queue_head_t wait;
283 struct mutex mutex;
281}; 284};
282 285
283struct mthca_sqp { 286struct mthca_sqp {
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 07c13be07a4a..16c387d8170c 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -534,7 +534,9 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
534 struct mthca_qp_context *qp_context; 534 struct mthca_qp_context *qp_context;
535 u32 sqd_event = 0; 535 u32 sqd_event = 0;
536 u8 status; 536 u8 status;
537 int err; 537 int err = -EINVAL;
538
539 mutex_lock(&qp->mutex);
538 540
539 if (attr_mask & IB_QP_CUR_STATE) { 541 if (attr_mask & IB_QP_CUR_STATE) {
540 cur_state = attr->cur_qp_state; 542 cur_state = attr->cur_qp_state;
@@ -553,39 +555,41 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
553 "%d->%d with attr 0x%08x\n", 555 "%d->%d with attr 0x%08x\n",
554 qp->transport, cur_state, new_state, 556 qp->transport, cur_state, new_state,
555 attr_mask); 557 attr_mask);
556 return -EINVAL; 558 goto out;
557 } 559 }
558 560
559 if ((attr_mask & IB_QP_PKEY_INDEX) && 561 if ((attr_mask & IB_QP_PKEY_INDEX) &&
560 attr->pkey_index >= dev->limits.pkey_table_len) { 562 attr->pkey_index >= dev->limits.pkey_table_len) {
561 mthca_dbg(dev, "P_Key index (%u) too large. max is %d\n", 563 mthca_dbg(dev, "P_Key index (%u) too large. max is %d\n",
562 attr->pkey_index, dev->limits.pkey_table_len-1); 564 attr->pkey_index, dev->limits.pkey_table_len-1);
563 return -EINVAL; 565 goto out;
564 } 566 }
565 567
566 if ((attr_mask & IB_QP_PORT) && 568 if ((attr_mask & IB_QP_PORT) &&
567 (attr->port_num == 0 || attr->port_num > dev->limits.num_ports)) { 569 (attr->port_num == 0 || attr->port_num > dev->limits.num_ports)) {
568 mthca_dbg(dev, "Port number (%u) is invalid\n", attr->port_num); 570 mthca_dbg(dev, "Port number (%u) is invalid\n", attr->port_num);
569 return -EINVAL; 571 goto out;
570 } 572 }
571 573
572 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && 574 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC &&
573 attr->max_rd_atomic > dev->limits.max_qp_init_rdma) { 575 attr->max_rd_atomic > dev->limits.max_qp_init_rdma) {
574 mthca_dbg(dev, "Max rdma_atomic as initiator %u too large (max is %d)\n", 576 mthca_dbg(dev, "Max rdma_atomic as initiator %u too large (max is %d)\n",
575 attr->max_rd_atomic, dev->limits.max_qp_init_rdma); 577 attr->max_rd_atomic, dev->limits.max_qp_init_rdma);
576 return -EINVAL; 578 goto out;
577 } 579 }
578 580
579 if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && 581 if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC &&
580 attr->max_dest_rd_atomic > 1 << dev->qp_table.rdb_shift) { 582 attr->max_dest_rd_atomic > 1 << dev->qp_table.rdb_shift) {
581 mthca_dbg(dev, "Max rdma_atomic as responder %u too large (max %d)\n", 583 mthca_dbg(dev, "Max rdma_atomic as responder %u too large (max %d)\n",
582 attr->max_dest_rd_atomic, 1 << dev->qp_table.rdb_shift); 584 attr->max_dest_rd_atomic, 1 << dev->qp_table.rdb_shift);
583 return -EINVAL; 585 goto out;
584 } 586 }
585 587
586 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); 588 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
587 if (IS_ERR(mailbox)) 589 if (IS_ERR(mailbox)) {
588 return PTR_ERR(mailbox); 590 err = PTR_ERR(mailbox);
591 goto out;
592 }
589 qp_param = mailbox->buf; 593 qp_param = mailbox->buf;
590 qp_context = &qp_param->context; 594 qp_context = &qp_param->context;
591 memset(qp_param, 0, sizeof *qp_param); 595 memset(qp_param, 0, sizeof *qp_param);
@@ -618,7 +622,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
618 if (attr->path_mtu < IB_MTU_256 || attr->path_mtu > IB_MTU_2048) { 622 if (attr->path_mtu < IB_MTU_256 || attr->path_mtu > IB_MTU_2048) {
619 mthca_dbg(dev, "path MTU (%u) is invalid\n", 623 mthca_dbg(dev, "path MTU (%u) is invalid\n",
620 attr->path_mtu); 624 attr->path_mtu);
621 return -EINVAL; 625 goto out_mailbox;
622 } 626 }
623 qp_context->mtu_msgmax = (attr->path_mtu << 5) | 31; 627 qp_context->mtu_msgmax = (attr->path_mtu << 5) | 31;
624 } 628 }
@@ -672,7 +676,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
672 if (attr_mask & IB_QP_AV) { 676 if (attr_mask & IB_QP_AV) {
673 if (mthca_path_set(dev, &attr->ah_attr, &qp_context->pri_path, 677 if (mthca_path_set(dev, &attr->ah_attr, &qp_context->pri_path,
674 attr_mask & IB_QP_PORT ? attr->port_num : qp->port)) 678 attr_mask & IB_QP_PORT ? attr->port_num : qp->port))
675 return -EINVAL; 679 goto out_mailbox;
676 680
677 qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_PRIMARY_ADDR_PATH); 681 qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_PRIMARY_ADDR_PATH);
678 } 682 }
@@ -686,18 +690,18 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
686 if (attr->alt_pkey_index >= dev->limits.pkey_table_len) { 690 if (attr->alt_pkey_index >= dev->limits.pkey_table_len) {
687 mthca_dbg(dev, "Alternate P_Key index (%u) too large. max is %d\n", 691 mthca_dbg(dev, "Alternate P_Key index (%u) too large. max is %d\n",
688 attr->alt_pkey_index, dev->limits.pkey_table_len-1); 692 attr->alt_pkey_index, dev->limits.pkey_table_len-1);
689 return -EINVAL; 693 goto out_mailbox;
690 } 694 }
691 695
692 if (attr->alt_port_num == 0 || attr->alt_port_num > dev->limits.num_ports) { 696 if (attr->alt_port_num == 0 || attr->alt_port_num > dev->limits.num_ports) {
693 mthca_dbg(dev, "Alternate port number (%u) is invalid\n", 697 mthca_dbg(dev, "Alternate port number (%u) is invalid\n",
694 attr->alt_port_num); 698 attr->alt_port_num);
695 return -EINVAL; 699 goto out_mailbox;
696 } 700 }
697 701
698 if (mthca_path_set(dev, &attr->alt_ah_attr, &qp_context->alt_path, 702 if (mthca_path_set(dev, &attr->alt_ah_attr, &qp_context->alt_path,
699 attr->alt_ah_attr.port_num)) 703 attr->alt_ah_attr.port_num))
700 return -EINVAL; 704 goto out_mailbox;
701 705
702 qp_context->alt_path.port_pkey |= cpu_to_be32(attr->alt_pkey_index | 706 qp_context->alt_path.port_pkey |= cpu_to_be32(attr->alt_pkey_index |
703 attr->alt_port_num << 24); 707 attr->alt_port_num << 24);
@@ -793,12 +797,12 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
793 err = mthca_MODIFY_QP(dev, cur_state, new_state, qp->qpn, 0, 797 err = mthca_MODIFY_QP(dev, cur_state, new_state, qp->qpn, 0,
794 mailbox, sqd_event, &status); 798 mailbox, sqd_event, &status);
795 if (err) 799 if (err)
796 goto out; 800 goto out_mailbox;
797 if (status) { 801 if (status) {
798 mthca_warn(dev, "modify QP %d->%d returned status %02x.\n", 802 mthca_warn(dev, "modify QP %d->%d returned status %02x.\n",
799 cur_state, new_state, status); 803 cur_state, new_state, status);
800 err = -EINVAL; 804 err = -EINVAL;
801 goto out; 805 goto out_mailbox;
802 } 806 }
803 807
804 qp->state = new_state; 808 qp->state = new_state;
@@ -853,8 +857,11 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
853 } 857 }
854 } 858 }
855 859
856out: 860out_mailbox:
857 mthca_free_mailbox(dev, mailbox); 861 mthca_free_mailbox(dev, mailbox);
862
863out:
864 mutex_unlock(&qp->mutex);
858 return err; 865 return err;
859} 866}
860 867
@@ -1100,6 +1107,7 @@ static int mthca_alloc_qp_common(struct mthca_dev *dev,
1100 1107
1101 qp->refcount = 1; 1108 qp->refcount = 1;
1102 init_waitqueue_head(&qp->wait); 1109 init_waitqueue_head(&qp->wait);
1110 mutex_init(&qp->mutex);
1103 qp->state = IB_QPS_RESET; 1111 qp->state = IB_QPS_RESET;
1104 qp->atomic_rd_en = 0; 1112 qp->atomic_rd_en = 0;
1105 qp->resp_depth = 0; 1113 qp->resp_depth = 0;
diff --git a/drivers/infiniband/hw/mthca/mthca_reset.c b/drivers/infiniband/hw/mthca/mthca_reset.c
index df5e494a9d38..f4fddd5327f5 100644
--- a/drivers/infiniband/hw/mthca/mthca_reset.c
+++ b/drivers/infiniband/hw/mthca/mthca_reset.c
@@ -49,6 +49,12 @@ int mthca_reset(struct mthca_dev *mdev)
49 u32 *hca_header = NULL; 49 u32 *hca_header = NULL;
50 u32 *bridge_header = NULL; 50 u32 *bridge_header = NULL;
51 struct pci_dev *bridge = NULL; 51 struct pci_dev *bridge = NULL;
52 int bridge_pcix_cap = 0;
53 int hca_pcie_cap = 0;
54 int hca_pcix_cap = 0;
55
56 u16 devctl;
57 u16 linkctl;
52 58
53#define MTHCA_RESET_OFFSET 0xf0010 59#define MTHCA_RESET_OFFSET 0xf0010
54#define MTHCA_RESET_VALUE swab32(1) 60#define MTHCA_RESET_VALUE swab32(1)
@@ -110,6 +116,9 @@ int mthca_reset(struct mthca_dev *mdev)
110 } 116 }
111 } 117 }
112 118
119 hca_pcix_cap = pci_find_capability(mdev->pdev, PCI_CAP_ID_PCIX);
120 hca_pcie_cap = pci_find_capability(mdev->pdev, PCI_CAP_ID_EXP);
121
113 if (bridge) { 122 if (bridge) {
114 bridge_header = kmalloc(256, GFP_KERNEL); 123 bridge_header = kmalloc(256, GFP_KERNEL);
115 if (!bridge_header) { 124 if (!bridge_header) {
@@ -129,6 +138,13 @@ int mthca_reset(struct mthca_dev *mdev)
129 goto out; 138 goto out;
130 } 139 }
131 } 140 }
141 bridge_pcix_cap = pci_find_capability(bridge, PCI_CAP_ID_PCIX);
142 if (!bridge_pcix_cap) {
143 err = -ENODEV;
144 mthca_err(mdev, "Couldn't locate HCA bridge "
145 "PCI-X capability, aborting.\n");
146 goto out;
147 }
132 } 148 }
133 149
134 /* actually hit reset */ 150 /* actually hit reset */
@@ -178,6 +194,20 @@ int mthca_reset(struct mthca_dev *mdev)
178good: 194good:
179 /* Now restore the PCI headers */ 195 /* Now restore the PCI headers */
180 if (bridge) { 196 if (bridge) {
197 if (pci_write_config_dword(bridge, bridge_pcix_cap + 0x8,
198 bridge_header[(bridge_pcix_cap + 0x8) / 4])) {
199 err = -ENODEV;
200 mthca_err(mdev, "Couldn't restore HCA bridge Upstream "
201 "split transaction control, aborting.\n");
202 goto out;
203 }
204 if (pci_write_config_dword(bridge, bridge_pcix_cap + 0xc,
205 bridge_header[(bridge_pcix_cap + 0xc) / 4])) {
206 err = -ENODEV;
207 mthca_err(mdev, "Couldn't restore HCA bridge Downstream "
208 "split transaction control, aborting.\n");
209 goto out;
210 }
181 /* 211 /*
182 * Bridge control register is at 0x3e, so we'll 212 * Bridge control register is at 0x3e, so we'll
183 * naturally restore it last in this loop. 213 * naturally restore it last in this loop.
@@ -203,6 +233,35 @@ good:
203 } 233 }
204 } 234 }
205 235
236 if (hca_pcix_cap) {
237 if (pci_write_config_dword(mdev->pdev, hca_pcix_cap,
238 hca_header[hca_pcix_cap / 4])) {
239 err = -ENODEV;
240 mthca_err(mdev, "Couldn't restore HCA PCI-X "
241 "command register, aborting.\n");
242 goto out;
243 }
244 }
245
246 if (hca_pcie_cap) {
247 devctl = hca_header[(hca_pcie_cap + PCI_EXP_DEVCTL) / 4];
248 if (pci_write_config_word(mdev->pdev, hca_pcie_cap + PCI_EXP_DEVCTL,
249 devctl)) {
250 err = -ENODEV;
251 mthca_err(mdev, "Couldn't restore HCA PCI Express "
252 "Device Control register, aborting.\n");
253 goto out;
254 }
255 linkctl = hca_header[(hca_pcie_cap + PCI_EXP_LNKCTL) / 4];
256 if (pci_write_config_word(mdev->pdev, hca_pcie_cap + PCI_EXP_LNKCTL,
257 linkctl)) {
258 err = -ENODEV;
259 mthca_err(mdev, "Couldn't restore HCA PCI Express "
260 "Link control register, aborting.\n");
261 goto out;
262 }
263 }
264
206 for (i = 0; i < 16; ++i) { 265 for (i = 0; i < 16; ++i) {
207 if (i * 4 == PCI_COMMAND) 266 if (i * 4 == PCI_COMMAND)
208 continue; 267 continue;
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index b292fefa3b41..fab417c5cf43 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -243,6 +243,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd,
243 spin_lock_init(&srq->lock); 243 spin_lock_init(&srq->lock);
244 srq->refcount = 1; 244 srq->refcount = 1;
245 init_waitqueue_head(&srq->wait); 245 init_waitqueue_head(&srq->wait);
246 mutex_init(&srq->mutex);
246 247
247 if (mthca_is_memfree(dev)) 248 if (mthca_is_memfree(dev))
248 mthca_arbel_init_srq_context(dev, pd, srq, mailbox->buf); 249 mthca_arbel_init_srq_context(dev, pd, srq, mailbox->buf);
@@ -371,7 +372,11 @@ int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
371 if (attr_mask & IB_SRQ_LIMIT) { 372 if (attr_mask & IB_SRQ_LIMIT) {
372 if (attr->srq_limit > srq->max) 373 if (attr->srq_limit > srq->max)
373 return -EINVAL; 374 return -EINVAL;
375
376 mutex_lock(&srq->mutex);
374 ret = mthca_ARM_SRQ(dev, srq->srqn, attr->srq_limit, &status); 377 ret = mthca_ARM_SRQ(dev, srq->srqn, attr->srq_limit, &status);
378 mutex_unlock(&srq->mutex);
379
375 if (ret) 380 if (ret)
376 return ret; 381 return ret;
377 if (status) 382 if (status)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 12a1e0572ef2..491d2afaf5b4 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -272,8 +272,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port);
272void ipoib_dev_cleanup(struct net_device *dev); 272void ipoib_dev_cleanup(struct net_device *dev);
273 273
274void ipoib_mcast_join_task(void *dev_ptr); 274void ipoib_mcast_join_task(void *dev_ptr);
275void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid, 275void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb);
276 struct sk_buff *skb);
277 276
278void ipoib_mcast_restart_task(void *dev_ptr); 277void ipoib_mcast_restart_task(void *dev_ptr);
279int ipoib_mcast_start_thread(struct net_device *dev); 278int ipoib_mcast_start_thread(struct net_device *dev);
@@ -369,15 +368,26 @@ extern int ipoib_debug_level;
369#endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */ 368#endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */
370 369
371 370
372#define IPOIB_GID_FMT "%x:%x:%x:%x:%x:%x:%x:%x" 371#define IPOIB_GID_FMT "%2.2x%2.2x:%2.2x%2.2x:%2.2x%2.2x:%2.2x%2.2x:" \
373 372 "%2.2x%2.2x:%2.2x%2.2x:%2.2x%2.2x:%2.2x%2.2x"
374#define IPOIB_GID_ARG(gid) be16_to_cpup((__be16 *) ((gid).raw + 0)), \ 373
375 be16_to_cpup((__be16 *) ((gid).raw + 2)), \ 374#define IPOIB_GID_RAW_ARG(gid) ((u8 *)(gid))[0], \
376 be16_to_cpup((__be16 *) ((gid).raw + 4)), \ 375 ((u8 *)(gid))[1], \
377 be16_to_cpup((__be16 *) ((gid).raw + 6)), \ 376 ((u8 *)(gid))[2], \
378 be16_to_cpup((__be16 *) ((gid).raw + 8)), \ 377 ((u8 *)(gid))[3], \
379 be16_to_cpup((__be16 *) ((gid).raw + 10)), \ 378 ((u8 *)(gid))[4], \
380 be16_to_cpup((__be16 *) ((gid).raw + 12)), \ 379 ((u8 *)(gid))[5], \
381 be16_to_cpup((__be16 *) ((gid).raw + 14)) 380 ((u8 *)(gid))[6], \
381 ((u8 *)(gid))[7], \
382 ((u8 *)(gid))[8], \
383 ((u8 *)(gid))[9], \
384 ((u8 *)(gid))[10],\
385 ((u8 *)(gid))[11],\
386 ((u8 *)(gid))[12],\
387 ((u8 *)(gid))[13],\
388 ((u8 *)(gid))[14],\
389 ((u8 *)(gid))[15]
390
391#define IPOIB_GID_ARG(gid) IPOIB_GID_RAW_ARG((gid).raw)
382 392
383#endif /* _IPOIB_H */ 393#endif /* _IPOIB_H */
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 8406839b91cf..5033666b1481 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -84,15 +84,9 @@ void ipoib_free_ah(struct kref *kref)
84 84
85 unsigned long flags; 85 unsigned long flags;
86 86
87 if ((int) priv->tx_tail - (int) ah->last_send >= 0) { 87 spin_lock_irqsave(&priv->lock, flags);
88 ipoib_dbg(priv, "Freeing ah %p\n", ah->ah); 88 list_add_tail(&ah->list, &priv->dead_ahs);
89 ib_destroy_ah(ah->ah); 89 spin_unlock_irqrestore(&priv->lock, flags);
90 kfree(ah);
91 } else {
92 spin_lock_irqsave(&priv->lock, flags);
93 list_add_tail(&ah->list, &priv->dead_ahs);
94 spin_unlock_irqrestore(&priv->lock, flags);
95 }
96} 90}
97 91
98static int ipoib_ib_post_receive(struct net_device *dev, int id) 92static int ipoib_ib_post_receive(struct net_device *dev, int id)
@@ -377,19 +371,16 @@ static void __ipoib_reap_ah(struct net_device *dev)
377 struct ipoib_ah *ah, *tah; 371 struct ipoib_ah *ah, *tah;
378 LIST_HEAD(remove_list); 372 LIST_HEAD(remove_list);
379 373
380 spin_lock_irq(&priv->lock); 374 spin_lock_irq(&priv->tx_lock);
375 spin_lock(&priv->lock);
381 list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list) 376 list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list)
382 if ((int) priv->tx_tail - (int) ah->last_send >= 0) { 377 if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
383 list_del(&ah->list); 378 list_del(&ah->list);
384 list_add_tail(&ah->list, &remove_list); 379 ib_destroy_ah(ah->ah);
380 kfree(ah);
385 } 381 }
386 spin_unlock_irq(&priv->lock); 382 spin_unlock(&priv->lock);
387 383 spin_unlock_irq(&priv->tx_lock);
388 list_for_each_entry_safe(ah, tah, &remove_list, list) {
389 ipoib_dbg(priv, "Reaping ah %p\n", ah->ah);
390 ib_destroy_ah(ah->ah);
391 kfree(ah);
392 }
393} 384}
394 385
395void ipoib_reap_ah(void *dev_ptr) 386void ipoib_reap_ah(void *dev_ptr)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index cb078a7d0bf5..1c6ea1c682a5 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -185,8 +185,7 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
185 return 0; 185 return 0;
186} 186}
187 187
188static struct ipoib_path *__path_find(struct net_device *dev, 188static struct ipoib_path *__path_find(struct net_device *dev, void *gid)
189 union ib_gid *gid)
190{ 189{
191 struct ipoib_dev_priv *priv = netdev_priv(dev); 190 struct ipoib_dev_priv *priv = netdev_priv(dev);
192 struct rb_node *n = priv->path_tree.rb_node; 191 struct rb_node *n = priv->path_tree.rb_node;
@@ -196,7 +195,7 @@ static struct ipoib_path *__path_find(struct net_device *dev,
196 while (n) { 195 while (n) {
197 path = rb_entry(n, struct ipoib_path, rb_node); 196 path = rb_entry(n, struct ipoib_path, rb_node);
198 197
199 ret = memcmp(gid->raw, path->pathrec.dgid.raw, 198 ret = memcmp(gid, path->pathrec.dgid.raw,
200 sizeof (union ib_gid)); 199 sizeof (union ib_gid));
201 200
202 if (ret < 0) 201 if (ret < 0)
@@ -424,8 +423,7 @@ static void path_rec_completion(int status,
424 } 423 }
425} 424}
426 425
427static struct ipoib_path *path_rec_create(struct net_device *dev, 426static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
428 union ib_gid *gid)
429{ 427{
430 struct ipoib_dev_priv *priv = netdev_priv(dev); 428 struct ipoib_dev_priv *priv = netdev_priv(dev);
431 struct ipoib_path *path; 429 struct ipoib_path *path;
@@ -440,7 +438,7 @@ static struct ipoib_path *path_rec_create(struct net_device *dev,
440 438
441 INIT_LIST_HEAD(&path->neigh_list); 439 INIT_LIST_HEAD(&path->neigh_list);
442 440
443 memcpy(path->pathrec.dgid.raw, gid->raw, sizeof (union ib_gid)); 441 memcpy(path->pathrec.dgid.raw, gid, sizeof (union ib_gid));
444 path->pathrec.sgid = priv->local_gid; 442 path->pathrec.sgid = priv->local_gid;
445 path->pathrec.pkey = cpu_to_be16(priv->pkey); 443 path->pathrec.pkey = cpu_to_be16(priv->pkey);
446 path->pathrec.numb_path = 1; 444 path->pathrec.numb_path = 1;
@@ -498,10 +496,9 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
498 */ 496 */
499 spin_lock(&priv->lock); 497 spin_lock(&priv->lock);
500 498
501 path = __path_find(dev, (union ib_gid *) (skb->dst->neighbour->ha + 4)); 499 path = __path_find(dev, skb->dst->neighbour->ha + 4);
502 if (!path) { 500 if (!path) {
503 path = path_rec_create(dev, 501 path = path_rec_create(dev, skb->dst->neighbour->ha + 4);
504 (union ib_gid *) (skb->dst->neighbour->ha + 4));
505 if (!path) 502 if (!path)
506 goto err_path; 503 goto err_path;
507 504
@@ -551,7 +548,7 @@ static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev)
551 /* Add in the P_Key for multicasts */ 548 /* Add in the P_Key for multicasts */
552 skb->dst->neighbour->ha[8] = (priv->pkey >> 8) & 0xff; 549 skb->dst->neighbour->ha[8] = (priv->pkey >> 8) & 0xff;
553 skb->dst->neighbour->ha[9] = priv->pkey & 0xff; 550 skb->dst->neighbour->ha[9] = priv->pkey & 0xff;
554 ipoib_mcast_send(dev, (union ib_gid *) (skb->dst->neighbour->ha + 4), skb); 551 ipoib_mcast_send(dev, skb->dst->neighbour->ha + 4, skb);
555} 552}
556 553
557static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, 554static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
@@ -566,10 +563,9 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
566 */ 563 */
567 spin_lock(&priv->lock); 564 spin_lock(&priv->lock);
568 565
569 path = __path_find(dev, (union ib_gid *) (phdr->hwaddr + 4)); 566 path = __path_find(dev, phdr->hwaddr + 4);
570 if (!path) { 567 if (!path) {
571 path = path_rec_create(dev, 568 path = path_rec_create(dev, phdr->hwaddr + 4);
572 (union ib_gid *) (phdr->hwaddr + 4));
573 if (path) { 569 if (path) {
574 /* put pseudoheader back on for next time */ 570 /* put pseudoheader back on for next time */
575 skb_push(skb, sizeof *phdr); 571 skb_push(skb, sizeof *phdr);
@@ -660,7 +656,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
660 phdr->hwaddr[8] = (priv->pkey >> 8) & 0xff; 656 phdr->hwaddr[8] = (priv->pkey >> 8) & 0xff;
661 phdr->hwaddr[9] = priv->pkey & 0xff; 657 phdr->hwaddr[9] = priv->pkey & 0xff;
662 658
663 ipoib_mcast_send(dev, (union ib_gid *) (phdr->hwaddr + 4), skb); 659 ipoib_mcast_send(dev, phdr->hwaddr + 4, skb);
664 } else { 660 } else {
665 /* unicast GID -- should be ARP or RARP reply */ 661 /* unicast GID -- should be ARP or RARP reply */
666 662
@@ -671,7 +667,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
671 skb->dst ? "neigh" : "dst", 667 skb->dst ? "neigh" : "dst",
672 be16_to_cpup((__be16 *) skb->data), 668 be16_to_cpup((__be16 *) skb->data),
673 be32_to_cpup((__be32 *) phdr->hwaddr), 669 be32_to_cpup((__be32 *) phdr->hwaddr),
674 IPOIB_GID_ARG(*(union ib_gid *) (phdr->hwaddr + 4))); 670 IPOIB_GID_RAW_ARG(phdr->hwaddr + 4));
675 dev_kfree_skb_any(skb); 671 dev_kfree_skb_any(skb);
676 ++priv->stats.tx_dropped; 672 ++priv->stats.tx_dropped;
677 goto out; 673 goto out;
@@ -754,7 +750,7 @@ static void ipoib_neigh_destructor(struct neighbour *n)
754 ipoib_dbg(priv, 750 ipoib_dbg(priv,
755 "neigh_destructor for %06x " IPOIB_GID_FMT "\n", 751 "neigh_destructor for %06x " IPOIB_GID_FMT "\n",
756 be32_to_cpup((__be32 *) n->ha), 752 be32_to_cpup((__be32 *) n->ha),
757 IPOIB_GID_ARG(*((union ib_gid *) (n->ha + 4)))); 753 IPOIB_GID_RAW_ARG(n->ha + 4));
758 754
759 spin_lock_irqsave(&priv->lock, flags); 755 spin_lock_irqsave(&priv->lock, flags);
760 756
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 1dae4b238252..216471fa01cc 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -154,7 +154,7 @@ static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev,
154 return mcast; 154 return mcast;
155} 155}
156 156
157static struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, union ib_gid *mgid) 157static struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid)
158{ 158{
159 struct ipoib_dev_priv *priv = netdev_priv(dev); 159 struct ipoib_dev_priv *priv = netdev_priv(dev);
160 struct rb_node *n = priv->multicast_tree.rb_node; 160 struct rb_node *n = priv->multicast_tree.rb_node;
@@ -165,7 +165,7 @@ static struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, union ib_g
165 165
166 mcast = rb_entry(n, struct ipoib_mcast, rb_node); 166 mcast = rb_entry(n, struct ipoib_mcast, rb_node);
167 167
168 ret = memcmp(mgid->raw, mcast->mcmember.mgid.raw, 168 ret = memcmp(mgid, mcast->mcmember.mgid.raw,
169 sizeof (union ib_gid)); 169 sizeof (union ib_gid));
170 if (ret < 0) 170 if (ret < 0)
171 n = n->rb_left; 171 n = n->rb_left;
@@ -694,8 +694,7 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
694 return 0; 694 return 0;
695} 695}
696 696
697void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid, 697void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb)
698 struct sk_buff *skb)
699{ 698{
700 struct ipoib_dev_priv *priv = netdev_priv(dev); 699 struct ipoib_dev_priv *priv = netdev_priv(dev);
701 struct ipoib_mcast *mcast; 700 struct ipoib_mcast *mcast;
@@ -718,7 +717,7 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid,
718 if (!mcast) { 717 if (!mcast) {
719 /* Let's create a new send only group now */ 718 /* Let's create a new send only group now */
720 ipoib_dbg_mcast(priv, "setting up send only multicast group for " 719 ipoib_dbg_mcast(priv, "setting up send only multicast group for "
721 IPOIB_GID_FMT "\n", IPOIB_GID_ARG(*mgid)); 720 IPOIB_GID_FMT "\n", IPOIB_GID_RAW_ARG(mgid));
722 721
723 mcast = ipoib_mcast_alloc(dev, 0); 722 mcast = ipoib_mcast_alloc(dev, 0);
724 if (!mcast) { 723 if (!mcast) {
@@ -730,7 +729,7 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid,
730 } 729 }
731 730
732 set_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags); 731 set_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags);
733 mcast->mcmember.mgid = *mgid; 732 memcpy(mcast->mcmember.mgid.raw, mgid, sizeof (union ib_gid));
734 __ipoib_mcast_add(dev, mcast); 733 __ipoib_mcast_add(dev, mcast);
735 list_add_tail(&mcast->list, &priv->multicast_list); 734 list_add_tail(&mcast->list, &priv->multicast_list);
736 } 735 }
@@ -821,7 +820,8 @@ void ipoib_mcast_restart_task(void *dev_ptr)
821 820
822 ipoib_mcast_stop_thread(dev, 0); 821 ipoib_mcast_stop_thread(dev, 0);
823 822
824 spin_lock_irqsave(&dev->xmit_lock, flags); 823 local_irq_save(flags);
824 netif_tx_lock(dev);
825 spin_lock(&priv->lock); 825 spin_lock(&priv->lock);
826 826
827 /* 827 /*
@@ -896,7 +896,8 @@ void ipoib_mcast_restart_task(void *dev_ptr)
896 } 896 }
897 897
898 spin_unlock(&priv->lock); 898 spin_unlock(&priv->lock);
899 spin_unlock_irqrestore(&dev->xmit_lock, flags); 899 netif_tx_unlock(dev);
900 local_irq_restore(flags);
900 901
901 /* We have to cancel outside of the spinlock */ 902 /* We have to cancel outside of the spinlock */
902 list_for_each_entry_safe(mcast, tmcast, &remove_list, list) { 903 list_for_each_entry_safe(mcast, tmcast, &remove_list, list) {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index 1d49d1643c59..7b717c648f72 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -255,7 +255,8 @@ void ipoib_event(struct ib_event_handler *handler,
255 record->event == IB_EVENT_PKEY_CHANGE || 255 record->event == IB_EVENT_PKEY_CHANGE ||
256 record->event == IB_EVENT_PORT_ACTIVE || 256 record->event == IB_EVENT_PORT_ACTIVE ||
257 record->event == IB_EVENT_LID_CHANGE || 257 record->event == IB_EVENT_LID_CHANGE ||
258 record->event == IB_EVENT_SM_CHANGE) { 258 record->event == IB_EVENT_SM_CHANGE ||
259 record->event == IB_EVENT_CLIENT_REREGISTER) {
259 ipoib_dbg(priv, "Port state change event\n"); 260 ipoib_dbg(priv, "Port state change event\n");
260 queue_work(ipoib_workqueue, &priv->flush_task); 261 queue_work(ipoib_workqueue, &priv->flush_task);
261 } 262 }
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 9cbdffa08dc2..4e22afef7206 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -62,6 +62,13 @@ MODULE_DESCRIPTION("InfiniBand SCSI RDMA Protocol initiator "
62 "v" DRV_VERSION " (" DRV_RELDATE ")"); 62 "v" DRV_VERSION " (" DRV_RELDATE ")");
63MODULE_LICENSE("Dual BSD/GPL"); 63MODULE_LICENSE("Dual BSD/GPL");
64 64
65static int srp_sg_tablesize = SRP_DEF_SG_TABLESIZE;
66static int srp_max_iu_len;
67
68module_param(srp_sg_tablesize, int, 0444);
69MODULE_PARM_DESC(srp_sg_tablesize,
70 "Max number of gather/scatter entries per I/O (default is 12)");
71
65static int topspin_workarounds = 1; 72static int topspin_workarounds = 1;
66 73
67module_param(topspin_workarounds, int, 0444); 74module_param(topspin_workarounds, int, 0444);
@@ -105,7 +112,8 @@ static struct srp_iu *srp_alloc_iu(struct srp_host *host, size_t size,
105 if (!iu->buf) 112 if (!iu->buf)
106 goto out_free_iu; 113 goto out_free_iu;
107 114
108 iu->dma = dma_map_single(host->dev->dma_device, iu->buf, size, direction); 115 iu->dma = dma_map_single(host->dev->dev->dma_device,
116 iu->buf, size, direction);
109 if (dma_mapping_error(iu->dma)) 117 if (dma_mapping_error(iu->dma))
110 goto out_free_buf; 118 goto out_free_buf;
111 119
@@ -127,7 +135,8 @@ static void srp_free_iu(struct srp_host *host, struct srp_iu *iu)
127 if (!iu) 135 if (!iu)
128 return; 136 return;
129 137
130 dma_unmap_single(host->dev->dma_device, iu->dma, iu->size, iu->direction); 138 dma_unmap_single(host->dev->dev->dma_device,
139 iu->dma, iu->size, iu->direction);
131 kfree(iu->buf); 140 kfree(iu->buf);
132 kfree(iu); 141 kfree(iu);
133} 142}
@@ -147,7 +156,7 @@ static int srp_init_qp(struct srp_target_port *target,
147 if (!attr) 156 if (!attr)
148 return -ENOMEM; 157 return -ENOMEM;
149 158
150 ret = ib_find_cached_pkey(target->srp_host->dev, 159 ret = ib_find_cached_pkey(target->srp_host->dev->dev,
151 target->srp_host->port, 160 target->srp_host->port,
152 be16_to_cpu(target->path.pkey), 161 be16_to_cpu(target->path.pkey),
153 &attr->pkey_index); 162 &attr->pkey_index);
@@ -179,7 +188,7 @@ static int srp_create_target_ib(struct srp_target_port *target)
179 if (!init_attr) 188 if (!init_attr)
180 return -ENOMEM; 189 return -ENOMEM;
181 190
182 target->cq = ib_create_cq(target->srp_host->dev, srp_completion, 191 target->cq = ib_create_cq(target->srp_host->dev->dev, srp_completion,
183 NULL, target, SRP_CQ_SIZE); 192 NULL, target, SRP_CQ_SIZE);
184 if (IS_ERR(target->cq)) { 193 if (IS_ERR(target->cq)) {
185 ret = PTR_ERR(target->cq); 194 ret = PTR_ERR(target->cq);
@@ -198,7 +207,7 @@ static int srp_create_target_ib(struct srp_target_port *target)
198 init_attr->send_cq = target->cq; 207 init_attr->send_cq = target->cq;
199 init_attr->recv_cq = target->cq; 208 init_attr->recv_cq = target->cq;
200 209
201 target->qp = ib_create_qp(target->srp_host->pd, init_attr); 210 target->qp = ib_create_qp(target->srp_host->dev->pd, init_attr);
202 if (IS_ERR(target->qp)) { 211 if (IS_ERR(target->qp)) {
203 ret = PTR_ERR(target->qp); 212 ret = PTR_ERR(target->qp);
204 ib_destroy_cq(target->cq); 213 ib_destroy_cq(target->cq);
@@ -250,7 +259,7 @@ static int srp_lookup_path(struct srp_target_port *target)
250 259
251 init_completion(&target->done); 260 init_completion(&target->done);
252 261
253 target->path_query_id = ib_sa_path_rec_get(target->srp_host->dev, 262 target->path_query_id = ib_sa_path_rec_get(target->srp_host->dev->dev,
254 target->srp_host->port, 263 target->srp_host->port,
255 &target->path, 264 &target->path,
256 IB_SA_PATH_REC_DGID | 265 IB_SA_PATH_REC_DGID |
@@ -309,10 +318,32 @@ static int srp_send_req(struct srp_target_port *target)
309 318
310 req->priv.opcode = SRP_LOGIN_REQ; 319 req->priv.opcode = SRP_LOGIN_REQ;
311 req->priv.tag = 0; 320 req->priv.tag = 0;
312 req->priv.req_it_iu_len = cpu_to_be32(SRP_MAX_IU_LEN); 321 req->priv.req_it_iu_len = cpu_to_be32(srp_max_iu_len);
313 req->priv.req_buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT | 322 req->priv.req_buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT |
314 SRP_BUF_FORMAT_INDIRECT); 323 SRP_BUF_FORMAT_INDIRECT);
315 memcpy(req->priv.initiator_port_id, target->srp_host->initiator_port_id, 16); 324 /*
325 * In the published SRP specification (draft rev. 16a), the
326 * port identifier format is 8 bytes of ID extension followed
327 * by 8 bytes of GUID. Older drafts put the two halves in the
328 * opposite order, so that the GUID comes first.
329 *
330 * Targets conforming to these obsolete drafts can be
331 * recognized by the I/O Class they report.
332 */
333 if (target->io_class == SRP_REV10_IB_IO_CLASS) {
334 memcpy(req->priv.initiator_port_id,
335 target->srp_host->initiator_port_id + 8, 8);
336 memcpy(req->priv.initiator_port_id + 8,
337 target->srp_host->initiator_port_id, 8);
338 memcpy(req->priv.target_port_id, &target->ioc_guid, 8);
339 memcpy(req->priv.target_port_id + 8, &target->id_ext, 8);
340 } else {
341 memcpy(req->priv.initiator_port_id,
342 target->srp_host->initiator_port_id, 16);
343 memcpy(req->priv.target_port_id, &target->id_ext, 8);
344 memcpy(req->priv.target_port_id + 8, &target->ioc_guid, 8);
345 }
346
316 /* 347 /*
317 * Topspin/Cisco SRP targets will reject our login unless we 348 * Topspin/Cisco SRP targets will reject our login unless we
318 * zero out the first 8 bytes of our initiator port ID. The 349 * zero out the first 8 bytes of our initiator port ID. The
@@ -325,8 +356,6 @@ static int srp_send_req(struct srp_target_port *target)
325 (unsigned long long) be64_to_cpu(target->ioc_guid)); 356 (unsigned long long) be64_to_cpu(target->ioc_guid));
326 memset(req->priv.initiator_port_id, 0, 8); 357 memset(req->priv.initiator_port_id, 0, 8);
327 } 358 }
328 memcpy(req->priv.target_port_id, &target->id_ext, 8);
329 memcpy(req->priv.target_port_id + 8, &target->ioc_guid, 8);
330 359
331 status = ib_send_cm_req(target->cm_id, &req->param); 360 status = ib_send_cm_req(target->cm_id, &req->param);
332 361
@@ -359,9 +388,9 @@ static void srp_remove_work(void *target_ptr)
359 target->state = SRP_TARGET_REMOVED; 388 target->state = SRP_TARGET_REMOVED;
360 spin_unlock_irq(target->scsi_host->host_lock); 389 spin_unlock_irq(target->scsi_host->host_lock);
361 390
362 mutex_lock(&target->srp_host->target_mutex); 391 spin_lock(&target->srp_host->target_lock);
363 list_del(&target->list); 392 list_del(&target->list);
364 mutex_unlock(&target->srp_host->target_mutex); 393 spin_unlock(&target->srp_host->target_lock);
365 394
366 scsi_remove_host(target->scsi_host); 395 scsi_remove_host(target->scsi_host);
367 ib_destroy_cm_id(target->cm_id); 396 ib_destroy_cm_id(target->cm_id);
@@ -421,6 +450,11 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd,
421 scmnd->sc_data_direction != DMA_FROM_DEVICE)) 450 scmnd->sc_data_direction != DMA_FROM_DEVICE))
422 return; 451 return;
423 452
453 if (req->fmr) {
454 ib_fmr_pool_unmap(req->fmr);
455 req->fmr = NULL;
456 }
457
424 /* 458 /*
425 * This handling of non-SG commands can be killed when the 459 * This handling of non-SG commands can be killed when the
426 * SCSI midlayer no longer generates non-SG commands. 460 * SCSI midlayer no longer generates non-SG commands.
@@ -433,18 +467,30 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd,
433 scat = &req->fake_sg; 467 scat = &req->fake_sg;
434 } 468 }
435 469
436 dma_unmap_sg(target->srp_host->dev->dma_device, scat, nents, 470 dma_unmap_sg(target->srp_host->dev->dev->dma_device, scat, nents,
437 scmnd->sc_data_direction); 471 scmnd->sc_data_direction);
438} 472}
439 473
474static void srp_remove_req(struct srp_target_port *target, struct srp_request *req)
475{
476 srp_unmap_data(req->scmnd, target, req);
477 list_move_tail(&req->list, &target->free_reqs);
478}
479
480static void srp_reset_req(struct srp_target_port *target, struct srp_request *req)
481{
482 req->scmnd->result = DID_RESET << 16;
483 req->scmnd->scsi_done(req->scmnd);
484 srp_remove_req(target, req);
485}
486
440static int srp_reconnect_target(struct srp_target_port *target) 487static int srp_reconnect_target(struct srp_target_port *target)
441{ 488{
442 struct ib_cm_id *new_cm_id; 489 struct ib_cm_id *new_cm_id;
443 struct ib_qp_attr qp_attr; 490 struct ib_qp_attr qp_attr;
444 struct srp_request *req; 491 struct srp_request *req, *tmp;
445 struct ib_wc wc; 492 struct ib_wc wc;
446 int ret; 493 int ret;
447 int i;
448 494
449 spin_lock_irq(target->scsi_host->host_lock); 495 spin_lock_irq(target->scsi_host->host_lock);
450 if (target->state != SRP_TARGET_LIVE) { 496 if (target->state != SRP_TARGET_LIVE) {
@@ -459,7 +505,7 @@ static int srp_reconnect_target(struct srp_target_port *target)
459 * Now get a new local CM ID so that we avoid confusing the 505 * Now get a new local CM ID so that we avoid confusing the
460 * target in case things are really fouled up. 506 * target in case things are really fouled up.
461 */ 507 */
462 new_cm_id = ib_create_cm_id(target->srp_host->dev, 508 new_cm_id = ib_create_cm_id(target->srp_host->dev->dev,
463 srp_cm_handler, target); 509 srp_cm_handler, target);
464 if (IS_ERR(new_cm_id)) { 510 if (IS_ERR(new_cm_id)) {
465 ret = PTR_ERR(new_cm_id); 511 ret = PTR_ERR(new_cm_id);
@@ -480,19 +526,12 @@ static int srp_reconnect_target(struct srp_target_port *target)
480 while (ib_poll_cq(target->cq, 1, &wc) > 0) 526 while (ib_poll_cq(target->cq, 1, &wc) > 0)
481 ; /* nothing */ 527 ; /* nothing */
482 528
483 list_for_each_entry(req, &target->req_queue, list) { 529 list_for_each_entry_safe(req, tmp, &target->req_queue, list)
484 req->scmnd->result = DID_RESET << 16; 530 srp_reset_req(target, req);
485 req->scmnd->scsi_done(req->scmnd);
486 srp_unmap_data(req->scmnd, target, req);
487 }
488 531
489 target->rx_head = 0; 532 target->rx_head = 0;
490 target->tx_head = 0; 533 target->tx_head = 0;
491 target->tx_tail = 0; 534 target->tx_tail = 0;
492 INIT_LIST_HEAD(&target->free_reqs);
493 INIT_LIST_HEAD(&target->req_queue);
494 for (i = 0; i < SRP_SQ_SIZE; ++i)
495 list_add_tail(&target->req_ring[i].list, &target->free_reqs);
496 535
497 ret = srp_connect_target(target); 536 ret = srp_connect_target(target);
498 if (ret) 537 if (ret)
@@ -528,14 +567,79 @@ err:
528 return ret; 567 return ret;
529} 568}
530 569
570static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat,
571 int sg_cnt, struct srp_request *req,
572 struct srp_direct_buf *buf)
573{
574 u64 io_addr = 0;
575 u64 *dma_pages;
576 u32 len;
577 int page_cnt;
578 int i, j;
579 int ret;
580
581 if (!dev->fmr_pool)
582 return -ENODEV;
583
584 len = page_cnt = 0;
585 for (i = 0; i < sg_cnt; ++i) {
586 if (sg_dma_address(&scat[i]) & ~dev->fmr_page_mask) {
587 if (i > 0)
588 return -EINVAL;
589 else
590 ++page_cnt;
591 }
592 if ((sg_dma_address(&scat[i]) + sg_dma_len(&scat[i])) &
593 ~dev->fmr_page_mask) {
594 if (i < sg_cnt - 1)
595 return -EINVAL;
596 else
597 ++page_cnt;
598 }
599
600 len += sg_dma_len(&scat[i]);
601 }
602
603 page_cnt += len >> dev->fmr_page_shift;
604 if (page_cnt > SRP_FMR_SIZE)
605 return -ENOMEM;
606
607 dma_pages = kmalloc(sizeof (u64) * page_cnt, GFP_ATOMIC);
608 if (!dma_pages)
609 return -ENOMEM;
610
611 page_cnt = 0;
612 for (i = 0; i < sg_cnt; ++i)
613 for (j = 0; j < sg_dma_len(&scat[i]); j += dev->fmr_page_size)
614 dma_pages[page_cnt++] =
615 (sg_dma_address(&scat[i]) & dev->fmr_page_mask) + j;
616
617 req->fmr = ib_fmr_pool_map_phys(dev->fmr_pool,
618 dma_pages, page_cnt, &io_addr);
619 if (IS_ERR(req->fmr)) {
620 ret = PTR_ERR(req->fmr);
621 goto out;
622 }
623
624 buf->va = cpu_to_be64(sg_dma_address(&scat[0]) & ~dev->fmr_page_mask);
625 buf->key = cpu_to_be32(req->fmr->fmr->rkey);
626 buf->len = cpu_to_be32(len);
627
628 ret = 0;
629
630out:
631 kfree(dma_pages);
632
633 return ret;
634}
635
531static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, 636static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
532 struct srp_request *req) 637 struct srp_request *req)
533{ 638{
534 struct scatterlist *scat; 639 struct scatterlist *scat;
535 struct srp_cmd *cmd = req->cmd->buf; 640 struct srp_cmd *cmd = req->cmd->buf;
536 int len, nents, count; 641 int len, nents, count;
537 int i; 642 u8 fmt = SRP_DATA_DESC_DIRECT;
538 u8 fmt;
539 643
540 if (!scmnd->request_buffer || scmnd->sc_data_direction == DMA_NONE) 644 if (!scmnd->request_buffer || scmnd->sc_data_direction == DMA_NONE)
541 return sizeof (struct srp_cmd); 645 return sizeof (struct srp_cmd);
@@ -560,53 +664,63 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
560 sg_init_one(scat, scmnd->request_buffer, scmnd->request_bufflen); 664 sg_init_one(scat, scmnd->request_buffer, scmnd->request_bufflen);
561 } 665 }
562 666
563 count = dma_map_sg(target->srp_host->dev->dma_device, scat, nents, 667 count = dma_map_sg(target->srp_host->dev->dev->dma_device,
564 scmnd->sc_data_direction); 668 scat, nents, scmnd->sc_data_direction);
669
670 fmt = SRP_DATA_DESC_DIRECT;
671 len = sizeof (struct srp_cmd) + sizeof (struct srp_direct_buf);
565 672
566 if (count == 1) { 673 if (count == 1) {
674 /*
675 * The midlayer only generated a single gather/scatter
676 * entry, or DMA mapping coalesced everything to a
677 * single entry. So a direct descriptor along with
678 * the DMA MR suffices.
679 */
567 struct srp_direct_buf *buf = (void *) cmd->add_data; 680 struct srp_direct_buf *buf = (void *) cmd->add_data;
568 681
569 fmt = SRP_DATA_DESC_DIRECT;
570
571 buf->va = cpu_to_be64(sg_dma_address(scat)); 682 buf->va = cpu_to_be64(sg_dma_address(scat));
572 buf->key = cpu_to_be32(target->srp_host->mr->rkey); 683 buf->key = cpu_to_be32(target->srp_host->dev->mr->rkey);
573 buf->len = cpu_to_be32(sg_dma_len(scat)); 684 buf->len = cpu_to_be32(sg_dma_len(scat));
574 685 } else if (srp_map_fmr(target->srp_host->dev, scat, count, req,
575 len = sizeof (struct srp_cmd) + 686 (void *) cmd->add_data)) {
576 sizeof (struct srp_direct_buf); 687 /*
577 } else { 688 * FMR mapping failed, and the scatterlist has more
689 * than one entry. Generate an indirect memory
690 * descriptor.
691 */
578 struct srp_indirect_buf *buf = (void *) cmd->add_data; 692 struct srp_indirect_buf *buf = (void *) cmd->add_data;
579 u32 datalen = 0; 693 u32 datalen = 0;
694 int i;
580 695
581 fmt = SRP_DATA_DESC_INDIRECT; 696 fmt = SRP_DATA_DESC_INDIRECT;
697 len = sizeof (struct srp_cmd) +
698 sizeof (struct srp_indirect_buf) +
699 count * sizeof (struct srp_direct_buf);
700
701 for (i = 0; i < count; ++i) {
702 buf->desc_list[i].va =
703 cpu_to_be64(sg_dma_address(&scat[i]));
704 buf->desc_list[i].key =
705 cpu_to_be32(target->srp_host->dev->mr->rkey);
706 buf->desc_list[i].len =
707 cpu_to_be32(sg_dma_len(&scat[i]));
708 datalen += sg_dma_len(&scat[i]);
709 }
582 710
583 if (scmnd->sc_data_direction == DMA_TO_DEVICE) 711 if (scmnd->sc_data_direction == DMA_TO_DEVICE)
584 cmd->data_out_desc_cnt = count; 712 cmd->data_out_desc_cnt = count;
585 else 713 else
586 cmd->data_in_desc_cnt = count; 714 cmd->data_in_desc_cnt = count;
587 715
588 buf->table_desc.va = cpu_to_be64(req->cmd->dma + 716 buf->table_desc.va =
589 sizeof *cmd + 717 cpu_to_be64(req->cmd->dma + sizeof *cmd + sizeof *buf);
590 sizeof *buf);
591 buf->table_desc.key = 718 buf->table_desc.key =
592 cpu_to_be32(target->srp_host->mr->rkey); 719 cpu_to_be32(target->srp_host->dev->mr->rkey);
593 buf->table_desc.len = 720 buf->table_desc.len =
594 cpu_to_be32(count * sizeof (struct srp_direct_buf)); 721 cpu_to_be32(count * sizeof (struct srp_direct_buf));
595 722
596 for (i = 0; i < count; ++i) {
597 buf->desc_list[i].va = cpu_to_be64(sg_dma_address(&scat[i]));
598 buf->desc_list[i].key =
599 cpu_to_be32(target->srp_host->mr->rkey);
600 buf->desc_list[i].len = cpu_to_be32(sg_dma_len(&scat[i]));
601
602 datalen += sg_dma_len(&scat[i]);
603 }
604
605 buf->len = cpu_to_be32(datalen); 723 buf->len = cpu_to_be32(datalen);
606
607 len = sizeof (struct srp_cmd) +
608 sizeof (struct srp_indirect_buf) +
609 count * sizeof (struct srp_direct_buf);
610 } 724 }
611 725
612 if (scmnd->sc_data_direction == DMA_TO_DEVICE) 726 if (scmnd->sc_data_direction == DMA_TO_DEVICE)
@@ -617,12 +731,6 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
617 return len; 731 return len;
618} 732}
619 733
620static void srp_remove_req(struct srp_target_port *target, struct srp_request *req)
621{
622 srp_unmap_data(req->scmnd, target, req);
623 list_move_tail(&req->list, &target->free_reqs);
624}
625
626static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) 734static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
627{ 735{
628 struct srp_request *req; 736 struct srp_request *req;
@@ -689,7 +797,7 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
689 797
690 iu = target->rx_ring[wc->wr_id & ~SRP_OP_RECV]; 798 iu = target->rx_ring[wc->wr_id & ~SRP_OP_RECV];
691 799
692 dma_sync_single_for_cpu(target->srp_host->dev->dma_device, iu->dma, 800 dma_sync_single_for_cpu(target->srp_host->dev->dev->dma_device, iu->dma,
693 target->max_ti_iu_len, DMA_FROM_DEVICE); 801 target->max_ti_iu_len, DMA_FROM_DEVICE);
694 802
695 opcode = *(u8 *) iu->buf; 803 opcode = *(u8 *) iu->buf;
@@ -726,7 +834,7 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
726 break; 834 break;
727 } 835 }
728 836
729 dma_sync_single_for_device(target->srp_host->dev->dma_device, iu->dma, 837 dma_sync_single_for_device(target->srp_host->dev->dev->dma_device, iu->dma,
730 target->max_ti_iu_len, DMA_FROM_DEVICE); 838 target->max_ti_iu_len, DMA_FROM_DEVICE);
731} 839}
732 840
@@ -770,7 +878,7 @@ static int __srp_post_recv(struct srp_target_port *target)
770 878
771 list.addr = iu->dma; 879 list.addr = iu->dma;
772 list.length = iu->size; 880 list.length = iu->size;
773 list.lkey = target->srp_host->mr->lkey; 881 list.lkey = target->srp_host->dev->mr->lkey;
774 882
775 wr.next = NULL; 883 wr.next = NULL;
776 wr.sg_list = &list; 884 wr.sg_list = &list;
@@ -805,12 +913,8 @@ static struct srp_iu *__srp_get_tx_iu(struct srp_target_port *target)
805 if (target->tx_head - target->tx_tail >= SRP_SQ_SIZE) 913 if (target->tx_head - target->tx_tail >= SRP_SQ_SIZE)
806 return NULL; 914 return NULL;
807 915
808 if (unlikely(target->req_lim < 1)) { 916 if (unlikely(target->req_lim < 1))
809 if (printk_ratelimit()) 917 ++target->zero_req_lim;
810 printk(KERN_DEBUG PFX "Target has req_lim %d\n",
811 target->req_lim);
812 return NULL;
813 }
814 918
815 return target->tx_ring[target->tx_head & SRP_SQ_SIZE]; 919 return target->tx_ring[target->tx_head & SRP_SQ_SIZE];
816} 920}
@@ -828,7 +932,7 @@ static int __srp_post_send(struct srp_target_port *target,
828 932
829 list.addr = iu->dma; 933 list.addr = iu->dma;
830 list.length = len; 934 list.length = len;
831 list.lkey = target->srp_host->mr->lkey; 935 list.lkey = target->srp_host->dev->mr->lkey;
832 936
833 wr.next = NULL; 937 wr.next = NULL;
834 wr.wr_id = target->tx_head & SRP_SQ_SIZE; 938 wr.wr_id = target->tx_head & SRP_SQ_SIZE;
@@ -870,8 +974,8 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
870 if (!iu) 974 if (!iu)
871 goto err; 975 goto err;
872 976
873 dma_sync_single_for_cpu(target->srp_host->dev->dma_device, iu->dma, 977 dma_sync_single_for_cpu(target->srp_host->dev->dev->dma_device, iu->dma,
874 SRP_MAX_IU_LEN, DMA_TO_DEVICE); 978 srp_max_iu_len, DMA_TO_DEVICE);
875 979
876 req = list_entry(target->free_reqs.next, struct srp_request, list); 980 req = list_entry(target->free_reqs.next, struct srp_request, list);
877 981
@@ -903,8 +1007,8 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
903 goto err_unmap; 1007 goto err_unmap;
904 } 1008 }
905 1009
906 dma_sync_single_for_device(target->srp_host->dev->dma_device, iu->dma, 1010 dma_sync_single_for_device(target->srp_host->dev->dev->dma_device, iu->dma,
907 SRP_MAX_IU_LEN, DMA_TO_DEVICE); 1011 srp_max_iu_len, DMA_TO_DEVICE);
908 1012
909 if (__srp_post_send(target, iu, len)) { 1013 if (__srp_post_send(target, iu, len)) {
910 printk(KERN_ERR PFX "Send failed\n"); 1014 printk(KERN_ERR PFX "Send failed\n");
@@ -936,7 +1040,7 @@ static int srp_alloc_iu_bufs(struct srp_target_port *target)
936 1040
937 for (i = 0; i < SRP_SQ_SIZE + 1; ++i) { 1041 for (i = 0; i < SRP_SQ_SIZE + 1; ++i) {
938 target->tx_ring[i] = srp_alloc_iu(target->srp_host, 1042 target->tx_ring[i] = srp_alloc_iu(target->srp_host,
939 SRP_MAX_IU_LEN, 1043 srp_max_iu_len,
940 GFP_KERNEL, DMA_TO_DEVICE); 1044 GFP_KERNEL, DMA_TO_DEVICE);
941 if (!target->tx_ring[i]) 1045 if (!target->tx_ring[i])
942 goto err; 1046 goto err;
@@ -1107,11 +1211,10 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
1107 srp_cm_rej_handler(cm_id, event, target); 1211 srp_cm_rej_handler(cm_id, event, target);
1108 break; 1212 break;
1109 1213
1110 case IB_CM_MRA_RECEIVED: 1214 case IB_CM_DREQ_RECEIVED:
1111 printk(KERN_ERR PFX "MRA received\n"); 1215 printk(KERN_WARNING PFX "DREQ received - connection closed\n");
1112 break; 1216 if (ib_send_cm_drep(cm_id, NULL, 0))
1113 1217 printk(KERN_ERR PFX "Sending CM DREP failed\n");
1114 case IB_CM_DREP_RECEIVED:
1115 break; 1218 break;
1116 1219
1117 case IB_CM_TIMEWAIT_EXIT: 1220 case IB_CM_TIMEWAIT_EXIT:
@@ -1121,6 +1224,11 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
1121 target->status = 0; 1224 target->status = 0;
1122 break; 1225 break;
1123 1226
1227 case IB_CM_MRA_RECEIVED:
1228 case IB_CM_DREQ_ERROR:
1229 case IB_CM_DREP_RECEIVED:
1230 break;
1231
1124 default: 1232 default:
1125 printk(KERN_WARNING PFX "Unhandled CM event %d\n", event->event); 1233 printk(KERN_WARNING PFX "Unhandled CM event %d\n", event->event);
1126 break; 1234 break;
@@ -1239,11 +1347,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
1239 spin_lock_irq(target->scsi_host->host_lock); 1347 spin_lock_irq(target->scsi_host->host_lock);
1240 1348
1241 list_for_each_entry_safe(req, tmp, &target->req_queue, list) 1349 list_for_each_entry_safe(req, tmp, &target->req_queue, list)
1242 if (req->scmnd->device == scmnd->device) { 1350 if (req->scmnd->device == scmnd->device)
1243 req->scmnd->result = DID_RESET << 16; 1351 srp_reset_req(target, req);
1244 req->scmnd->scsi_done(req->scmnd);
1245 srp_remove_req(target, req);
1246 }
1247 1352
1248 spin_unlock_irq(target->scsi_host->host_lock); 1353 spin_unlock_irq(target->scsi_host->host_lock);
1249 1354
@@ -1329,11 +1434,23 @@ static ssize_t show_dgid(struct class_device *cdev, char *buf)
1329 be16_to_cpu(((__be16 *) target->path.dgid.raw)[7])); 1434 be16_to_cpu(((__be16 *) target->path.dgid.raw)[7]));
1330} 1435}
1331 1436
1437static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf)
1438{
1439 struct srp_target_port *target = host_to_target(class_to_shost(cdev));
1440
1441 if (target->state == SRP_TARGET_DEAD ||
1442 target->state == SRP_TARGET_REMOVED)
1443 return -ENODEV;
1444
1445 return sprintf(buf, "%d\n", target->zero_req_lim);
1446}
1447
1332static CLASS_DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL); 1448static CLASS_DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL);
1333static CLASS_DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL); 1449static CLASS_DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL);
1334static CLASS_DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL); 1450static CLASS_DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL);
1335static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL); 1451static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
1336static CLASS_DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL); 1452static CLASS_DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL);
1453static CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL);
1337 1454
1338static struct class_device_attribute *srp_host_attrs[] = { 1455static struct class_device_attribute *srp_host_attrs[] = {
1339 &class_device_attr_id_ext, 1456 &class_device_attr_id_ext,
@@ -1341,6 +1458,7 @@ static struct class_device_attribute *srp_host_attrs[] = {
1341 &class_device_attr_service_id, 1458 &class_device_attr_service_id,
1342 &class_device_attr_pkey, 1459 &class_device_attr_pkey,
1343 &class_device_attr_dgid, 1460 &class_device_attr_dgid,
1461 &class_device_attr_zero_req_lim,
1344 NULL 1462 NULL
1345}; 1463};
1346 1464
@@ -1354,7 +1472,6 @@ static struct scsi_host_template srp_template = {
1354 .eh_host_reset_handler = srp_reset_host, 1472 .eh_host_reset_handler = srp_reset_host,
1355 .can_queue = SRP_SQ_SIZE, 1473 .can_queue = SRP_SQ_SIZE,
1356 .this_id = -1, 1474 .this_id = -1,
1357 .sg_tablesize = SRP_MAX_INDIRECT,
1358 .cmd_per_lun = SRP_SQ_SIZE, 1475 .cmd_per_lun = SRP_SQ_SIZE,
1359 .use_clustering = ENABLE_CLUSTERING, 1476 .use_clustering = ENABLE_CLUSTERING,
1360 .shost_attrs = srp_host_attrs 1477 .shost_attrs = srp_host_attrs
@@ -1365,18 +1482,17 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
1365 sprintf(target->target_name, "SRP.T10:%016llX", 1482 sprintf(target->target_name, "SRP.T10:%016llX",
1366 (unsigned long long) be64_to_cpu(target->id_ext)); 1483 (unsigned long long) be64_to_cpu(target->id_ext));
1367 1484
1368 if (scsi_add_host(target->scsi_host, host->dev->dma_device)) 1485 if (scsi_add_host(target->scsi_host, host->dev->dev->dma_device))
1369 return -ENODEV; 1486 return -ENODEV;
1370 1487
1371 mutex_lock(&host->target_mutex); 1488 spin_lock(&host->target_lock);
1372 list_add_tail(&target->list, &host->target_list); 1489 list_add_tail(&target->list, &host->target_list);
1373 mutex_unlock(&host->target_mutex); 1490 spin_unlock(&host->target_lock);
1374 1491
1375 target->state = SRP_TARGET_LIVE; 1492 target->state = SRP_TARGET_LIVE;
1376 1493
1377 /* XXX: are we supposed to have a definition of SCAN_WILD_CARD ?? */
1378 scsi_scan_target(&target->scsi_host->shost_gendev, 1494 scsi_scan_target(&target->scsi_host->shost_gendev,
1379 0, target->scsi_id, ~0, 0); 1495 0, target->scsi_id, SCAN_WILD_CARD, 0);
1380 1496
1381 return 0; 1497 return 0;
1382} 1498}
@@ -1410,6 +1526,8 @@ enum {
1410 SRP_OPT_PKEY = 1 << 3, 1526 SRP_OPT_PKEY = 1 << 3,
1411 SRP_OPT_SERVICE_ID = 1 << 4, 1527 SRP_OPT_SERVICE_ID = 1 << 4,
1412 SRP_OPT_MAX_SECT = 1 << 5, 1528 SRP_OPT_MAX_SECT = 1 << 5,
1529 SRP_OPT_MAX_CMD_PER_LUN = 1 << 6,
1530 SRP_OPT_IO_CLASS = 1 << 7,
1413 SRP_OPT_ALL = (SRP_OPT_ID_EXT | 1531 SRP_OPT_ALL = (SRP_OPT_ID_EXT |
1414 SRP_OPT_IOC_GUID | 1532 SRP_OPT_IOC_GUID |
1415 SRP_OPT_DGID | 1533 SRP_OPT_DGID |
@@ -1418,13 +1536,15 @@ enum {
1418}; 1536};
1419 1537
1420static match_table_t srp_opt_tokens = { 1538static match_table_t srp_opt_tokens = {
1421 { SRP_OPT_ID_EXT, "id_ext=%s" }, 1539 { SRP_OPT_ID_EXT, "id_ext=%s" },
1422 { SRP_OPT_IOC_GUID, "ioc_guid=%s" }, 1540 { SRP_OPT_IOC_GUID, "ioc_guid=%s" },
1423 { SRP_OPT_DGID, "dgid=%s" }, 1541 { SRP_OPT_DGID, "dgid=%s" },
1424 { SRP_OPT_PKEY, "pkey=%x" }, 1542 { SRP_OPT_PKEY, "pkey=%x" },
1425 { SRP_OPT_SERVICE_ID, "service_id=%s" }, 1543 { SRP_OPT_SERVICE_ID, "service_id=%s" },
1426 { SRP_OPT_MAX_SECT, "max_sect=%d" }, 1544 { SRP_OPT_MAX_SECT, "max_sect=%d" },
1427 { SRP_OPT_ERR, NULL } 1545 { SRP_OPT_MAX_CMD_PER_LUN, "max_cmd_per_lun=%d" },
1546 { SRP_OPT_IO_CLASS, "io_class=%x" },
1547 { SRP_OPT_ERR, NULL }
1428}; 1548};
1429 1549
1430static int srp_parse_options(const char *buf, struct srp_target_port *target) 1550static int srp_parse_options(const char *buf, struct srp_target_port *target)
@@ -1500,6 +1620,29 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
1500 target->scsi_host->max_sectors = token; 1620 target->scsi_host->max_sectors = token;
1501 break; 1621 break;
1502 1622
1623 case SRP_OPT_MAX_CMD_PER_LUN:
1624 if (match_int(args, &token)) {
1625 printk(KERN_WARNING PFX "bad max cmd_per_lun parameter '%s'\n", p);
1626 goto out;
1627 }
1628 target->scsi_host->cmd_per_lun = min(token, SRP_SQ_SIZE);
1629 break;
1630
1631 case SRP_OPT_IO_CLASS:
1632 if (match_hex(args, &token)) {
1633 printk(KERN_WARNING PFX "bad IO class parameter '%s' \n", p);
1634 goto out;
1635 }
1636 if (token != SRP_REV10_IB_IO_CLASS &&
1637 token != SRP_REV16A_IB_IO_CLASS) {
1638 printk(KERN_WARNING PFX "unknown IO class parameter value"
1639 " %x specified (use %x or %x).\n",
1640 token, SRP_REV10_IB_IO_CLASS, SRP_REV16A_IB_IO_CLASS);
1641 goto out;
1642 }
1643 target->io_class = token;
1644 break;
1645
1503 default: 1646 default:
1504 printk(KERN_WARNING PFX "unknown parameter or missing value " 1647 printk(KERN_WARNING PFX "unknown parameter or missing value "
1505 "'%s' in target creation request\n", p); 1648 "'%s' in target creation request\n", p);
@@ -1542,6 +1685,7 @@ static ssize_t srp_create_target(struct class_device *class_dev,
1542 target = host_to_target(target_host); 1685 target = host_to_target(target_host);
1543 memset(target, 0, sizeof *target); 1686 memset(target, 0, sizeof *target);
1544 1687
1688 target->io_class = SRP_REV16A_IB_IO_CLASS;
1545 target->scsi_host = target_host; 1689 target->scsi_host = target_host;
1546 target->srp_host = host; 1690 target->srp_host = host;
1547 1691
@@ -1558,7 +1702,7 @@ static ssize_t srp_create_target(struct class_device *class_dev,
1558 if (ret) 1702 if (ret)
1559 goto err; 1703 goto err;
1560 1704
1561 ib_get_cached_gid(host->dev, host->port, 0, &target->path.sgid); 1705 ib_get_cached_gid(host->dev->dev, host->port, 0, &target->path.sgid);
1562 1706
1563 printk(KERN_DEBUG PFX "new target: id_ext %016llx ioc_guid %016llx pkey %04x " 1707 printk(KERN_DEBUG PFX "new target: id_ext %016llx ioc_guid %016llx pkey %04x "
1564 "service_id %016llx dgid %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", 1708 "service_id %016llx dgid %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
@@ -1579,7 +1723,7 @@ static ssize_t srp_create_target(struct class_device *class_dev,
1579 if (ret) 1723 if (ret)
1580 goto err; 1724 goto err;
1581 1725
1582 target->cm_id = ib_create_cm_id(host->dev, srp_cm_handler, target); 1726 target->cm_id = ib_create_cm_id(host->dev->dev, srp_cm_handler, target);
1583 if (IS_ERR(target->cm_id)) { 1727 if (IS_ERR(target->cm_id)) {
1584 ret = PTR_ERR(target->cm_id); 1728 ret = PTR_ERR(target->cm_id);
1585 goto err_free; 1729 goto err_free;
@@ -1619,7 +1763,7 @@ static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
1619 struct srp_host *host = 1763 struct srp_host *host =
1620 container_of(class_dev, struct srp_host, class_dev); 1764 container_of(class_dev, struct srp_host, class_dev);
1621 1765
1622 return sprintf(buf, "%s\n", host->dev->name); 1766 return sprintf(buf, "%s\n", host->dev->dev->name);
1623} 1767}
1624 1768
1625static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); 1769static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
@@ -1634,7 +1778,7 @@ static ssize_t show_port(struct class_device *class_dev, char *buf)
1634 1778
1635static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL); 1779static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
1636 1780
1637static struct srp_host *srp_add_port(struct ib_device *device, u8 port) 1781static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
1638{ 1782{
1639 struct srp_host *host; 1783 struct srp_host *host;
1640 1784
@@ -1643,32 +1787,21 @@ static struct srp_host *srp_add_port(struct ib_device *device, u8 port)
1643 return NULL; 1787 return NULL;
1644 1788
1645 INIT_LIST_HEAD(&host->target_list); 1789 INIT_LIST_HEAD(&host->target_list);
1646 mutex_init(&host->target_mutex); 1790 spin_lock_init(&host->target_lock);
1647 init_completion(&host->released); 1791 init_completion(&host->released);
1648 host->dev = device; 1792 host->dev = device;
1649 host->port = port; 1793 host->port = port;
1650 1794
1651 host->initiator_port_id[7] = port; 1795 host->initiator_port_id[7] = port;
1652 memcpy(host->initiator_port_id + 8, &device->node_guid, 8); 1796 memcpy(host->initiator_port_id + 8, &device->dev->node_guid, 8);
1653
1654 host->pd = ib_alloc_pd(device);
1655 if (IS_ERR(host->pd))
1656 goto err_free;
1657
1658 host->mr = ib_get_dma_mr(host->pd,
1659 IB_ACCESS_LOCAL_WRITE |
1660 IB_ACCESS_REMOTE_READ |
1661 IB_ACCESS_REMOTE_WRITE);
1662 if (IS_ERR(host->mr))
1663 goto err_pd;
1664 1797
1665 host->class_dev.class = &srp_class; 1798 host->class_dev.class = &srp_class;
1666 host->class_dev.dev = device->dma_device; 1799 host->class_dev.dev = device->dev->dma_device;
1667 snprintf(host->class_dev.class_id, BUS_ID_SIZE, "srp-%s-%d", 1800 snprintf(host->class_dev.class_id, BUS_ID_SIZE, "srp-%s-%d",
1668 device->name, port); 1801 device->dev->name, port);
1669 1802
1670 if (class_device_register(&host->class_dev)) 1803 if (class_device_register(&host->class_dev))
1671 goto err_mr; 1804 goto free_host;
1672 if (class_device_create_file(&host->class_dev, &class_device_attr_add_target)) 1805 if (class_device_create_file(&host->class_dev, &class_device_attr_add_target))
1673 goto err_class; 1806 goto err_class;
1674 if (class_device_create_file(&host->class_dev, &class_device_attr_ibdev)) 1807 if (class_device_create_file(&host->class_dev, &class_device_attr_ibdev))
@@ -1681,13 +1814,7 @@ static struct srp_host *srp_add_port(struct ib_device *device, u8 port)
1681err_class: 1814err_class:
1682 class_device_unregister(&host->class_dev); 1815 class_device_unregister(&host->class_dev);
1683 1816
1684err_mr: 1817free_host:
1685 ib_dereg_mr(host->mr);
1686
1687err_pd:
1688 ib_dealloc_pd(host->pd);
1689
1690err_free:
1691 kfree(host); 1818 kfree(host);
1692 1819
1693 return NULL; 1820 return NULL;
@@ -1695,15 +1822,62 @@ err_free:
1695 1822
1696static void srp_add_one(struct ib_device *device) 1823static void srp_add_one(struct ib_device *device)
1697{ 1824{
1698 struct list_head *dev_list; 1825 struct srp_device *srp_dev;
1826 struct ib_device_attr *dev_attr;
1827 struct ib_fmr_pool_param fmr_param;
1699 struct srp_host *host; 1828 struct srp_host *host;
1700 int s, e, p; 1829 int s, e, p;
1701 1830
1702 dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); 1831 dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL);
1703 if (!dev_list) 1832 if (!dev_attr)
1704 return; 1833 return;
1705 1834
1706 INIT_LIST_HEAD(dev_list); 1835 if (ib_query_device(device, dev_attr)) {
1836 printk(KERN_WARNING PFX "Query device failed for %s\n",
1837 device->name);
1838 goto free_attr;
1839 }
1840
1841 srp_dev = kmalloc(sizeof *srp_dev, GFP_KERNEL);
1842 if (!srp_dev)
1843 goto free_attr;
1844
1845 /*
1846 * Use the smallest page size supported by the HCA, down to a
1847 * minimum of 512 bytes (which is the smallest sector that a
1848 * SCSI command will ever carry).
1849 */
1850 srp_dev->fmr_page_shift = max(9, ffs(dev_attr->page_size_cap) - 1);
1851 srp_dev->fmr_page_size = 1 << srp_dev->fmr_page_shift;
1852 srp_dev->fmr_page_mask = ~((unsigned long) srp_dev->fmr_page_size - 1);
1853
1854 INIT_LIST_HEAD(&srp_dev->dev_list);
1855
1856 srp_dev->dev = device;
1857 srp_dev->pd = ib_alloc_pd(device);
1858 if (IS_ERR(srp_dev->pd))
1859 goto free_dev;
1860
1861 srp_dev->mr = ib_get_dma_mr(srp_dev->pd,
1862 IB_ACCESS_LOCAL_WRITE |
1863 IB_ACCESS_REMOTE_READ |
1864 IB_ACCESS_REMOTE_WRITE);
1865 if (IS_ERR(srp_dev->mr))
1866 goto err_pd;
1867
1868 memset(&fmr_param, 0, sizeof fmr_param);
1869 fmr_param.pool_size = SRP_FMR_POOL_SIZE;
1870 fmr_param.dirty_watermark = SRP_FMR_DIRTY_SIZE;
1871 fmr_param.cache = 1;
1872 fmr_param.max_pages_per_fmr = SRP_FMR_SIZE;
1873 fmr_param.page_shift = srp_dev->fmr_page_shift;
1874 fmr_param.access = (IB_ACCESS_LOCAL_WRITE |
1875 IB_ACCESS_REMOTE_WRITE |
1876 IB_ACCESS_REMOTE_READ);
1877
1878 srp_dev->fmr_pool = ib_create_fmr_pool(srp_dev->pd, &fmr_param);
1879 if (IS_ERR(srp_dev->fmr_pool))
1880 srp_dev->fmr_pool = NULL;
1707 1881
1708 if (device->node_type == IB_NODE_SWITCH) { 1882 if (device->node_type == IB_NODE_SWITCH) {
1709 s = 0; 1883 s = 0;
@@ -1714,25 +1888,35 @@ static void srp_add_one(struct ib_device *device)
1714 } 1888 }
1715 1889
1716 for (p = s; p <= e; ++p) { 1890 for (p = s; p <= e; ++p) {
1717 host = srp_add_port(device, p); 1891 host = srp_add_port(srp_dev, p);
1718 if (host) 1892 if (host)
1719 list_add_tail(&host->list, dev_list); 1893 list_add_tail(&host->list, &srp_dev->dev_list);
1720 } 1894 }
1721 1895
1722 ib_set_client_data(device, &srp_client, dev_list); 1896 ib_set_client_data(device, &srp_client, srp_dev);
1897
1898 goto free_attr;
1899
1900err_pd:
1901 ib_dealloc_pd(srp_dev->pd);
1902
1903free_dev:
1904 kfree(srp_dev);
1905
1906free_attr:
1907 kfree(dev_attr);
1723} 1908}
1724 1909
1725static void srp_remove_one(struct ib_device *device) 1910static void srp_remove_one(struct ib_device *device)
1726{ 1911{
1727 struct list_head *dev_list; 1912 struct srp_device *srp_dev;
1728 struct srp_host *host, *tmp_host; 1913 struct srp_host *host, *tmp_host;
1729 LIST_HEAD(target_list); 1914 LIST_HEAD(target_list);
1730 struct srp_target_port *target, *tmp_target; 1915 struct srp_target_port *target, *tmp_target;
1731 unsigned long flags;
1732 1916
1733 dev_list = ib_get_client_data(device, &srp_client); 1917 srp_dev = ib_get_client_data(device, &srp_client);
1734 1918
1735 list_for_each_entry_safe(host, tmp_host, dev_list, list) { 1919 list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) {
1736 class_device_unregister(&host->class_dev); 1920 class_device_unregister(&host->class_dev);
1737 /* 1921 /*
1738 * Wait for the sysfs entry to go away, so that no new 1922 * Wait for the sysfs entry to go away, so that no new
@@ -1744,15 +1928,13 @@ static void srp_remove_one(struct ib_device *device)
1744 * Mark all target ports as removed, so we stop queueing 1928 * Mark all target ports as removed, so we stop queueing
1745 * commands and don't try to reconnect. 1929 * commands and don't try to reconnect.
1746 */ 1930 */
1747 mutex_lock(&host->target_mutex); 1931 spin_lock(&host->target_lock);
1748 list_for_each_entry_safe(target, tmp_target, 1932 list_for_each_entry(target, &host->target_list, list) {
1749 &host->target_list, list) { 1933 spin_lock_irq(target->scsi_host->host_lock);
1750 spin_lock_irqsave(target->scsi_host->host_lock, flags); 1934 target->state = SRP_TARGET_REMOVED;
1751 if (target->state != SRP_TARGET_REMOVED) 1935 spin_unlock_irq(target->scsi_host->host_lock);
1752 target->state = SRP_TARGET_REMOVED;
1753 spin_unlock_irqrestore(target->scsi_host->host_lock, flags);
1754 } 1936 }
1755 mutex_unlock(&host->target_mutex); 1937 spin_unlock(&host->target_lock);
1756 1938
1757 /* 1939 /*
1758 * Wait for any reconnection tasks that may have 1940 * Wait for any reconnection tasks that may have
@@ -1770,18 +1952,26 @@ static void srp_remove_one(struct ib_device *device)
1770 scsi_host_put(target->scsi_host); 1952 scsi_host_put(target->scsi_host);
1771 } 1953 }
1772 1954
1773 ib_dereg_mr(host->mr);
1774 ib_dealloc_pd(host->pd);
1775 kfree(host); 1955 kfree(host);
1776 } 1956 }
1777 1957
1778 kfree(dev_list); 1958 if (srp_dev->fmr_pool)
1959 ib_destroy_fmr_pool(srp_dev->fmr_pool);
1960 ib_dereg_mr(srp_dev->mr);
1961 ib_dealloc_pd(srp_dev->pd);
1962
1963 kfree(srp_dev);
1779} 1964}
1780 1965
1781static int __init srp_init_module(void) 1966static int __init srp_init_module(void)
1782{ 1967{
1783 int ret; 1968 int ret;
1784 1969
1970 srp_template.sg_tablesize = srp_sg_tablesize;
1971 srp_max_iu_len = (sizeof (struct srp_cmd) +
1972 sizeof (struct srp_indirect_buf) +
1973 srp_sg_tablesize * 16);
1974
1785 ret = class_register(&srp_class); 1975 ret = class_register(&srp_class);
1786 if (ret) { 1976 if (ret) {
1787 printk(KERN_ERR PFX "couldn't register class infiniband_srp\n"); 1977 printk(KERN_ERR PFX "couldn't register class infiniband_srp\n");
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
index c5cd43aae860..5b581fb8eb0d 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.h
+++ b/drivers/infiniband/ulp/srp/ib_srp.h
@@ -46,6 +46,7 @@
46#include <rdma/ib_verbs.h> 46#include <rdma/ib_verbs.h>
47#include <rdma/ib_sa.h> 47#include <rdma/ib_sa.h>
48#include <rdma/ib_cm.h> 48#include <rdma/ib_cm.h>
49#include <rdma/ib_fmr_pool.h>
49 50
50enum { 51enum {
51 SRP_PATH_REC_TIMEOUT_MS = 1000, 52 SRP_PATH_REC_TIMEOUT_MS = 1000,
@@ -55,20 +56,21 @@ enum {
55 SRP_DLID_REDIRECT = 2, 56 SRP_DLID_REDIRECT = 2,
56 57
57 SRP_MAX_LUN = 512, 58 SRP_MAX_LUN = 512,
58 SRP_MAX_IU_LEN = 256, 59 SRP_DEF_SG_TABLESIZE = 12,
59 60
60 SRP_RQ_SHIFT = 6, 61 SRP_RQ_SHIFT = 6,
61 SRP_RQ_SIZE = 1 << SRP_RQ_SHIFT, 62 SRP_RQ_SIZE = 1 << SRP_RQ_SHIFT,
62 SRP_SQ_SIZE = SRP_RQ_SIZE - 1, 63 SRP_SQ_SIZE = SRP_RQ_SIZE - 1,
63 SRP_CQ_SIZE = SRP_SQ_SIZE + SRP_RQ_SIZE, 64 SRP_CQ_SIZE = SRP_SQ_SIZE + SRP_RQ_SIZE,
64 65
65 SRP_TAG_TSK_MGMT = 1 << (SRP_RQ_SHIFT + 1) 66 SRP_TAG_TSK_MGMT = 1 << (SRP_RQ_SHIFT + 1),
67
68 SRP_FMR_SIZE = 256,
69 SRP_FMR_POOL_SIZE = 1024,
70 SRP_FMR_DIRTY_SIZE = SRP_FMR_POOL_SIZE / 4
66}; 71};
67 72
68#define SRP_OP_RECV (1 << 31) 73#define SRP_OP_RECV (1 << 31)
69#define SRP_MAX_INDIRECT ((SRP_MAX_IU_LEN - \
70 sizeof (struct srp_cmd) - \
71 sizeof (struct srp_indirect_buf)) / 16)
72 74
73enum srp_target_state { 75enum srp_target_state {
74 SRP_TARGET_LIVE, 76 SRP_TARGET_LIVE,
@@ -77,15 +79,24 @@ enum srp_target_state {
77 SRP_TARGET_REMOVED 79 SRP_TARGET_REMOVED
78}; 80};
79 81
80struct srp_host { 82struct srp_device {
81 u8 initiator_port_id[16]; 83 struct list_head dev_list;
82 struct ib_device *dev; 84 struct ib_device *dev;
83 u8 port;
84 struct ib_pd *pd; 85 struct ib_pd *pd;
85 struct ib_mr *mr; 86 struct ib_mr *mr;
87 struct ib_fmr_pool *fmr_pool;
88 int fmr_page_shift;
89 int fmr_page_size;
90 unsigned long fmr_page_mask;
91};
92
93struct srp_host {
94 u8 initiator_port_id[16];
95 struct srp_device *dev;
96 u8 port;
86 struct class_device class_dev; 97 struct class_device class_dev;
87 struct list_head target_list; 98 struct list_head target_list;
88 struct mutex target_mutex; 99 spinlock_t target_lock;
89 struct completion released; 100 struct completion released;
90 struct list_head list; 101 struct list_head list;
91}; 102};
@@ -95,6 +106,7 @@ struct srp_request {
95 struct scsi_cmnd *scmnd; 106 struct scsi_cmnd *scmnd;
96 struct srp_iu *cmd; 107 struct srp_iu *cmd;
97 struct srp_iu *tsk_mgmt; 108 struct srp_iu *tsk_mgmt;
109 struct ib_pool_fmr *fmr;
98 /* 110 /*
99 * Fake scatterlist used when scmnd->use_sg==0. Can be killed 111 * Fake scatterlist used when scmnd->use_sg==0. Can be killed
100 * when the SCSI midlayer no longer generates non-SG commands. 112 * when the SCSI midlayer no longer generates non-SG commands.
@@ -110,6 +122,7 @@ struct srp_target_port {
110 __be64 id_ext; 122 __be64 id_ext;
111 __be64 ioc_guid; 123 __be64 ioc_guid;
112 __be64 service_id; 124 __be64 service_id;
125 u16 io_class;
113 struct srp_host *srp_host; 126 struct srp_host *srp_host;
114 struct Scsi_Host *scsi_host; 127 struct Scsi_Host *scsi_host;
115 char target_name[32]; 128 char target_name[32];
@@ -126,6 +139,8 @@ struct srp_target_port {
126 int max_ti_iu_len; 139 int max_ti_iu_len;
127 s32 req_lim; 140 s32 req_lim;
128 141
142 int zero_req_lim;
143
129 unsigned rx_head; 144 unsigned rx_head;
130 struct srp_iu *rx_ring[SRP_RQ_SIZE]; 145 struct srp_iu *rx_ring[SRP_RQ_SIZE];
131 146
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index 2f0f35811bf7..9fd87521a163 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -1052,7 +1052,7 @@ static void wq_set_multicast_list (void *data)
1052 1052
1053 dvb_net_feed_stop(dev); 1053 dvb_net_feed_stop(dev);
1054 priv->rx_mode = RX_MODE_UNI; 1054 priv->rx_mode = RX_MODE_UNI;
1055 spin_lock_bh(&dev->xmit_lock); 1055 netif_tx_lock_bh(dev);
1056 1056
1057 if (dev->flags & IFF_PROMISC) { 1057 if (dev->flags & IFF_PROMISC) {
1058 dprintk("%s: promiscuous mode\n", dev->name); 1058 dprintk("%s: promiscuous mode\n", dev->name);
@@ -1077,7 +1077,7 @@ static void wq_set_multicast_list (void *data)
1077 } 1077 }
1078 } 1078 }
1079 1079
1080 spin_unlock_bh(&dev->xmit_lock); 1080 netif_tx_unlock_bh(dev);
1081 dvb_net_feed_start(dev); 1081 dvb_net_feed_start(dev);
1082} 1082}
1083 1083
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index f2a4d382ea19..3201de053943 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -831,6 +831,7 @@ mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
831 return rc; 831 return rc;
832} 832}
833 833
834#ifdef CONFIG_PM
834/* 835/*
835 * spi module resume handler 836 * spi module resume handler
836 */ 837 */
@@ -846,6 +847,7 @@ mptspi_resume(struct pci_dev *pdev)
846 847
847 return rc; 848 return rc;
848} 849}
850#endif
849 851
850/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 852/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
851/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 853/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index 5ea133c59afb..7bd4d85d0b42 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -55,6 +55,7 @@ struct i2o_exec_wait {
55 u32 m; /* message id */ 55 u32 m; /* message id */
56 struct i2o_message *msg; /* pointer to the reply message */ 56 struct i2o_message *msg; /* pointer to the reply message */
57 struct list_head list; /* node in global wait list */ 57 struct list_head list; /* node in global wait list */
58 spinlock_t lock; /* lock before modifying */
58}; 59};
59 60
60/* Work struct needed to handle LCT NOTIFY replies */ 61/* Work struct needed to handle LCT NOTIFY replies */
@@ -87,6 +88,7 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void)
87 return NULL; 88 return NULL;
88 89
89 INIT_LIST_HEAD(&wait->list); 90 INIT_LIST_HEAD(&wait->list);
91 spin_lock_init(&wait->lock);
90 92
91 return wait; 93 return wait;
92}; 94};
@@ -125,6 +127,7 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
125 DECLARE_WAIT_QUEUE_HEAD(wq); 127 DECLARE_WAIT_QUEUE_HEAD(wq);
126 struct i2o_exec_wait *wait; 128 struct i2o_exec_wait *wait;
127 static u32 tcntxt = 0x80000000; 129 static u32 tcntxt = 0x80000000;
130 long flags;
128 int rc = 0; 131 int rc = 0;
129 132
130 wait = i2o_exec_wait_alloc(); 133 wait = i2o_exec_wait_alloc();
@@ -146,33 +149,28 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
146 wait->tcntxt = tcntxt++; 149 wait->tcntxt = tcntxt++;
147 msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt); 150 msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt);
148 151
152 wait->wq = &wq;
153 /*
154 * we add elements to the head, because if a entry in the list will
155 * never be removed, we have to iterate over it every time
156 */
157 list_add(&wait->list, &i2o_exec_wait_list);
158
149 /* 159 /*
150 * Post the message to the controller. At some point later it will 160 * Post the message to the controller. At some point later it will
151 * return. If we time out before it returns then complete will be zero. 161 * return. If we time out before it returns then complete will be zero.
152 */ 162 */
153 i2o_msg_post(c, msg); 163 i2o_msg_post(c, msg);
154 164
155 if (!wait->complete) { 165 wait_event_interruptible_timeout(wq, wait->complete, timeout * HZ);
156 wait->wq = &wq;
157 /*
158 * we add elements add the head, because if a entry in the list
159 * will never be removed, we have to iterate over it every time
160 */
161 list_add(&wait->list, &i2o_exec_wait_list);
162
163 wait_event_interruptible_timeout(wq, wait->complete,
164 timeout * HZ);
165 166
166 wait->wq = NULL; 167 spin_lock_irqsave(&wait->lock, flags);
167 }
168 168
169 barrier(); 169 wait->wq = NULL;
170 170
171 if (wait->complete) { 171 if (wait->complete)
172 rc = le32_to_cpu(wait->msg->body[0]) >> 24; 172 rc = le32_to_cpu(wait->msg->body[0]) >> 24;
173 i2o_flush_reply(c, wait->m); 173 else {
174 i2o_exec_wait_free(wait);
175 } else {
176 /* 174 /*
177 * We cannot remove it now. This is important. When it does 175 * We cannot remove it now. This is important. When it does
178 * terminate (which it must do if the controller has not 176 * terminate (which it must do if the controller has not
@@ -186,6 +184,13 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
186 rc = -ETIMEDOUT; 184 rc = -ETIMEDOUT;
187 } 185 }
188 186
187 spin_unlock_irqrestore(&wait->lock, flags);
188
189 if (rc != -ETIMEDOUT) {
190 i2o_flush_reply(c, wait->m);
191 i2o_exec_wait_free(wait);
192 }
193
189 return rc; 194 return rc;
190}; 195};
191 196
@@ -213,7 +218,6 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
213{ 218{
214 struct i2o_exec_wait *wait, *tmp; 219 struct i2o_exec_wait *wait, *tmp;
215 unsigned long flags; 220 unsigned long flags;
216 static spinlock_t lock = SPIN_LOCK_UNLOCKED;
217 int rc = 1; 221 int rc = 1;
218 222
219 /* 223 /*
@@ -223,23 +227,24 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
223 * already expired. Not much we can do about that except log it for 227 * already expired. Not much we can do about that except log it for
224 * debug purposes, increase timeout, and recompile. 228 * debug purposes, increase timeout, and recompile.
225 */ 229 */
226 spin_lock_irqsave(&lock, flags);
227 list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) { 230 list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) {
228 if (wait->tcntxt == context) { 231 if (wait->tcntxt == context) {
229 list_del(&wait->list); 232 spin_lock_irqsave(&wait->lock, flags);
230 233
231 spin_unlock_irqrestore(&lock, flags); 234 list_del(&wait->list);
232 235
233 wait->m = m; 236 wait->m = m;
234 wait->msg = msg; 237 wait->msg = msg;
235 wait->complete = 1; 238 wait->complete = 1;
236 239
237 barrier(); 240 if (wait->wq)
238
239 if (wait->wq) {
240 wake_up_interruptible(wait->wq);
241 rc = 0; 241 rc = 0;
242 } else { 242 else
243 rc = -1;
244
245 spin_unlock_irqrestore(&wait->lock, flags);
246
247 if (rc) {
243 struct device *dev; 248 struct device *dev;
244 249
245 dev = &c->pdev->dev; 250 dev = &c->pdev->dev;
@@ -248,15 +253,13 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
248 c->name); 253 c->name);
249 i2o_dma_free(dev, &wait->dma); 254 i2o_dma_free(dev, &wait->dma);
250 i2o_exec_wait_free(wait); 255 i2o_exec_wait_free(wait);
251 rc = -1; 256 } else
252 } 257 wake_up_interruptible(wait->wq);
253 258
254 return rc; 259 return rc;
255 } 260 }
256 } 261 }
257 262
258 spin_unlock_irqrestore(&lock, flags);
259
260 osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name, 263 osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name,
261 context); 264 context);
262 265
@@ -322,14 +325,9 @@ static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL);
322static int i2o_exec_probe(struct device *dev) 325static int i2o_exec_probe(struct device *dev)
323{ 326{
324 struct i2o_device *i2o_dev = to_i2o_device(dev); 327 struct i2o_device *i2o_dev = to_i2o_device(dev);
325 struct i2o_controller *c = i2o_dev->iop;
326 328
327 i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); 329 i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff);
328 330
329 c->exec = i2o_dev;
330
331 i2o_exec_lct_notify(c, c->lct->change_ind + 1);
332
333 device_create_file(dev, &dev_attr_vendor_id); 331 device_create_file(dev, &dev_attr_vendor_id);
334 device_create_file(dev, &dev_attr_product_id); 332 device_create_file(dev, &dev_attr_product_id);
335 333
@@ -523,6 +521,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
523 struct device *dev; 521 struct device *dev;
524 struct i2o_message *msg; 522 struct i2o_message *msg;
525 523
524 down(&c->lct_lock);
525
526 dev = &c->pdev->dev; 526 dev = &c->pdev->dev;
527 527
528 if (i2o_dma_realloc 528 if (i2o_dma_realloc
@@ -545,6 +545,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
545 545
546 i2o_msg_post(c, msg); 546 i2o_msg_post(c, msg);
547 547
548 up(&c->lct_lock);
549
548 return 0; 550 return 0;
549}; 551};
550 552
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index 492167446936..febbdd4e0605 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -804,8 +804,6 @@ void i2o_iop_remove(struct i2o_controller *c)
804 804
805 /* Ask the IOP to switch to RESET state */ 805 /* Ask the IOP to switch to RESET state */
806 i2o_iop_reset(c); 806 i2o_iop_reset(c);
807
808 put_device(&c->device);
809} 807}
810 808
811/** 809/**
@@ -1059,7 +1057,7 @@ struct i2o_controller *i2o_iop_alloc(void)
1059 1057
1060 snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name); 1058 snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name);
1061 if (i2o_pool_alloc 1059 if (i2o_pool_alloc
1062 (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4, 1060 (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4 + sizeof(u32),
1063 I2O_MSG_INPOOL_MIN)) { 1061 I2O_MSG_INPOOL_MIN)) {
1064 kfree(c); 1062 kfree(c);
1065 return ERR_PTR(-ENOMEM); 1063 return ERR_PTR(-ENOMEM);
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c
index f6d51ce34b00..bb44509fd404 100644
--- a/drivers/net/3c501.c
+++ b/drivers/net/3c501.c
@@ -909,7 +909,7 @@ MODULE_PARM_DESC(irq, "EtherLink IRQ number");
909 * here also causes the module to be unloaded 909 * here also causes the module to be unloaded
910 */ 910 */
911 911
912int init_module(void) 912int __init init_module(void)
913{ 913{
914 dev_3c501 = el1_probe(-1); 914 dev_3c501 = el1_probe(-1);
915 if (IS_ERR(dev_3c501)) 915 if (IS_ERR(dev_3c501))
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index dcc98afa65d7..cb5ef75450dc 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -688,7 +688,7 @@ MODULE_LICENSE("GPL");
688 688
689/* This is set up so that only a single autoprobe takes place per call. 689/* This is set up so that only a single autoprobe takes place per call.
690ISA device autoprobes on a running machine are not recommended. */ 690ISA device autoprobes on a running machine are not recommended. */
691int 691int __init
692init_module(void) 692init_module(void)
693{ 693{
694 struct net_device *dev; 694 struct net_device *dev;
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index 111601ca4ca3..19c0b856c488 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -1633,7 +1633,7 @@ MODULE_PARM_DESC(io, "EtherLink Plus I/O base address(es)");
1633MODULE_PARM_DESC(irq, "EtherLink Plus IRQ number(s) (assigned)"); 1633MODULE_PARM_DESC(irq, "EtherLink Plus IRQ number(s) (assigned)");
1634MODULE_PARM_DESC(dma, "EtherLink Plus DMA channel(s)"); 1634MODULE_PARM_DESC(dma, "EtherLink Plus DMA channel(s)");
1635 1635
1636int init_module(void) 1636int __init init_module(void)
1637{ 1637{
1638 int this_dev, found = 0; 1638 int this_dev, found = 0;
1639 1639
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c
index 4db82893909c..6039049259ed 100644
--- a/drivers/net/3c507.c
+++ b/drivers/net/3c507.c
@@ -932,7 +932,7 @@ module_param(irq, int, 0);
932MODULE_PARM_DESC(io, "EtherLink16 I/O base address"); 932MODULE_PARM_DESC(io, "EtherLink16 I/O base address");
933MODULE_PARM_DESC(irq, "(ignored)"); 933MODULE_PARM_DESC(irq, "(ignored)");
934 934
935int init_module(void) 935int __init init_module(void)
936{ 936{
937 if (io == 0) 937 if (io == 0)
938 printk("3c507: You should not use auto-probing with insmod!\n"); 938 printk("3c507: You should not use auto-probing with insmod!\n");
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c
index b40885d41680..4bf8510655c5 100644
--- a/drivers/net/3c523.c
+++ b/drivers/net/3c523.c
@@ -1277,7 +1277,7 @@ MODULE_PARM_DESC(io, "EtherLink/MC I/O base address(es)");
1277MODULE_PARM_DESC(irq, "EtherLink/MC IRQ number(s)"); 1277MODULE_PARM_DESC(irq, "EtherLink/MC IRQ number(s)");
1278MODULE_LICENSE("GPL"); 1278MODULE_LICENSE("GPL");
1279 1279
1280int init_module(void) 1280int __init init_module(void)
1281{ 1281{
1282 int this_dev,found = 0; 1282 int this_dev,found = 0;
1283 1283
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index 6db3301e7965..1b1cb0026072 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -1646,7 +1646,7 @@ static struct net_device *this_device;
1646 * insmod multiple modules for now but it's a hack. 1646 * insmod multiple modules for now but it's a hack.
1647 */ 1647 */
1648 1648
1649int init_module(void) 1649int __init init_module(void)
1650{ 1650{
1651 this_device = mc32_probe(-1); 1651 this_device = mc32_probe(-1);
1652 if (IS_ERR(this_device)) 1652 if (IS_ERR(this_device))
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f499a3bc629f..0c6b45a11d15 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -447,6 +447,7 @@ config MIPS_GT96100ETH
447config MIPS_AU1X00_ENET 447config MIPS_AU1X00_ENET
448 bool "MIPS AU1000 Ethernet support" 448 bool "MIPS AU1000 Ethernet support"
449 depends on NET_ETHERNET && SOC_AU1X00 449 depends on NET_ETHERNET && SOC_AU1X00
450 select PHYLIB
450 select CRC32 451 select CRC32
451 help 452 help
452 If you have an Alchemy Semi AU1X00 based system 453 If you have an Alchemy Semi AU1X00 based system
@@ -869,7 +870,7 @@ config SMC911X
869 tristate "SMSC LAN911[5678] support" 870 tristate "SMSC LAN911[5678] support"
870 select CRC32 871 select CRC32
871 select MII 872 select MII
872 depends on NET_ETHERNET 873 depends on NET_ETHERNET && ARCH_PXA
873 help 874 help
874 This is a driver for SMSC's LAN911x series of Ethernet chipsets 875 This is a driver for SMSC's LAN911x series of Ethernet chipsets
875 including the new LAN9115, LAN9116, LAN9117, and LAN9118. 876 including the new LAN9115, LAN9116, LAN9117, and LAN9118.
@@ -2179,6 +2180,8 @@ config TIGON3
2179config BNX2 2180config BNX2
2180 tristate "Broadcom NetXtremeII support" 2181 tristate "Broadcom NetXtremeII support"
2181 depends on PCI 2182 depends on PCI
2183 select CRC32
2184 select ZLIB_INFLATE
2182 help 2185 help
2183 This driver supports Broadcom NetXtremeII gigabit Ethernet cards. 2186 This driver supports Broadcom NetXtremeII gigabit Ethernet cards.
2184 2187
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index e1fe960d71b3..038d5fcb15e6 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -9,6 +9,9 @@
9 * Update: 2004 Bjoern Riemer, riemer@fokus.fraunhofer.de 9 * Update: 2004 Bjoern Riemer, riemer@fokus.fraunhofer.de
10 * or riemer@riemer-nt.de: fixed the link beat detection with 10 * or riemer@riemer-nt.de: fixed the link beat detection with
11 * ioctls (SIOCGMIIPHY) 11 * ioctls (SIOCGMIIPHY)
12 * Copyright 2006 Herbert Valerio Riedel <hvr@gnu.org>
13 * converted to use linux-2.6.x's PHY framework
14 *
12 * Author: MontaVista Software, Inc. 15 * Author: MontaVista Software, Inc.
13 * ppopov@mvista.com or source@mvista.com 16 * ppopov@mvista.com or source@mvista.com
14 * 17 *
@@ -53,6 +56,7 @@
53#include <linux/skbuff.h> 56#include <linux/skbuff.h>
54#include <linux/delay.h> 57#include <linux/delay.h>
55#include <linux/crc32.h> 58#include <linux/crc32.h>
59#include <linux/phy.h>
56#include <asm/mipsregs.h> 60#include <asm/mipsregs.h>
57#include <asm/irq.h> 61#include <asm/irq.h>
58#include <asm/io.h> 62#include <asm/io.h>
@@ -88,17 +92,15 @@ static int au1000_tx(struct sk_buff *, struct net_device *);
88static int au1000_rx(struct net_device *); 92static int au1000_rx(struct net_device *);
89static irqreturn_t au1000_interrupt(int, void *, struct pt_regs *); 93static irqreturn_t au1000_interrupt(int, void *, struct pt_regs *);
90static void au1000_tx_timeout(struct net_device *); 94static void au1000_tx_timeout(struct net_device *);
91static int au1000_set_config(struct net_device *dev, struct ifmap *map);
92static void set_rx_mode(struct net_device *); 95static void set_rx_mode(struct net_device *);
93static struct net_device_stats *au1000_get_stats(struct net_device *); 96static struct net_device_stats *au1000_get_stats(struct net_device *);
94static void au1000_timer(unsigned long);
95static int au1000_ioctl(struct net_device *, struct ifreq *, int); 97static int au1000_ioctl(struct net_device *, struct ifreq *, int);
96static int mdio_read(struct net_device *, int, int); 98static int mdio_read(struct net_device *, int, int);
97static void mdio_write(struct net_device *, int, int, u16); 99static void mdio_write(struct net_device *, int, int, u16);
98static void dump_mii(struct net_device *dev, int phy_id); 100static void au1000_adjust_link(struct net_device *);
101static void enable_mac(struct net_device *, int);
99 102
100// externs 103// externs
101extern void ack_rise_edge_irq(unsigned int);
102extern int get_ethernet_addr(char *ethernet_addr); 104extern int get_ethernet_addr(char *ethernet_addr);
103extern void str2eaddr(unsigned char *ea, unsigned char *str); 105extern void str2eaddr(unsigned char *ea, unsigned char *str);
104extern char * __init prom_getcmdline(void); 106extern char * __init prom_getcmdline(void);
@@ -126,705 +128,83 @@ static unsigned char au1000_mac_addr[6] __devinitdata = {
126 0x00, 0x50, 0xc2, 0x0c, 0x30, 0x00 128 0x00, 0x50, 0xc2, 0x0c, 0x30, 0x00
127}; 129};
128 130
129#define nibswap(x) ((((x) >> 4) & 0x0f) | (((x) << 4) & 0xf0))
130#define RUN_AT(x) (jiffies + (x))
131
132// For reading/writing 32-bit words from/to DMA memory
133#define cpu_to_dma32 cpu_to_be32
134#define dma32_to_cpu be32_to_cpu
135
136struct au1000_private *au_macs[NUM_ETH_INTERFACES]; 131struct au1000_private *au_macs[NUM_ETH_INTERFACES];
137 132
138/* FIXME 133/*
139 * All of the PHY code really should be detached from the MAC 134 * board-specific configurations
140 * code. 135 *
136 * PHY detection algorithm
137 *
138 * If AU1XXX_PHY_STATIC_CONFIG is undefined, the PHY setup is
139 * autodetected:
140 *
141 * mii_probe() first searches the current MAC's MII bus for a PHY,
142 * selecting the first (or last, if AU1XXX_PHY_SEARCH_HIGHEST_ADDR is
143 * defined) PHY address not already claimed by another netdev.
144 *
145 * If nothing was found that way when searching for the 2nd ethernet
146 * controller's PHY and AU1XXX_PHY1_SEARCH_ON_MAC0 is defined, then
147 * the first MII bus is searched as well for an unclaimed PHY; this is
148 * needed in case of a dual-PHY accessible only through the MAC0's MII
149 * bus.
150 *
151 * Finally, if no PHY is found, then the corresponding ethernet
152 * controller is not registered to the network subsystem.
141 */ 153 */
142 154
143/* Default advertise */ 155/* autodetection defaults */
144#define GENMII_DEFAULT_ADVERTISE \ 156#undef AU1XXX_PHY_SEARCH_HIGHEST_ADDR
145 ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | \ 157#define AU1XXX_PHY1_SEARCH_ON_MAC0
146 ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | \
147 ADVERTISED_Autoneg
148
149#define GENMII_DEFAULT_FEATURES \
150 SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | \
151 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | \
152 SUPPORTED_Autoneg
153
154int bcm_5201_init(struct net_device *dev, int phy_addr)
155{
156 s16 data;
157
158 /* Stop auto-negotiation */
159 data = mdio_read(dev, phy_addr, MII_CONTROL);
160 mdio_write(dev, phy_addr, MII_CONTROL, data & ~MII_CNTL_AUTO);
161
162 /* Set advertisement to 10/100 and Half/Full duplex
163 * (full capabilities) */
164 data = mdio_read(dev, phy_addr, MII_ANADV);
165 data |= MII_NWAY_TX | MII_NWAY_TX_FDX | MII_NWAY_T_FDX | MII_NWAY_T;
166 mdio_write(dev, phy_addr, MII_ANADV, data);
167
168 /* Restart auto-negotiation */
169 data = mdio_read(dev, phy_addr, MII_CONTROL);
170 data |= MII_CNTL_RST_AUTO | MII_CNTL_AUTO;
171 mdio_write(dev, phy_addr, MII_CONTROL, data);
172
173 if (au1000_debug > 4)
174 dump_mii(dev, phy_addr);
175 return 0;
176}
177
178int bcm_5201_reset(struct net_device *dev, int phy_addr)
179{
180 s16 mii_control, timeout;
181
182 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
183 mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
184 mdelay(1);
185 for (timeout = 100; timeout > 0; --timeout) {
186 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
187 if ((mii_control & MII_CNTL_RESET) == 0)
188 break;
189 mdelay(1);
190 }
191 if (mii_control & MII_CNTL_RESET) {
192 printk(KERN_ERR "%s PHY reset timeout !\n", dev->name);
193 return -1;
194 }
195 return 0;
196}
197
198int
199bcm_5201_status(struct net_device *dev, int phy_addr, u16 *link, u16 *speed)
200{
201 u16 mii_data;
202 struct au1000_private *aup;
203
204 if (!dev) {
205 printk(KERN_ERR "bcm_5201_status error: NULL dev\n");
206 return -1;
207 }
208 aup = (struct au1000_private *) dev->priv;
209
210 mii_data = mdio_read(dev, aup->phy_addr, MII_STATUS);
211 if (mii_data & MII_STAT_LINK) {
212 *link = 1;
213 mii_data = mdio_read(dev, aup->phy_addr, MII_AUX_CNTRL);
214 if (mii_data & MII_AUX_100) {
215 if (mii_data & MII_AUX_FDX) {
216 *speed = IF_PORT_100BASEFX;
217 dev->if_port = IF_PORT_100BASEFX;
218 }
219 else {
220 *speed = IF_PORT_100BASETX;
221 dev->if_port = IF_PORT_100BASETX;
222 }
223 }
224 else {
225 *speed = IF_PORT_10BASET;
226 dev->if_port = IF_PORT_10BASET;
227 }
228
229 }
230 else {
231 *link = 0;
232 *speed = 0;
233 dev->if_port = IF_PORT_UNKNOWN;
234 }
235 return 0;
236}
237
238int lsi_80227_init(struct net_device *dev, int phy_addr)
239{
240 if (au1000_debug > 4)
241 printk("lsi_80227_init\n");
242
243 /* restart auto-negotiation */
244 mdio_write(dev, phy_addr, MII_CONTROL,
245 MII_CNTL_F100 | MII_CNTL_AUTO | MII_CNTL_RST_AUTO); // | MII_CNTL_FDX);
246 mdelay(1);
247
248 /* set up LEDs to correct display */
249#ifdef CONFIG_MIPS_MTX1
250 mdio_write(dev, phy_addr, 17, 0xff80);
251#else
252 mdio_write(dev, phy_addr, 17, 0xffc0);
253#endif
254
255 if (au1000_debug > 4)
256 dump_mii(dev, phy_addr);
257 return 0;
258}
259
260int lsi_80227_reset(struct net_device *dev, int phy_addr)
261{
262 s16 mii_control, timeout;
263
264 if (au1000_debug > 4) {
265 printk("lsi_80227_reset\n");
266 dump_mii(dev, phy_addr);
267 }
268
269 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
270 mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
271 mdelay(1);
272 for (timeout = 100; timeout > 0; --timeout) {
273 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
274 if ((mii_control & MII_CNTL_RESET) == 0)
275 break;
276 mdelay(1);
277 }
278 if (mii_control & MII_CNTL_RESET) {
279 printk(KERN_ERR "%s PHY reset timeout !\n", dev->name);
280 return -1;
281 }
282 return 0;
283}
284
285int
286lsi_80227_status(struct net_device *dev, int phy_addr, u16 *link, u16 *speed)
287{
288 u16 mii_data;
289 struct au1000_private *aup;
290
291 if (!dev) {
292 printk(KERN_ERR "lsi_80227_status error: NULL dev\n");
293 return -1;
294 }
295 aup = (struct au1000_private *) dev->priv;
296
297 mii_data = mdio_read(dev, aup->phy_addr, MII_STATUS);
298 if (mii_data & MII_STAT_LINK) {
299 *link = 1;
300 mii_data = mdio_read(dev, aup->phy_addr, MII_LSI_PHY_STAT);
301 if (mii_data & MII_LSI_PHY_STAT_SPD) {
302 if (mii_data & MII_LSI_PHY_STAT_FDX) {
303 *speed = IF_PORT_100BASEFX;
304 dev->if_port = IF_PORT_100BASEFX;
305 }
306 else {
307 *speed = IF_PORT_100BASETX;
308 dev->if_port = IF_PORT_100BASETX;
309 }
310 }
311 else {
312 *speed = IF_PORT_10BASET;
313 dev->if_port = IF_PORT_10BASET;
314 }
315
316 }
317 else {
318 *link = 0;
319 *speed = 0;
320 dev->if_port = IF_PORT_UNKNOWN;
321 }
322 return 0;
323}
324
325int am79c901_init(struct net_device *dev, int phy_addr)
326{
327 printk("am79c901_init\n");
328 return 0;
329}
330
331int am79c901_reset(struct net_device *dev, int phy_addr)
332{
333 printk("am79c901_reset\n");
334 return 0;
335}
336
337int
338am79c901_status(struct net_device *dev, int phy_addr, u16 *link, u16 *speed)
339{
340 return 0;
341}
342
343int am79c874_init(struct net_device *dev, int phy_addr)
344{
345 s16 data;
346
347 /* 79c874 has quit resembled bit assignments to BCM5201 */
348 if (au1000_debug > 4)
349 printk("am79c847_init\n");
350
351 /* Stop auto-negotiation */
352 data = mdio_read(dev, phy_addr, MII_CONTROL);
353 mdio_write(dev, phy_addr, MII_CONTROL, data & ~MII_CNTL_AUTO);
354
355 /* Set advertisement to 10/100 and Half/Full duplex
356 * (full capabilities) */
357 data = mdio_read(dev, phy_addr, MII_ANADV);
358 data |= MII_NWAY_TX | MII_NWAY_TX_FDX | MII_NWAY_T_FDX | MII_NWAY_T;
359 mdio_write(dev, phy_addr, MII_ANADV, data);
360
361 /* Restart auto-negotiation */
362 data = mdio_read(dev, phy_addr, MII_CONTROL);
363 data |= MII_CNTL_RST_AUTO | MII_CNTL_AUTO;
364
365 mdio_write(dev, phy_addr, MII_CONTROL, data);
366
367 if (au1000_debug > 4) dump_mii(dev, phy_addr);
368 return 0;
369}
370
371int am79c874_reset(struct net_device *dev, int phy_addr)
372{
373 s16 mii_control, timeout;
374
375 if (au1000_debug > 4)
376 printk("am79c874_reset\n");
377
378 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
379 mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
380 mdelay(1);
381 for (timeout = 100; timeout > 0; --timeout) {
382 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
383 if ((mii_control & MII_CNTL_RESET) == 0)
384 break;
385 mdelay(1);
386 }
387 if (mii_control & MII_CNTL_RESET) {
388 printk(KERN_ERR "%s PHY reset timeout !\n", dev->name);
389 return -1;
390 }
391 return 0;
392}
393
394int
395am79c874_status(struct net_device *dev, int phy_addr, u16 *link, u16 *speed)
396{
397 u16 mii_data;
398 struct au1000_private *aup;
399
400 // printk("am79c874_status\n");
401 if (!dev) {
402 printk(KERN_ERR "am79c874_status error: NULL dev\n");
403 return -1;
404 }
405
406 aup = (struct au1000_private *) dev->priv;
407 mii_data = mdio_read(dev, aup->phy_addr, MII_STATUS);
408 158
409 if (mii_data & MII_STAT_LINK) { 159/* static PHY setup
410 *link = 1; 160 *
411 mii_data = mdio_read(dev, aup->phy_addr, MII_AMD_PHY_STAT); 161 * most boards PHY setup should be detectable properly with the
412 if (mii_data & MII_AMD_PHY_STAT_SPD) { 162 * autodetection algorithm in mii_probe(), but in some cases (e.g. if
413 if (mii_data & MII_AMD_PHY_STAT_FDX) { 163 * you have a switch attached, or want to use the PHY's interrupt
414 *speed = IF_PORT_100BASEFX; 164 * notification capabilities) you can provide a static PHY
415 dev->if_port = IF_PORT_100BASEFX; 165 * configuration here
416 } 166 *
417 else { 167 * IRQs may only be set, if a PHY address was configured
418 *speed = IF_PORT_100BASETX; 168 * If a PHY address is given, also a bus id is required to be set
419 dev->if_port = IF_PORT_100BASETX; 169 *
420 } 170 * ps: make sure the used irqs are configured properly in the board
421 } 171 * specific irq-map
422 else { 172 */
423 *speed = IF_PORT_10BASET;
424 dev->if_port = IF_PORT_10BASET;
425 }
426
427 }
428 else {
429 *link = 0;
430 *speed = 0;
431 dev->if_port = IF_PORT_UNKNOWN;
432 }
433 return 0;
434}
435
436int lxt971a_init(struct net_device *dev, int phy_addr)
437{
438 if (au1000_debug > 4)
439 printk("lxt971a_init\n");
440
441 /* restart auto-negotiation */
442 mdio_write(dev, phy_addr, MII_CONTROL,
443 MII_CNTL_F100 | MII_CNTL_AUTO | MII_CNTL_RST_AUTO | MII_CNTL_FDX);
444
445 /* set up LEDs to correct display */
446 mdio_write(dev, phy_addr, 20, 0x0422);
447
448 if (au1000_debug > 4)
449 dump_mii(dev, phy_addr);
450 return 0;
451}
452
453int lxt971a_reset(struct net_device *dev, int phy_addr)
454{
455 s16 mii_control, timeout;
456
457 if (au1000_debug > 4) {
458 printk("lxt971a_reset\n");
459 dump_mii(dev, phy_addr);
460 }
461
462 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
463 mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
464 mdelay(1);
465 for (timeout = 100; timeout > 0; --timeout) {
466 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
467 if ((mii_control & MII_CNTL_RESET) == 0)
468 break;
469 mdelay(1);
470 }
471 if (mii_control & MII_CNTL_RESET) {
472 printk(KERN_ERR "%s PHY reset timeout !\n", dev->name);
473 return -1;
474 }
475 return 0;
476}
477
478int
479lxt971a_status(struct net_device *dev, int phy_addr, u16 *link, u16 *speed)
480{
481 u16 mii_data;
482 struct au1000_private *aup;
483
484 if (!dev) {
485 printk(KERN_ERR "lxt971a_status error: NULL dev\n");
486 return -1;
487 }
488 aup = (struct au1000_private *) dev->priv;
489
490 mii_data = mdio_read(dev, aup->phy_addr, MII_STATUS);
491 if (mii_data & MII_STAT_LINK) {
492 *link = 1;
493 mii_data = mdio_read(dev, aup->phy_addr, MII_INTEL_PHY_STAT);
494 if (mii_data & MII_INTEL_PHY_STAT_SPD) {
495 if (mii_data & MII_INTEL_PHY_STAT_FDX) {
496 *speed = IF_PORT_100BASEFX;
497 dev->if_port = IF_PORT_100BASEFX;
498 }
499 else {
500 *speed = IF_PORT_100BASETX;
501 dev->if_port = IF_PORT_100BASETX;
502 }
503 }
504 else {
505 *speed = IF_PORT_10BASET;
506 dev->if_port = IF_PORT_10BASET;
507 }
508
509 }
510 else {
511 *link = 0;
512 *speed = 0;
513 dev->if_port = IF_PORT_UNKNOWN;
514 }
515 return 0;
516}
517
518int ks8995m_init(struct net_device *dev, int phy_addr)
519{
520 s16 data;
521
522// printk("ks8995m_init\n");
523 /* Stop auto-negotiation */
524 data = mdio_read(dev, phy_addr, MII_CONTROL);
525 mdio_write(dev, phy_addr, MII_CONTROL, data & ~MII_CNTL_AUTO);
526
527 /* Set advertisement to 10/100 and Half/Full duplex
528 * (full capabilities) */
529 data = mdio_read(dev, phy_addr, MII_ANADV);
530 data |= MII_NWAY_TX | MII_NWAY_TX_FDX | MII_NWAY_T_FDX | MII_NWAY_T;
531 mdio_write(dev, phy_addr, MII_ANADV, data);
532
533 /* Restart auto-negotiation */
534 data = mdio_read(dev, phy_addr, MII_CONTROL);
535 data |= MII_CNTL_RST_AUTO | MII_CNTL_AUTO;
536 mdio_write(dev, phy_addr, MII_CONTROL, data);
537
538 if (au1000_debug > 4) dump_mii(dev, phy_addr);
539
540 return 0;
541}
542
543int ks8995m_reset(struct net_device *dev, int phy_addr)
544{
545 s16 mii_control, timeout;
546
547// printk("ks8995m_reset\n");
548 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
549 mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
550 mdelay(1);
551 for (timeout = 100; timeout > 0; --timeout) {
552 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
553 if ((mii_control & MII_CNTL_RESET) == 0)
554 break;
555 mdelay(1);
556 }
557 if (mii_control & MII_CNTL_RESET) {
558 printk(KERN_ERR "%s PHY reset timeout !\n", dev->name);
559 return -1;
560 }
561 return 0;
562}
563
564int ks8995m_status(struct net_device *dev, int phy_addr, u16 *link, u16 *speed)
565{
566 u16 mii_data;
567 struct au1000_private *aup;
568
569 if (!dev) {
570 printk(KERN_ERR "ks8995m_status error: NULL dev\n");
571 return -1;
572 }
573 aup = (struct au1000_private *) dev->priv;
574
575 mii_data = mdio_read(dev, aup->phy_addr, MII_STATUS);
576 if (mii_data & MII_STAT_LINK) {
577 *link = 1;
578 mii_data = mdio_read(dev, aup->phy_addr, MII_AUX_CNTRL);
579 if (mii_data & MII_AUX_100) {
580 if (mii_data & MII_AUX_FDX) {
581 *speed = IF_PORT_100BASEFX;
582 dev->if_port = IF_PORT_100BASEFX;
583 }
584 else {
585 *speed = IF_PORT_100BASETX;
586 dev->if_port = IF_PORT_100BASETX;
587 }
588 }
589 else {
590 *speed = IF_PORT_10BASET;
591 dev->if_port = IF_PORT_10BASET;
592 }
593
594 }
595 else {
596 *link = 0;
597 *speed = 0;
598 dev->if_port = IF_PORT_UNKNOWN;
599 }
600 return 0;
601}
602
603int
604smsc_83C185_init (struct net_device *dev, int phy_addr)
605{
606 s16 data;
607
608 if (au1000_debug > 4)
609 printk("smsc_83C185_init\n");
610
611 /* Stop auto-negotiation */
612 data = mdio_read(dev, phy_addr, MII_CONTROL);
613 mdio_write(dev, phy_addr, MII_CONTROL, data & ~MII_CNTL_AUTO);
614
615 /* Set advertisement to 10/100 and Half/Full duplex
616 * (full capabilities) */
617 data = mdio_read(dev, phy_addr, MII_ANADV);
618 data |= MII_NWAY_TX | MII_NWAY_TX_FDX | MII_NWAY_T_FDX | MII_NWAY_T;
619 mdio_write(dev, phy_addr, MII_ANADV, data);
620
621 /* Restart auto-negotiation */
622 data = mdio_read(dev, phy_addr, MII_CONTROL);
623 data |= MII_CNTL_RST_AUTO | MII_CNTL_AUTO;
624
625 mdio_write(dev, phy_addr, MII_CONTROL, data);
626
627 if (au1000_debug > 4) dump_mii(dev, phy_addr);
628 return 0;
629}
630
631int
632smsc_83C185_reset (struct net_device *dev, int phy_addr)
633{
634 s16 mii_control, timeout;
635
636 if (au1000_debug > 4)
637 printk("smsc_83C185_reset\n");
638
639 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
640 mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
641 mdelay(1);
642 for (timeout = 100; timeout > 0; --timeout) {
643 mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
644 if ((mii_control & MII_CNTL_RESET) == 0)
645 break;
646 mdelay(1);
647 }
648 if (mii_control & MII_CNTL_RESET) {
649 printk(KERN_ERR "%s PHY reset timeout !\n", dev->name);
650 return -1;
651 }
652 return 0;
653}
654
655int
656smsc_83C185_status (struct net_device *dev, int phy_addr, u16 *link, u16 *speed)
657{
658 u16 mii_data;
659 struct au1000_private *aup;
660
661 if (!dev) {
662 printk(KERN_ERR "smsc_83C185_status error: NULL dev\n");
663 return -1;
664 }
665
666 aup = (struct au1000_private *) dev->priv;
667 mii_data = mdio_read(dev, aup->phy_addr, MII_STATUS);
668
669 if (mii_data & MII_STAT_LINK) {
670 *link = 1;
671 mii_data = mdio_read(dev, aup->phy_addr, 0x1f);
672 if (mii_data & (1<<3)) {
673 if (mii_data & (1<<4)) {
674 *speed = IF_PORT_100BASEFX;
675 dev->if_port = IF_PORT_100BASEFX;
676 }
677 else {
678 *speed = IF_PORT_100BASETX;
679 dev->if_port = IF_PORT_100BASETX;
680 }
681 }
682 else {
683 *speed = IF_PORT_10BASET;
684 dev->if_port = IF_PORT_10BASET;
685 }
686 }
687 else {
688 *link = 0;
689 *speed = 0;
690 dev->if_port = IF_PORT_UNKNOWN;
691 }
692 return 0;
693}
694
695
696#ifdef CONFIG_MIPS_BOSPORUS
697int stub_init(struct net_device *dev, int phy_addr)
698{
699 //printk("PHY stub_init\n");
700 return 0;
701}
702
703int stub_reset(struct net_device *dev, int phy_addr)
704{
705 //printk("PHY stub_reset\n");
706 return 0;
707}
708
709int
710stub_status(struct net_device *dev, int phy_addr, u16 *link, u16 *speed)
711{
712 //printk("PHY stub_status\n");
713 *link = 1;
714 /* hmmm, revisit */
715 *speed = IF_PORT_100BASEFX;
716 dev->if_port = IF_PORT_100BASEFX;
717 return 0;
718}
719#endif
720
721struct phy_ops bcm_5201_ops = {
722 bcm_5201_init,
723 bcm_5201_reset,
724 bcm_5201_status,
725};
726
727struct phy_ops am79c874_ops = {
728 am79c874_init,
729 am79c874_reset,
730 am79c874_status,
731};
732
733struct phy_ops am79c901_ops = {
734 am79c901_init,
735 am79c901_reset,
736 am79c901_status,
737};
738
739struct phy_ops lsi_80227_ops = {
740 lsi_80227_init,
741 lsi_80227_reset,
742 lsi_80227_status,
743};
744
745struct phy_ops lxt971a_ops = {
746 lxt971a_init,
747 lxt971a_reset,
748 lxt971a_status,
749};
750 173
751struct phy_ops ks8995m_ops = { 174#if defined(CONFIG_MIPS_BOSPORUS)
752 ks8995m_init, 175/*
753 ks8995m_reset, 176 * Micrel/Kendin 5 port switch attached to MAC0,
754 ks8995m_status, 177 * MAC0 is associated with PHY address 5 (== WAN port)
755}; 178 * MAC1 is not associated with any PHY, since it's connected directly
179 * to the switch.
180 * no interrupts are used
181 */
182# define AU1XXX_PHY_STATIC_CONFIG
756 183
757struct phy_ops smsc_83C185_ops = { 184# define AU1XXX_PHY0_ADDR 5
758 smsc_83C185_init, 185# define AU1XXX_PHY0_BUSID 0
759 smsc_83C185_reset, 186# undef AU1XXX_PHY0_IRQ
760 smsc_83C185_status,
761};
762 187
763#ifdef CONFIG_MIPS_BOSPORUS 188# undef AU1XXX_PHY1_ADDR
764struct phy_ops stub_ops = { 189# undef AU1XXX_PHY1_BUSID
765 stub_init, 190# undef AU1XXX_PHY1_IRQ
766 stub_reset,
767 stub_status,
768};
769#endif 191#endif
770 192
771static struct mii_chip_info { 193#if defined(AU1XXX_PHY0_BUSID) && (AU1XXX_PHY0_BUSID > 0)
772 const char * name; 194# error MAC0-associated PHY attached 2nd MACs MII bus not supported yet
773 u16 phy_id0;
774 u16 phy_id1;
775 struct phy_ops *phy_ops;
776 int dual_phy;
777} mii_chip_table[] = {
778 {"Broadcom BCM5201 10/100 BaseT PHY",0x0040,0x6212, &bcm_5201_ops,0},
779 {"Broadcom BCM5221 10/100 BaseT PHY",0x0040,0x61e4, &bcm_5201_ops,0},
780 {"Broadcom BCM5222 10/100 BaseT PHY",0x0040,0x6322, &bcm_5201_ops,1},
781 {"NS DP83847 PHY", 0x2000, 0x5c30, &bcm_5201_ops ,0},
782 {"AMD 79C901 HomePNA PHY",0x0000,0x35c8, &am79c901_ops,0},
783 {"AMD 79C874 10/100 BaseT PHY",0x0022,0x561b, &am79c874_ops,0},
784 {"LSI 80227 10/100 BaseT PHY",0x0016,0xf840, &lsi_80227_ops,0},
785 {"Intel LXT971A Dual Speed PHY",0x0013,0x78e2, &lxt971a_ops,0},
786 {"Kendin KS8995M 10/100 BaseT PHY",0x0022,0x1450, &ks8995m_ops,0},
787 {"SMSC LAN83C185 10/100 BaseT PHY",0x0007,0xc0a3, &smsc_83C185_ops,0},
788#ifdef CONFIG_MIPS_BOSPORUS
789 {"Stub", 0x1234, 0x5678, &stub_ops },
790#endif 195#endif
791 {0,},
792};
793 196
794static int mdio_read(struct net_device *dev, int phy_id, int reg) 197/*
198 * MII operations
199 */
200static int mdio_read(struct net_device *dev, int phy_addr, int reg)
795{ 201{
796 struct au1000_private *aup = (struct au1000_private *) dev->priv; 202 struct au1000_private *aup = (struct au1000_private *) dev->priv;
797 volatile u32 *mii_control_reg; 203 volatile u32 *const mii_control_reg = &aup->mac->mii_control;
798 volatile u32 *mii_data_reg; 204 volatile u32 *const mii_data_reg = &aup->mac->mii_data;
799 u32 timedout = 20; 205 u32 timedout = 20;
800 u32 mii_control; 206 u32 mii_control;
801 207
802 #ifdef CONFIG_BCM5222_DUAL_PHY
803 /* First time we probe, it's for the mac0 phy.
804 * Since we haven't determined yet that we have a dual phy,
805 * aup->mii->mii_control_reg won't be setup and we'll
806 * default to the else statement.
807 * By the time we probe for the mac1 phy, the mii_control_reg
808 * will be setup to be the address of the mac0 phy control since
809 * both phys are controlled through mac0.
810 */
811 if (aup->mii && aup->mii->mii_control_reg) {
812 mii_control_reg = aup->mii->mii_control_reg;
813 mii_data_reg = aup->mii->mii_data_reg;
814 }
815 else if (au_macs[0]->mii && au_macs[0]->mii->mii_control_reg) {
816 /* assume both phys are controlled through mac0 */
817 mii_control_reg = au_macs[0]->mii->mii_control_reg;
818 mii_data_reg = au_macs[0]->mii->mii_data_reg;
819 }
820 else
821 #endif
822 {
823 /* default control and data reg addresses */
824 mii_control_reg = &aup->mac->mii_control;
825 mii_data_reg = &aup->mac->mii_data;
826 }
827
828 while (*mii_control_reg & MAC_MII_BUSY) { 208 while (*mii_control_reg & MAC_MII_BUSY) {
829 mdelay(1); 209 mdelay(1);
830 if (--timedout == 0) { 210 if (--timedout == 0) {
@@ -835,7 +215,7 @@ static int mdio_read(struct net_device *dev, int phy_id, int reg)
835 } 215 }
836 216
837 mii_control = MAC_SET_MII_SELECT_REG(reg) | 217 mii_control = MAC_SET_MII_SELECT_REG(reg) |
838 MAC_SET_MII_SELECT_PHY(phy_id) | MAC_MII_READ; 218 MAC_SET_MII_SELECT_PHY(phy_addr) | MAC_MII_READ;
839 219
840 *mii_control_reg = mii_control; 220 *mii_control_reg = mii_control;
841 221
@@ -851,32 +231,14 @@ static int mdio_read(struct net_device *dev, int phy_id, int reg)
851 return (int)*mii_data_reg; 231 return (int)*mii_data_reg;
852} 232}
853 233
854static void mdio_write(struct net_device *dev, int phy_id, int reg, u16 value) 234static void mdio_write(struct net_device *dev, int phy_addr, int reg, u16 value)
855{ 235{
856 struct au1000_private *aup = (struct au1000_private *) dev->priv; 236 struct au1000_private *aup = (struct au1000_private *) dev->priv;
857 volatile u32 *mii_control_reg; 237 volatile u32 *const mii_control_reg = &aup->mac->mii_control;
858 volatile u32 *mii_data_reg; 238 volatile u32 *const mii_data_reg = &aup->mac->mii_data;
859 u32 timedout = 20; 239 u32 timedout = 20;
860 u32 mii_control; 240 u32 mii_control;
861 241
862 #ifdef CONFIG_BCM5222_DUAL_PHY
863 if (aup->mii && aup->mii->mii_control_reg) {
864 mii_control_reg = aup->mii->mii_control_reg;
865 mii_data_reg = aup->mii->mii_data_reg;
866 }
867 else if (au_macs[0]->mii && au_macs[0]->mii->mii_control_reg) {
868 /* assume both phys are controlled through mac0 */
869 mii_control_reg = au_macs[0]->mii->mii_control_reg;
870 mii_data_reg = au_macs[0]->mii->mii_data_reg;
871 }
872 else
873 #endif
874 {
875 /* default control and data reg addresses */
876 mii_control_reg = &aup->mac->mii_control;
877 mii_data_reg = &aup->mac->mii_data;
878 }
879
880 while (*mii_control_reg & MAC_MII_BUSY) { 242 while (*mii_control_reg & MAC_MII_BUSY) {
881 mdelay(1); 243 mdelay(1);
882 if (--timedout == 0) { 244 if (--timedout == 0) {
@@ -887,165 +249,145 @@ static void mdio_write(struct net_device *dev, int phy_id, int reg, u16 value)
887 } 249 }
888 250
889 mii_control = MAC_SET_MII_SELECT_REG(reg) | 251 mii_control = MAC_SET_MII_SELECT_REG(reg) |
890 MAC_SET_MII_SELECT_PHY(phy_id) | MAC_MII_WRITE; 252 MAC_SET_MII_SELECT_PHY(phy_addr) | MAC_MII_WRITE;
891 253
892 *mii_data_reg = value; 254 *mii_data_reg = value;
893 *mii_control_reg = mii_control; 255 *mii_control_reg = mii_control;
894} 256}
895 257
258static int mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
259{
260 /* WARNING: bus->phy_map[phy_addr].attached_dev == dev does
261 * _NOT_ hold (e.g. when PHY is accessed through other MAC's MII bus) */
262 struct net_device *const dev = bus->priv;
263
264 enable_mac(dev, 0); /* make sure the MAC associated with this
265 * mii_bus is enabled */
266 return mdio_read(dev, phy_addr, regnum);
267}
896 268
897static void dump_mii(struct net_device *dev, int phy_id) 269static int mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
270 u16 value)
898{ 271{
899 int i, val; 272 struct net_device *const dev = bus->priv;
900 273
901 for (i = 0; i < 7; i++) { 274 enable_mac(dev, 0); /* make sure the MAC associated with this
902 if ((val = mdio_read(dev, phy_id, i)) >= 0) 275 * mii_bus is enabled */
903 printk("%s: MII Reg %d=%x\n", dev->name, i, val); 276 mdio_write(dev, phy_addr, regnum, value);
904 } 277 return 0;
905 for (i = 16; i < 25; i++) {
906 if ((val = mdio_read(dev, phy_id, i)) >= 0)
907 printk("%s: MII Reg %d=%x\n", dev->name, i, val);
908 }
909} 278}
910 279
911static int mii_probe (struct net_device * dev) 280static int mdiobus_reset(struct mii_bus *bus)
912{ 281{
913 struct au1000_private *aup = (struct au1000_private *) dev->priv; 282 struct net_device *const dev = bus->priv;
914 int phy_addr;
915#ifdef CONFIG_MIPS_BOSPORUS
916 int phy_found=0;
917#endif
918 283
919 /* search for total of 32 possible mii phy addresses */ 284 enable_mac(dev, 0); /* make sure the MAC associated with this
920 for (phy_addr = 0; phy_addr < 32; phy_addr++) { 285 * mii_bus is enabled */
921 u16 mii_status; 286 return 0;
922 u16 phy_id0, phy_id1; 287}
923 int i;
924 288
925 #ifdef CONFIG_BCM5222_DUAL_PHY 289static int mii_probe (struct net_device *dev)
926 /* Mask the already found phy, try next one */ 290{
927 if (au_macs[0]->mii && au_macs[0]->mii->mii_control_reg) { 291 struct au1000_private *const aup = (struct au1000_private *) dev->priv;
928 if (au_macs[0]->phy_addr == phy_addr) 292 struct phy_device *phydev = NULL;
929 continue; 293
930 } 294#if defined(AU1XXX_PHY_STATIC_CONFIG)
931 #endif 295 BUG_ON(aup->mac_id < 0 || aup->mac_id > 1);
932 296
933 mii_status = mdio_read(dev, phy_addr, MII_STATUS); 297 if(aup->mac_id == 0) { /* get PHY0 */
934 if (mii_status == 0xffff || mii_status == 0x0000) 298# if defined(AU1XXX_PHY0_ADDR)
935 /* the mii is not accessable, try next one */ 299 phydev = au_macs[AU1XXX_PHY0_BUSID]->mii_bus.phy_map[AU1XXX_PHY0_ADDR];
936 continue; 300# else
937 301 printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n",
938 phy_id0 = mdio_read(dev, phy_addr, MII_PHY_ID0); 302 dev->name);
939 phy_id1 = mdio_read(dev, phy_addr, MII_PHY_ID1); 303 return 0;
940 304# endif /* defined(AU1XXX_PHY0_ADDR) */
941 /* search our mii table for the current mii */ 305 } else if (aup->mac_id == 1) { /* get PHY1 */
942 for (i = 0; mii_chip_table[i].phy_id1; i++) { 306# if defined(AU1XXX_PHY1_ADDR)
943 if (phy_id0 == mii_chip_table[i].phy_id0 && 307 phydev = au_macs[AU1XXX_PHY1_BUSID]->mii_bus.phy_map[AU1XXX_PHY1_ADDR];
944 phy_id1 == mii_chip_table[i].phy_id1) { 308# else
945 struct mii_phy * mii_phy = aup->mii; 309 printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n",
946 310 dev->name);
947 printk(KERN_INFO "%s: %s at phy address %d\n", 311 return 0;
948 dev->name, mii_chip_table[i].name, 312# endif /* defined(AU1XXX_PHY1_ADDR) */
949 phy_addr); 313 }
950#ifdef CONFIG_MIPS_BOSPORUS 314
951 phy_found = 1; 315#else /* defined(AU1XXX_PHY_STATIC_CONFIG) */
952#endif 316 int phy_addr;
953 mii_phy->chip_info = mii_chip_table+i; 317
954 aup->phy_addr = phy_addr; 318 /* find the first (lowest address) PHY on the current MAC's MII bus */
955 aup->want_autoneg = 1; 319 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)
956 aup->phy_ops = mii_chip_table[i].phy_ops; 320 if (aup->mii_bus.phy_map[phy_addr]) {
957 aup->phy_ops->phy_init(dev,phy_addr); 321 phydev = aup->mii_bus.phy_map[phy_addr];
958 322# if !defined(AU1XXX_PHY_SEARCH_HIGHEST_ADDR)
959 // Check for dual-phy and then store required 323 break; /* break out with first one found */
960 // values and set indicators. We need to do 324# endif
961 // this now since mdio_{read,write} need the
962 // control and data register addresses.
963 #ifdef CONFIG_BCM5222_DUAL_PHY
964 if ( mii_chip_table[i].dual_phy) {
965
966 /* assume both phys are controlled
967 * through MAC0. Board specific? */
968
969 /* sanity check */
970 if (!au_macs[0] || !au_macs[0]->mii)
971 return -1;
972 aup->mii->mii_control_reg = (u32 *)
973 &au_macs[0]->mac->mii_control;
974 aup->mii->mii_data_reg = (u32 *)
975 &au_macs[0]->mac->mii_data;
976 }
977 #endif
978 goto found;
979 }
980 } 325 }
981 }
982found:
983
984#ifdef CONFIG_MIPS_BOSPORUS
985 /* This is a workaround for the Micrel/Kendin 5 port switch
986 The second MAC doesn't see a PHY connected... so we need to
987 trick it into thinking we have one.
988
989 If this kernel is run on another Au1500 development board
990 the stub will be found as well as the actual PHY. However,
991 the last found PHY will be used... usually at Addr 31 (Db1500).
992 */
993 if ( (!phy_found) )
994 {
995 u16 phy_id0, phy_id1;
996 int i;
997 326
998 phy_id0 = 0x1234; 327# if defined(AU1XXX_PHY1_SEARCH_ON_MAC0)
999 phy_id1 = 0x5678; 328 /* try harder to find a PHY */
1000 329 if (!phydev && (aup->mac_id == 1)) {
1001 /* search our mii table for the current mii */ 330 /* no PHY found, maybe we have a dual PHY? */
1002 for (i = 0; mii_chip_table[i].phy_id1; i++) { 331 printk (KERN_INFO DRV_NAME ": no PHY found on MAC1, "
1003 if (phy_id0 == mii_chip_table[i].phy_id0 && 332 "let's see if it's attached to MAC0...\n");
1004 phy_id1 == mii_chip_table[i].phy_id1) { 333
1005 struct mii_phy * mii_phy; 334 BUG_ON(!au_macs[0]);
1006 335
1007 printk(KERN_INFO "%s: %s at phy address %d\n", 336 /* find the first (lowest address) non-attached PHY on
1008 dev->name, mii_chip_table[i].name, 337 * the MAC0 MII bus */
1009 phy_addr); 338 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
1010 mii_phy = kmalloc(sizeof(struct mii_phy), 339 struct phy_device *const tmp_phydev =
1011 GFP_KERNEL); 340 au_macs[0]->mii_bus.phy_map[phy_addr];
1012 if (mii_phy) { 341
1013 mii_phy->chip_info = mii_chip_table+i; 342 if (!tmp_phydev)
1014 aup->phy_addr = phy_addr; 343 continue; /* no PHY here... */
1015 mii_phy->next = aup->mii; 344
1016 aup->phy_ops = 345 if (tmp_phydev->attached_dev)
1017 mii_chip_table[i].phy_ops; 346 continue; /* already claimed by MAC0 */
1018 aup->mii = mii_phy; 347
1019 aup->phy_ops->phy_init(dev,phy_addr); 348 phydev = tmp_phydev;
1020 } else { 349 break; /* found it */
1021 printk(KERN_ERR "%s: out of memory\n",
1022 dev->name);
1023 return -1;
1024 }
1025 mii_phy->chip_info = mii_chip_table+i;
1026 aup->phy_addr = phy_addr;
1027 aup->phy_ops = mii_chip_table[i].phy_ops;
1028 aup->phy_ops->phy_init(dev,phy_addr);
1029 break;
1030 }
1031 } 350 }
1032 } 351 }
1033 if (aup->mac_id == 0) { 352# endif /* defined(AU1XXX_PHY1_SEARCH_OTHER_BUS) */
1034 /* the Bosporus phy responds to addresses 0-5 but
1035 * 5 is the correct one.
1036 */
1037 aup->phy_addr = 5;
1038 }
1039#endif
1040 353
1041 if (aup->mii->chip_info == NULL) { 354#endif /* defined(AU1XXX_PHY_STATIC_CONFIG) */
1042 printk(KERN_ERR "%s: Au1x No known MII transceivers found!\n", 355 if (!phydev) {
1043 dev->name); 356 printk (KERN_ERR DRV_NAME ":%s: no PHY found\n", dev->name);
1044 return -1; 357 return -1;
1045 } 358 }
1046 359
1047 printk(KERN_INFO "%s: Using %s as default\n", 360 /* now we are supposed to have a proper phydev, to attach to... */
1048 dev->name, aup->mii->chip_info->name); 361 BUG_ON(!phydev);
362 BUG_ON(phydev->attached_dev);
363
364 phydev = phy_connect(dev, phydev->dev.bus_id, &au1000_adjust_link, 0);
365
366 if (IS_ERR(phydev)) {
367 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
368 return PTR_ERR(phydev);
369 }
370
371 /* mask with MAC supported features */
372 phydev->supported &= (SUPPORTED_10baseT_Half
373 | SUPPORTED_10baseT_Full
374 | SUPPORTED_100baseT_Half
375 | SUPPORTED_100baseT_Full
376 | SUPPORTED_Autoneg
377 /* | SUPPORTED_Pause | SUPPORTED_Asym_Pause */
378 | SUPPORTED_MII
379 | SUPPORTED_TP);
380
381 phydev->advertising = phydev->supported;
382
383 aup->old_link = 0;
384 aup->old_speed = 0;
385 aup->old_duplex = -1;
386 aup->phy_dev = phydev;
387
388 printk(KERN_INFO "%s: attached PHY driver [%s] "
389 "(mii_bus:phy_addr=%s, irq=%d)\n",
390 dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
1049 391
1050 return 0; 392 return 0;
1051} 393}
@@ -1097,35 +439,38 @@ static void hard_stop(struct net_device *dev)
1097 au_sync_delay(10); 439 au_sync_delay(10);
1098} 440}
1099 441
1100 442static void enable_mac(struct net_device *dev, int force_reset)
1101static void reset_mac(struct net_device *dev)
1102{ 443{
1103 int i; 444 unsigned long flags;
1104 u32 flags;
1105 struct au1000_private *aup = (struct au1000_private *) dev->priv; 445 struct au1000_private *aup = (struct au1000_private *) dev->priv;
1106 446
1107 if (au1000_debug > 4)
1108 printk(KERN_INFO "%s: reset mac, aup %x\n",
1109 dev->name, (unsigned)aup);
1110
1111 spin_lock_irqsave(&aup->lock, flags); 447 spin_lock_irqsave(&aup->lock, flags);
1112 if (aup->timer.function == &au1000_timer) {/* check if timer initted */
1113 del_timer(&aup->timer);
1114 }
1115 448
1116 hard_stop(dev); 449 if(force_reset || (!aup->mac_enabled)) {
1117 #ifdef CONFIG_BCM5222_DUAL_PHY
1118 if (aup->mac_id != 0) {
1119 #endif
1120 /* If BCM5222, we can't leave MAC0 in reset because then
1121 * we can't access the dual phy for ETH1 */
1122 *aup->enable = MAC_EN_CLOCK_ENABLE; 450 *aup->enable = MAC_EN_CLOCK_ENABLE;
1123 au_sync_delay(2); 451 au_sync_delay(2);
1124 *aup->enable = 0; 452 *aup->enable = (MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2
453 | MAC_EN_CLOCK_ENABLE);
1125 au_sync_delay(2); 454 au_sync_delay(2);
1126 #ifdef CONFIG_BCM5222_DUAL_PHY 455
456 aup->mac_enabled = 1;
1127 } 457 }
1128 #endif 458
459 spin_unlock_irqrestore(&aup->lock, flags);
460}
461
462static void reset_mac_unlocked(struct net_device *dev)
463{
464 struct au1000_private *const aup = (struct au1000_private *) dev->priv;
465 int i;
466
467 hard_stop(dev);
468
469 *aup->enable = MAC_EN_CLOCK_ENABLE;
470 au_sync_delay(2);
471 *aup->enable = 0;
472 au_sync_delay(2);
473
1129 aup->tx_full = 0; 474 aup->tx_full = 0;
1130 for (i = 0; i < NUM_RX_DMA; i++) { 475 for (i = 0; i < NUM_RX_DMA; i++) {
1131 /* reset control bits */ 476 /* reset control bits */
@@ -1135,9 +480,26 @@ static void reset_mac(struct net_device *dev)
1135 /* reset control bits */ 480 /* reset control bits */
1136 aup->tx_dma_ring[i]->buff_stat &= ~0xf; 481 aup->tx_dma_ring[i]->buff_stat &= ~0xf;
1137 } 482 }
1138 spin_unlock_irqrestore(&aup->lock, flags); 483
484 aup->mac_enabled = 0;
485
1139} 486}
1140 487
488static void reset_mac(struct net_device *dev)
489{
490 struct au1000_private *const aup = (struct au1000_private *) dev->priv;
491 unsigned long flags;
492
493 if (au1000_debug > 4)
494 printk(KERN_INFO "%s: reset mac, aup %x\n",
495 dev->name, (unsigned)aup);
496
497 spin_lock_irqsave(&aup->lock, flags);
498
499 reset_mac_unlocked (dev);
500
501 spin_unlock_irqrestore(&aup->lock, flags);
502}
1141 503
1142/* 504/*
1143 * Setup the receive and transmit "rings". These pointers are the addresses 505 * Setup the receive and transmit "rings". These pointers are the addresses
@@ -1208,178 +570,31 @@ static int __init au1000_init_module(void)
1208 return 0; 570 return 0;
1209} 571}
1210 572
1211static int au1000_setup_aneg(struct net_device *dev, u32 advertise) 573/*
1212{ 574 * ethtool operations
1213 struct au1000_private *aup = (struct au1000_private *)dev->priv; 575 */
1214 u16 ctl, adv;
1215
1216 /* Setup standard advertise */
1217 adv = mdio_read(dev, aup->phy_addr, MII_ADVERTISE);
1218 adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
1219 if (advertise & ADVERTISED_10baseT_Half)
1220 adv |= ADVERTISE_10HALF;
1221 if (advertise & ADVERTISED_10baseT_Full)
1222 adv |= ADVERTISE_10FULL;
1223 if (advertise & ADVERTISED_100baseT_Half)
1224 adv |= ADVERTISE_100HALF;
1225 if (advertise & ADVERTISED_100baseT_Full)
1226 adv |= ADVERTISE_100FULL;
1227 mdio_write(dev, aup->phy_addr, MII_ADVERTISE, adv);
1228
1229 /* Start/Restart aneg */
1230 ctl = mdio_read(dev, aup->phy_addr, MII_BMCR);
1231 ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
1232 mdio_write(dev, aup->phy_addr, MII_BMCR, ctl);
1233
1234 return 0;
1235}
1236 576
1237static int au1000_setup_forced(struct net_device *dev, int speed, int fd) 577static int au1000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1238{ 578{
1239 struct au1000_private *aup = (struct au1000_private *)dev->priv; 579 struct au1000_private *aup = (struct au1000_private *)dev->priv;
1240 u16 ctl;
1241
1242 ctl = mdio_read(dev, aup->phy_addr, MII_BMCR);
1243 ctl &= ~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_ANENABLE);
1244
1245 /* First reset the PHY */
1246 mdio_write(dev, aup->phy_addr, MII_BMCR, ctl | BMCR_RESET);
1247
1248 /* Select speed & duplex */
1249 switch (speed) {
1250 case SPEED_10:
1251 break;
1252 case SPEED_100:
1253 ctl |= BMCR_SPEED100;
1254 break;
1255 case SPEED_1000:
1256 default:
1257 return -EINVAL;
1258 }
1259 if (fd == DUPLEX_FULL)
1260 ctl |= BMCR_FULLDPLX;
1261 mdio_write(dev, aup->phy_addr, MII_BMCR, ctl);
1262
1263 return 0;
1264}
1265
1266 580
1267static void 581 if (aup->phy_dev)
1268au1000_start_link(struct net_device *dev, struct ethtool_cmd *cmd) 582 return phy_ethtool_gset(aup->phy_dev, cmd);
1269{
1270 struct au1000_private *aup = (struct au1000_private *)dev->priv;
1271 u32 advertise;
1272 int autoneg;
1273 int forced_speed;
1274 int forced_duplex;
1275
1276 /* Default advertise */
1277 advertise = GENMII_DEFAULT_ADVERTISE;
1278 autoneg = aup->want_autoneg;
1279 forced_speed = SPEED_100;
1280 forced_duplex = DUPLEX_FULL;
1281
1282 /* Setup link parameters */
1283 if (cmd) {
1284 if (cmd->autoneg == AUTONEG_ENABLE) {
1285 advertise = cmd->advertising;
1286 autoneg = 1;
1287 } else {
1288 autoneg = 0;
1289
1290 forced_speed = cmd->speed;
1291 forced_duplex = cmd->duplex;
1292 }
1293 }
1294 583
1295 /* Configure PHY & start aneg */ 584 return -EINVAL;
1296 aup->want_autoneg = autoneg;
1297 if (autoneg)
1298 au1000_setup_aneg(dev, advertise);
1299 else
1300 au1000_setup_forced(dev, forced_speed, forced_duplex);
1301 mod_timer(&aup->timer, jiffies + HZ);
1302} 585}
1303 586
1304static int au1000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 587static int au1000_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1305{ 588{
1306 struct au1000_private *aup = (struct au1000_private *)dev->priv; 589 struct au1000_private *aup = (struct au1000_private *)dev->priv;
1307 u16 link, speed;
1308
1309 cmd->supported = GENMII_DEFAULT_FEATURES;
1310 cmd->advertising = GENMII_DEFAULT_ADVERTISE;
1311 cmd->port = PORT_MII;
1312 cmd->transceiver = XCVR_EXTERNAL;
1313 cmd->phy_address = aup->phy_addr;
1314 spin_lock_irq(&aup->lock);
1315 cmd->autoneg = aup->want_autoneg;
1316 aup->phy_ops->phy_status(dev, aup->phy_addr, &link, &speed);
1317 if ((speed == IF_PORT_100BASETX) || (speed == IF_PORT_100BASEFX))
1318 cmd->speed = SPEED_100;
1319 else if (speed == IF_PORT_10BASET)
1320 cmd->speed = SPEED_10;
1321 if (link && (dev->if_port == IF_PORT_100BASEFX))
1322 cmd->duplex = DUPLEX_FULL;
1323 else
1324 cmd->duplex = DUPLEX_HALF;
1325 spin_unlock_irq(&aup->lock);
1326 return 0;
1327}
1328 590
1329static int au1000_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 591 if (!capable(CAP_NET_ADMIN))
1330{ 592 return -EPERM;
1331 struct au1000_private *aup = (struct au1000_private *)dev->priv;
1332 unsigned long features = GENMII_DEFAULT_FEATURES;
1333
1334 if (!capable(CAP_NET_ADMIN))
1335 return -EPERM;
1336
1337 if (cmd->autoneg != AUTONEG_ENABLE && cmd->autoneg != AUTONEG_DISABLE)
1338 return -EINVAL;
1339 if (cmd->autoneg == AUTONEG_ENABLE && cmd->advertising == 0)
1340 return -EINVAL;
1341 if (cmd->duplex != DUPLEX_HALF && cmd->duplex != DUPLEX_FULL)
1342 return -EINVAL;
1343 if (cmd->autoneg == AUTONEG_DISABLE)
1344 switch (cmd->speed) {
1345 case SPEED_10:
1346 if (cmd->duplex == DUPLEX_HALF &&
1347 (features & SUPPORTED_10baseT_Half) == 0)
1348 return -EINVAL;
1349 if (cmd->duplex == DUPLEX_FULL &&
1350 (features & SUPPORTED_10baseT_Full) == 0)
1351 return -EINVAL;
1352 break;
1353 case SPEED_100:
1354 if (cmd->duplex == DUPLEX_HALF &&
1355 (features & SUPPORTED_100baseT_Half) == 0)
1356 return -EINVAL;
1357 if (cmd->duplex == DUPLEX_FULL &&
1358 (features & SUPPORTED_100baseT_Full) == 0)
1359 return -EINVAL;
1360 break;
1361 default:
1362 return -EINVAL;
1363 }
1364 else if ((features & SUPPORTED_Autoneg) == 0)
1365 return -EINVAL;
1366
1367 spin_lock_irq(&aup->lock);
1368 au1000_start_link(dev, cmd);
1369 spin_unlock_irq(&aup->lock);
1370 return 0;
1371}
1372 593
1373static int au1000_nway_reset(struct net_device *dev) 594 if (aup->phy_dev)
1374{ 595 return phy_ethtool_sset(aup->phy_dev, cmd);
1375 struct au1000_private *aup = (struct au1000_private *)dev->priv;
1376 596
1377 if (!aup->want_autoneg) 597 return -EINVAL;
1378 return -EINVAL;
1379 spin_lock_irq(&aup->lock);
1380 au1000_start_link(dev, NULL);
1381 spin_unlock_irq(&aup->lock);
1382 return 0;
1383} 598}
1384 599
1385static void 600static void
@@ -1394,17 +609,11 @@ au1000_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1394 info->regdump_len = 0; 609 info->regdump_len = 0;
1395} 610}
1396 611
1397static u32 au1000_get_link(struct net_device *dev)
1398{
1399 return netif_carrier_ok(dev);
1400}
1401
1402static struct ethtool_ops au1000_ethtool_ops = { 612static struct ethtool_ops au1000_ethtool_ops = {
1403 .get_settings = au1000_get_settings, 613 .get_settings = au1000_get_settings,
1404 .set_settings = au1000_set_settings, 614 .set_settings = au1000_set_settings,
1405 .get_drvinfo = au1000_get_drvinfo, 615 .get_drvinfo = au1000_get_drvinfo,
1406 .nway_reset = au1000_nway_reset, 616 .get_link = ethtool_op_get_link,
1407 .get_link = au1000_get_link
1408}; 617};
1409 618
1410static struct net_device * au1000_probe(int port_num) 619static struct net_device * au1000_probe(int port_num)
@@ -1499,23 +708,31 @@ static struct net_device * au1000_probe(int port_num)
1499 memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr)); 708 memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
1500 dev->dev_addr[5] += port_num; 709 dev->dev_addr[5] += port_num;
1501 710
1502 /* Bring the device out of reset, otherwise probing the MII will hang */ 711 *aup->enable = 0;
1503 *aup->enable = MAC_EN_CLOCK_ENABLE; 712 aup->mac_enabled = 0;
1504 au_sync_delay(2); 713
1505 *aup->enable = MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2 | 714 aup->mii_bus.priv = dev;
1506 MAC_EN_CLOCK_ENABLE; 715 aup->mii_bus.read = mdiobus_read;
1507 au_sync_delay(2); 716 aup->mii_bus.write = mdiobus_write;
1508 717 aup->mii_bus.reset = mdiobus_reset;
1509 aup->mii = kmalloc(sizeof(struct mii_phy), GFP_KERNEL); 718 aup->mii_bus.name = "au1000_eth_mii";
1510 if (!aup->mii) { 719 aup->mii_bus.id = aup->mac_id;
1511 printk(KERN_ERR "%s: out of memory\n", dev->name); 720 aup->mii_bus.irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
1512 goto err_out; 721 for(i = 0; i < PHY_MAX_ADDR; ++i)
1513 } 722 aup->mii_bus.irq[i] = PHY_POLL;
1514 aup->mii->next = NULL; 723
1515 aup->mii->chip_info = NULL; 724 /* if known, set corresponding PHY IRQs */
1516 aup->mii->status = 0; 725#if defined(AU1XXX_PHY_STATIC_CONFIG)
1517 aup->mii->mii_control_reg = 0; 726# if defined(AU1XXX_PHY0_IRQ)
1518 aup->mii->mii_data_reg = 0; 727 if (AU1XXX_PHY0_BUSID == aup->mii_bus.id)
728 aup->mii_bus.irq[AU1XXX_PHY0_ADDR] = AU1XXX_PHY0_IRQ;
729# endif
730# if defined(AU1XXX_PHY1_IRQ)
731 if (AU1XXX_PHY1_BUSID == aup->mii_bus.id)
732 aup->mii_bus.irq[AU1XXX_PHY1_ADDR] = AU1XXX_PHY1_IRQ;
733# endif
734#endif
735 mdiobus_register(&aup->mii_bus);
1519 736
1520 if (mii_probe(dev) != 0) { 737 if (mii_probe(dev) != 0) {
1521 goto err_out; 738 goto err_out;
@@ -1561,7 +778,6 @@ static struct net_device * au1000_probe(int port_num)
1561 dev->set_multicast_list = &set_rx_mode; 778 dev->set_multicast_list = &set_rx_mode;
1562 dev->do_ioctl = &au1000_ioctl; 779 dev->do_ioctl = &au1000_ioctl;
1563 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops); 780 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
1564 dev->set_config = &au1000_set_config;
1565 dev->tx_timeout = au1000_tx_timeout; 781 dev->tx_timeout = au1000_tx_timeout;
1566 dev->watchdog_timeo = ETH_TX_TIMEOUT; 782 dev->watchdog_timeo = ETH_TX_TIMEOUT;
1567 783
@@ -1577,7 +793,7 @@ err_out:
1577 /* here we should have a valid dev plus aup-> register addresses 793 /* here we should have a valid dev plus aup-> register addresses
1578 * so we can reset the mac properly.*/ 794 * so we can reset the mac properly.*/
1579 reset_mac(dev); 795 reset_mac(dev);
1580 kfree(aup->mii); 796
1581 for (i = 0; i < NUM_RX_DMA; i++) { 797 for (i = 0; i < NUM_RX_DMA; i++) {
1582 if (aup->rx_db_inuse[i]) 798 if (aup->rx_db_inuse[i])
1583 ReleaseDB(aup, aup->rx_db_inuse[i]); 799 ReleaseDB(aup, aup->rx_db_inuse[i]);
@@ -1610,19 +826,14 @@ static int au1000_init(struct net_device *dev)
1610 u32 flags; 826 u32 flags;
1611 int i; 827 int i;
1612 u32 control; 828 u32 control;
1613 u16 link, speed;
1614 829
1615 if (au1000_debug > 4) 830 if (au1000_debug > 4)
1616 printk("%s: au1000_init\n", dev->name); 831 printk("%s: au1000_init\n", dev->name);
1617 832
1618 spin_lock_irqsave(&aup->lock, flags);
1619
1620 /* bring the device out of reset */ 833 /* bring the device out of reset */
1621 *aup->enable = MAC_EN_CLOCK_ENABLE; 834 enable_mac(dev, 1);
1622 au_sync_delay(2); 835
1623 *aup->enable = MAC_EN_RESET0 | MAC_EN_RESET1 | 836 spin_lock_irqsave(&aup->lock, flags);
1624 MAC_EN_RESET2 | MAC_EN_CLOCK_ENABLE;
1625 au_sync_delay(20);
1626 837
1627 aup->mac->control = 0; 838 aup->mac->control = 0;
1628 aup->tx_head = (aup->tx_dma_ring[0]->buff_stat & 0xC) >> 2; 839 aup->tx_head = (aup->tx_dma_ring[0]->buff_stat & 0xC) >> 2;
@@ -1638,12 +849,16 @@ static int au1000_init(struct net_device *dev)
1638 } 849 }
1639 au_sync(); 850 au_sync();
1640 851
1641 aup->phy_ops->phy_status(dev, aup->phy_addr, &link, &speed); 852 control = MAC_RX_ENABLE | MAC_TX_ENABLE;
1642 control = MAC_DISABLE_RX_OWN | MAC_RX_ENABLE | MAC_TX_ENABLE;
1643#ifndef CONFIG_CPU_LITTLE_ENDIAN 853#ifndef CONFIG_CPU_LITTLE_ENDIAN
1644 control |= MAC_BIG_ENDIAN; 854 control |= MAC_BIG_ENDIAN;
1645#endif 855#endif
1646 if (link && (dev->if_port == IF_PORT_100BASEFX)) { 856 if (aup->phy_dev) {
857 if (aup->phy_dev->link && (DUPLEX_FULL == aup->phy_dev->duplex))
858 control |= MAC_FULL_DUPLEX;
859 else
860 control |= MAC_DISABLE_RX_OWN;
861 } else { /* PHY-less op, assume full-duplex */
1647 control |= MAC_FULL_DUPLEX; 862 control |= MAC_FULL_DUPLEX;
1648 } 863 }
1649 864
@@ -1655,57 +870,84 @@ static int au1000_init(struct net_device *dev)
1655 return 0; 870 return 0;
1656} 871}
1657 872
1658static void au1000_timer(unsigned long data) 873static void
874au1000_adjust_link(struct net_device *dev)
1659{ 875{
1660 struct net_device *dev = (struct net_device *)data;
1661 struct au1000_private *aup = (struct au1000_private *) dev->priv; 876 struct au1000_private *aup = (struct au1000_private *) dev->priv;
1662 unsigned char if_port; 877 struct phy_device *phydev = aup->phy_dev;
1663 u16 link, speed; 878 unsigned long flags;
1664 879
1665 if (!dev) { 880 int status_change = 0;
1666 /* fatal error, don't restart the timer */
1667 printk(KERN_ERR "au1000_timer error: NULL dev\n");
1668 return;
1669 }
1670 881
1671 if_port = dev->if_port; 882 BUG_ON(!aup->phy_dev);
1672 if (aup->phy_ops->phy_status(dev, aup->phy_addr, &link, &speed) == 0) { 883
1673 if (link) { 884 spin_lock_irqsave(&aup->lock, flags);
1674 if (!netif_carrier_ok(dev)) { 885
1675 netif_carrier_on(dev); 886 if (phydev->link && (aup->old_speed != phydev->speed)) {
1676 printk(KERN_INFO "%s: link up\n", dev->name); 887 // speed changed
1677 } 888
1678 } 889 switch(phydev->speed) {
1679 else { 890 case SPEED_10:
1680 if (netif_carrier_ok(dev)) { 891 case SPEED_100:
1681 netif_carrier_off(dev); 892 break;
1682 dev->if_port = 0; 893 default:
1683 printk(KERN_INFO "%s: link down\n", dev->name); 894 printk(KERN_WARNING
1684 } 895 "%s: Speed (%d) is not 10/100 ???\n",
896 dev->name, phydev->speed);
897 break;
1685 } 898 }
899
900 aup->old_speed = phydev->speed;
901
902 status_change = 1;
1686 } 903 }
1687 904
1688 if (link && (dev->if_port != if_port) && 905 if (phydev->link && (aup->old_duplex != phydev->duplex)) {
1689 (dev->if_port != IF_PORT_UNKNOWN)) { 906 // duplex mode changed
907
908 /* switching duplex mode requires to disable rx and tx! */
1690 hard_stop(dev); 909 hard_stop(dev);
1691 if (dev->if_port == IF_PORT_100BASEFX) { 910
1692 printk(KERN_INFO "%s: going to full duplex\n", 911 if (DUPLEX_FULL == phydev->duplex)
1693 dev->name); 912 aup->mac->control = ((aup->mac->control
1694 aup->mac->control |= MAC_FULL_DUPLEX; 913 | MAC_FULL_DUPLEX)
1695 au_sync_delay(1); 914 & ~MAC_DISABLE_RX_OWN);
1696 } 915 else
1697 else { 916 aup->mac->control = ((aup->mac->control
1698 aup->mac->control &= ~MAC_FULL_DUPLEX; 917 & ~MAC_FULL_DUPLEX)
1699 au_sync_delay(1); 918 | MAC_DISABLE_RX_OWN);
1700 } 919 au_sync_delay(1);
920
1701 enable_rx_tx(dev); 921 enable_rx_tx(dev);
922 aup->old_duplex = phydev->duplex;
923
924 status_change = 1;
925 }
926
927 if(phydev->link != aup->old_link) {
928 // link state changed
929
930 if (phydev->link) // link went up
931 netif_schedule(dev);
932 else { // link went down
933 aup->old_speed = 0;
934 aup->old_duplex = -1;
935 }
936
937 aup->old_link = phydev->link;
938 status_change = 1;
1702 } 939 }
1703 940
1704 aup->timer.expires = RUN_AT((1*HZ)); 941 spin_unlock_irqrestore(&aup->lock, flags);
1705 aup->timer.data = (unsigned long)dev;
1706 aup->timer.function = &au1000_timer; /* timer handler */
1707 add_timer(&aup->timer);
1708 942
943 if (status_change) {
944 if (phydev->link)
945 printk(KERN_INFO "%s: link up (%d/%s)\n",
946 dev->name, phydev->speed,
947 DUPLEX_FULL == phydev->duplex ? "Full" : "Half");
948 else
949 printk(KERN_INFO "%s: link down\n", dev->name);
950 }
1709} 951}
1710 952
1711static int au1000_open(struct net_device *dev) 953static int au1000_open(struct net_device *dev)
@@ -1716,25 +958,26 @@ static int au1000_open(struct net_device *dev)
1716 if (au1000_debug > 4) 958 if (au1000_debug > 4)
1717 printk("%s: open: dev=%p\n", dev->name, dev); 959 printk("%s: open: dev=%p\n", dev->name, dev);
1718 960
961 if ((retval = request_irq(dev->irq, &au1000_interrupt, 0,
962 dev->name, dev))) {
963 printk(KERN_ERR "%s: unable to get IRQ %d\n",
964 dev->name, dev->irq);
965 return retval;
966 }
967
1719 if ((retval = au1000_init(dev))) { 968 if ((retval = au1000_init(dev))) {
1720 printk(KERN_ERR "%s: error in au1000_init\n", dev->name); 969 printk(KERN_ERR "%s: error in au1000_init\n", dev->name);
1721 free_irq(dev->irq, dev); 970 free_irq(dev->irq, dev);
1722 return retval; 971 return retval;
1723 } 972 }
1724 netif_start_queue(dev);
1725 973
1726 if ((retval = request_irq(dev->irq, &au1000_interrupt, 0, 974 if (aup->phy_dev) {
1727 dev->name, dev))) { 975 /* cause the PHY state machine to schedule a link state check */
1728 printk(KERN_ERR "%s: unable to get IRQ %d\n", 976 aup->phy_dev->state = PHY_CHANGELINK;
1729 dev->name, dev->irq); 977 phy_start(aup->phy_dev);
1730 return retval;
1731 } 978 }
1732 979
1733 init_timer(&aup->timer); /* used in ioctl() */ 980 netif_start_queue(dev);
1734 aup->timer.expires = RUN_AT((3*HZ));
1735 aup->timer.data = (unsigned long)dev;
1736 aup->timer.function = &au1000_timer; /* timer handler */
1737 add_timer(&aup->timer);
1738 981
1739 if (au1000_debug > 4) 982 if (au1000_debug > 4)
1740 printk("%s: open: Initialization done.\n", dev->name); 983 printk("%s: open: Initialization done.\n", dev->name);
@@ -1744,16 +987,19 @@ static int au1000_open(struct net_device *dev)
1744 987
1745static int au1000_close(struct net_device *dev) 988static int au1000_close(struct net_device *dev)
1746{ 989{
1747 u32 flags; 990 unsigned long flags;
1748 struct au1000_private *aup = (struct au1000_private *) dev->priv; 991 struct au1000_private *const aup = (struct au1000_private *) dev->priv;
1749 992
1750 if (au1000_debug > 4) 993 if (au1000_debug > 4)
1751 printk("%s: close: dev=%p\n", dev->name, dev); 994 printk("%s: close: dev=%p\n", dev->name, dev);
1752 995
1753 reset_mac(dev); 996 if (aup->phy_dev)
997 phy_stop(aup->phy_dev);
1754 998
1755 spin_lock_irqsave(&aup->lock, flags); 999 spin_lock_irqsave(&aup->lock, flags);
1756 1000
1001 reset_mac_unlocked (dev);
1002
1757 /* stop the device */ 1003 /* stop the device */
1758 netif_stop_queue(dev); 1004 netif_stop_queue(dev);
1759 1005
@@ -1775,7 +1021,6 @@ static void __exit au1000_cleanup_module(void)
1775 if (dev) { 1021 if (dev) {
1776 aup = (struct au1000_private *) dev->priv; 1022 aup = (struct au1000_private *) dev->priv;
1777 unregister_netdev(dev); 1023 unregister_netdev(dev);
1778 kfree(aup->mii);
1779 for (j = 0; j < NUM_RX_DMA; j++) 1024 for (j = 0; j < NUM_RX_DMA; j++)
1780 if (aup->rx_db_inuse[j]) 1025 if (aup->rx_db_inuse[j])
1781 ReleaseDB(aup, aup->rx_db_inuse[j]); 1026 ReleaseDB(aup, aup->rx_db_inuse[j]);
@@ -1798,7 +1043,7 @@ static void update_tx_stats(struct net_device *dev, u32 status)
1798 struct net_device_stats *ps = &aup->stats; 1043 struct net_device_stats *ps = &aup->stats;
1799 1044
1800 if (status & TX_FRAME_ABORTED) { 1045 if (status & TX_FRAME_ABORTED) {
1801 if (dev->if_port == IF_PORT_100BASEFX) { 1046 if (!aup->phy_dev || (DUPLEX_FULL == aup->phy_dev->duplex)) {
1802 if (status & (TX_JAB_TIMEOUT | TX_UNDERRUN)) { 1047 if (status & (TX_JAB_TIMEOUT | TX_UNDERRUN)) {
1803 /* any other tx errors are only valid 1048 /* any other tx errors are only valid
1804 * in half duplex mode */ 1049 * in half duplex mode */
@@ -2072,126 +1317,15 @@ static void set_rx_mode(struct net_device *dev)
2072 } 1317 }
2073} 1318}
2074 1319
2075
2076static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1320static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2077{ 1321{
2078 struct au1000_private *aup = (struct au1000_private *)dev->priv; 1322 struct au1000_private *aup = (struct au1000_private *)dev->priv;
2079 u16 *data = (u16 *)&rq->ifr_ifru;
2080
2081 switch(cmd) {
2082 case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
2083 case SIOCGMIIPHY:
2084 if (!netif_running(dev)) return -EINVAL;
2085 data[0] = aup->phy_addr;
2086 case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
2087 case SIOCGMIIREG:
2088 data[3] = mdio_read(dev, data[0], data[1]);
2089 return 0;
2090 case SIOCDEVPRIVATE+2: /* Write the specified MII register */
2091 case SIOCSMIIREG:
2092 if (!capable(CAP_NET_ADMIN))
2093 return -EPERM;
2094 mdio_write(dev, data[0], data[1],data[2]);
2095 return 0;
2096 default:
2097 return -EOPNOTSUPP;
2098 }
2099
2100}
2101
2102
2103static int au1000_set_config(struct net_device *dev, struct ifmap *map)
2104{
2105 struct au1000_private *aup = (struct au1000_private *) dev->priv;
2106 u16 control;
2107 1323
2108 if (au1000_debug > 4) { 1324 if (!netif_running(dev)) return -EINVAL;
2109 printk("%s: set_config called: dev->if_port %d map->port %x\n",
2110 dev->name, dev->if_port, map->port);
2111 }
2112 1325
2113 switch(map->port){ 1326 if (!aup->phy_dev) return -EINVAL; // PHY not controllable
2114 case IF_PORT_UNKNOWN: /* use auto here */
2115 printk(KERN_INFO "%s: config phy for aneg\n",
2116 dev->name);
2117 dev->if_port = map->port;
2118 /* Link Down: the timer will bring it up */
2119 netif_carrier_off(dev);
2120
2121 /* read current control */
2122 control = mdio_read(dev, aup->phy_addr, MII_CONTROL);
2123 control &= ~(MII_CNTL_FDX | MII_CNTL_F100);
2124
2125 /* enable auto negotiation and reset the negotiation */
2126 mdio_write(dev, aup->phy_addr, MII_CONTROL,
2127 control | MII_CNTL_AUTO |
2128 MII_CNTL_RST_AUTO);
2129 1327
2130 break; 1328 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
2131
2132 case IF_PORT_10BASET: /* 10BaseT */
2133 printk(KERN_INFO "%s: config phy for 10BaseT\n",
2134 dev->name);
2135 dev->if_port = map->port;
2136
2137 /* Link Down: the timer will bring it up */
2138 netif_carrier_off(dev);
2139
2140 /* set Speed to 10Mbps, Half Duplex */
2141 control = mdio_read(dev, aup->phy_addr, MII_CONTROL);
2142 control &= ~(MII_CNTL_F100 | MII_CNTL_AUTO |
2143 MII_CNTL_FDX);
2144
2145 /* disable auto negotiation and force 10M/HD mode*/
2146 mdio_write(dev, aup->phy_addr, MII_CONTROL, control);
2147 break;
2148
2149 case IF_PORT_100BASET: /* 100BaseT */
2150 case IF_PORT_100BASETX: /* 100BaseTx */
2151 printk(KERN_INFO "%s: config phy for 100BaseTX\n",
2152 dev->name);
2153 dev->if_port = map->port;
2154
2155 /* Link Down: the timer will bring it up */
2156 netif_carrier_off(dev);
2157
2158 /* set Speed to 100Mbps, Half Duplex */
2159 /* disable auto negotiation and enable 100MBit Mode */
2160 control = mdio_read(dev, aup->phy_addr, MII_CONTROL);
2161 control &= ~(MII_CNTL_AUTO | MII_CNTL_FDX);
2162 control |= MII_CNTL_F100;
2163 mdio_write(dev, aup->phy_addr, MII_CONTROL, control);
2164 break;
2165
2166 case IF_PORT_100BASEFX: /* 100BaseFx */
2167 printk(KERN_INFO "%s: config phy for 100BaseFX\n",
2168 dev->name);
2169 dev->if_port = map->port;
2170
2171 /* Link Down: the timer will bring it up */
2172 netif_carrier_off(dev);
2173
2174 /* set Speed to 100Mbps, Full Duplex */
2175 /* disable auto negotiation and enable 100MBit Mode */
2176 control = mdio_read(dev, aup->phy_addr, MII_CONTROL);
2177 control &= ~MII_CNTL_AUTO;
2178 control |= MII_CNTL_F100 | MII_CNTL_FDX;
2179 mdio_write(dev, aup->phy_addr, MII_CONTROL, control);
2180 break;
2181 case IF_PORT_10BASE2: /* 10Base2 */
2182 case IF_PORT_AUI: /* AUI */
2183 /* These Modes are not supported (are they?)*/
2184 printk(KERN_ERR "%s: 10Base2/AUI not supported",
2185 dev->name);
2186 return -EOPNOTSUPP;
2187 break;
2188
2189 default:
2190 printk(KERN_ERR "%s: Invalid media selected",
2191 dev->name);
2192 return -EINVAL;
2193 }
2194 return 0;
2195} 1329}
2196 1330
2197static struct net_device_stats *au1000_get_stats(struct net_device *dev) 1331static struct net_device_stats *au1000_get_stats(struct net_device *dev)
diff --git a/drivers/net/au1000_eth.h b/drivers/net/au1000_eth.h
index 7f9326e39cc0..41c2f848d2c4 100644
--- a/drivers/net/au1000_eth.h
+++ b/drivers/net/au1000_eth.h
@@ -40,120 +40,6 @@
40 40
41#define MULTICAST_FILTER_LIMIT 64 41#define MULTICAST_FILTER_LIMIT 64
42 42
43/* FIXME
44 * The PHY defines should be in a separate file.
45 */
46
47/* MII register offsets */
48#define MII_CONTROL 0x0000
49#define MII_STATUS 0x0001
50#define MII_PHY_ID0 0x0002
51#define MII_PHY_ID1 0x0003
52#define MII_ANADV 0x0004
53#define MII_ANLPAR 0x0005
54#define MII_AEXP 0x0006
55#define MII_ANEXT 0x0007
56#define MII_LSI_PHY_CONFIG 0x0011
57/* Status register */
58#define MII_LSI_PHY_STAT 0x0012
59#define MII_AMD_PHY_STAT MII_LSI_PHY_STAT
60#define MII_INTEL_PHY_STAT 0x0011
61
62#define MII_AUX_CNTRL 0x0018
63/* mii registers specific to AMD 79C901 */
64#define MII_STATUS_SUMMARY = 0x0018
65
66/* MII Control register bit definitions. */
67#define MII_CNTL_FDX 0x0100
68#define MII_CNTL_RST_AUTO 0x0200
69#define MII_CNTL_ISOLATE 0x0400
70#define MII_CNTL_PWRDWN 0x0800
71#define MII_CNTL_AUTO 0x1000
72#define MII_CNTL_F100 0x2000
73#define MII_CNTL_LPBK 0x4000
74#define MII_CNTL_RESET 0x8000
75
76/* MII Status register bit */
77#define MII_STAT_EXT 0x0001
78#define MII_STAT_JAB 0x0002
79#define MII_STAT_LINK 0x0004
80#define MII_STAT_CAN_AUTO 0x0008
81#define MII_STAT_FAULT 0x0010
82#define MII_STAT_AUTO_DONE 0x0020
83#define MII_STAT_CAN_T 0x0800
84#define MII_STAT_CAN_T_FDX 0x1000
85#define MII_STAT_CAN_TX 0x2000
86#define MII_STAT_CAN_TX_FDX 0x4000
87#define MII_STAT_CAN_T4 0x8000
88
89
90#define MII_ID1_OUI_LO 0xFC00 /* low bits of OUI mask */
91#define MII_ID1_MODEL 0x03F0 /* model number */
92#define MII_ID1_REV 0x000F /* model number */
93
94/* MII NWAY Register Bits ...
95 valid for the ANAR (Auto-Negotiation Advertisement) and
96 ANLPAR (Auto-Negotiation Link Partner) registers */
97#define MII_NWAY_NODE_SEL 0x001f
98#define MII_NWAY_CSMA_CD 0x0001
99#define MII_NWAY_T 0x0020
100#define MII_NWAY_T_FDX 0x0040
101#define MII_NWAY_TX 0x0080
102#define MII_NWAY_TX_FDX 0x0100
103#define MII_NWAY_T4 0x0200
104#define MII_NWAY_PAUSE 0x0400
105#define MII_NWAY_RF 0x2000 /* Remote Fault */
106#define MII_NWAY_ACK 0x4000 /* Remote Acknowledge */
107#define MII_NWAY_NP 0x8000 /* Next Page (Enable) */
108
109/* mii stsout register bits */
110#define MII_STSOUT_LINK_FAIL 0x4000
111#define MII_STSOUT_SPD 0x0080
112#define MII_STSOUT_DPLX 0x0040
113
114/* mii stsics register bits */
115#define MII_STSICS_SPD 0x8000
116#define MII_STSICS_DPLX 0x4000
117#define MII_STSICS_LINKSTS 0x0001
118
119/* mii stssum register bits */
120#define MII_STSSUM_LINK 0x0008
121#define MII_STSSUM_DPLX 0x0004
122#define MII_STSSUM_AUTO 0x0002
123#define MII_STSSUM_SPD 0x0001
124
125/* lsi phy status register */
126#define MII_LSI_PHY_STAT_FDX 0x0040
127#define MII_LSI_PHY_STAT_SPD 0x0080
128
129/* amd phy status register */
130#define MII_AMD_PHY_STAT_FDX 0x0800
131#define MII_AMD_PHY_STAT_SPD 0x0400
132
133/* intel phy status register */
134#define MII_INTEL_PHY_STAT_FDX 0x0200
135#define MII_INTEL_PHY_STAT_SPD 0x4000
136
137/* Auxilliary Control/Status Register */
138#define MII_AUX_FDX 0x0001
139#define MII_AUX_100 0x0002
140#define MII_AUX_F100 0x0004
141#define MII_AUX_ANEG 0x0008
142
143typedef struct mii_phy {
144 struct mii_phy * next;
145 struct mii_chip_info * chip_info;
146 u16 status;
147 u32 *mii_control_reg;
148 u32 *mii_data_reg;
149} mii_phy_t;
150
151struct phy_ops {
152 int (*phy_init) (struct net_device *, int);
153 int (*phy_reset) (struct net_device *, int);
154 int (*phy_status) (struct net_device *, int, u16 *, u16 *);
155};
156
157/* 43/*
158 * Data Buffer Descriptor. Data buffers must be aligned on 32 byte 44 * Data Buffer Descriptor. Data buffers must be aligned on 32 byte
159 * boundary for both, receive and transmit. 45 * boundary for both, receive and transmit.
@@ -200,7 +86,6 @@ typedef struct mac_reg {
200 86
201 87
202struct au1000_private { 88struct au1000_private {
203
204 db_dest_t *pDBfree; 89 db_dest_t *pDBfree;
205 db_dest_t db[NUM_RX_BUFFS+NUM_TX_BUFFS]; 90 db_dest_t db[NUM_RX_BUFFS+NUM_TX_BUFFS];
206 volatile rx_dma_t *rx_dma_ring[NUM_RX_DMA]; 91 volatile rx_dma_t *rx_dma_ring[NUM_RX_DMA];
@@ -213,8 +98,15 @@ struct au1000_private {
213 u32 tx_full; 98 u32 tx_full;
214 99
215 int mac_id; 100 int mac_id;
216 mii_phy_t *mii; 101
217 struct phy_ops *phy_ops; 102 int mac_enabled; /* whether MAC is currently enabled and running (req. for mdio) */
103
104 int old_link; /* used by au1000_adjust_link */
105 int old_speed;
106 int old_duplex;
107
108 struct phy_device *phy_dev;
109 struct mii_bus mii_bus;
218 110
219 /* These variables are just for quick access to certain regs addresses. */ 111 /* These variables are just for quick access to certain regs addresses. */
220 volatile mac_reg_t *mac; /* mac registers */ 112 volatile mac_reg_t *mac; /* mac registers */
@@ -223,14 +115,6 @@ struct au1000_private {
223 u32 vaddr; /* virtual address of rx/tx buffers */ 115 u32 vaddr; /* virtual address of rx/tx buffers */
224 dma_addr_t dma_addr; /* dma address of rx/tx buffers */ 116 dma_addr_t dma_addr; /* dma address of rx/tx buffers */
225 117
226 u8 *hash_table;
227 u32 hash_mode;
228 u32 intr_work_done; /* number of Rx and Tx pkts processed in the isr */
229 int phy_addr; /* phy address */
230 u32 options; /* User-settable misc. driver options. */
231 u32 drv_flags;
232 int want_autoneg;
233 struct net_device_stats stats; 118 struct net_device_stats stats;
234 struct timer_list timer;
235 spinlock_t lock; /* Serialise access to device */ 119 spinlock_t lock; /* Serialise access to device */
236}; 120};
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 54161aef3cac..702d546567ad 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -32,6 +32,7 @@
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <asm/byteorder.h> 34#include <asm/byteorder.h>
35#include <asm/page.h>
35#include <linux/time.h> 36#include <linux/time.h>
36#include <linux/ethtool.h> 37#include <linux/ethtool.h>
37#include <linux/mii.h> 38#include <linux/mii.h>
@@ -49,14 +50,15 @@
49#include <linux/crc32.h> 50#include <linux/crc32.h>
50#include <linux/prefetch.h> 51#include <linux/prefetch.h>
51#include <linux/cache.h> 52#include <linux/cache.h>
53#include <linux/zlib.h>
52 54
53#include "bnx2.h" 55#include "bnx2.h"
54#include "bnx2_fw.h" 56#include "bnx2_fw.h"
55 57
56#define DRV_MODULE_NAME "bnx2" 58#define DRV_MODULE_NAME "bnx2"
57#define PFX DRV_MODULE_NAME ": " 59#define PFX DRV_MODULE_NAME ": "
58#define DRV_MODULE_VERSION "1.4.40" 60#define DRV_MODULE_VERSION "1.4.42"
59#define DRV_MODULE_RELDATE "May 22, 2006" 61#define DRV_MODULE_RELDATE "June 12, 2006"
60 62
61#define RUN_AT(x) (jiffies + (x)) 63#define RUN_AT(x) (jiffies + (x))
62 64
@@ -1820,7 +1822,7 @@ reuse_rx:
1820 skb->protocol = eth_type_trans(skb, bp->dev); 1822 skb->protocol = eth_type_trans(skb, bp->dev);
1821 1823
1822 if ((len > (bp->dev->mtu + ETH_HLEN)) && 1824 if ((len > (bp->dev->mtu + ETH_HLEN)) &&
1823 (htons(skb->protocol) != 0x8100)) { 1825 (ntohs(skb->protocol) != 0x8100)) {
1824 1826
1825 dev_kfree_skb_irq(skb); 1827 dev_kfree_skb_irq(skb);
1826 goto next_rx; 1828 goto next_rx;
@@ -2009,7 +2011,7 @@ bnx2_poll(struct net_device *dev, int *budget)
2009 return 1; 2011 return 1;
2010} 2012}
2011 2013
2012/* Called with rtnl_lock from vlan functions and also dev->xmit_lock 2014/* Called with rtnl_lock from vlan functions and also netif_tx_lock
2013 * from set_multicast. 2015 * from set_multicast.
2014 */ 2016 */
2015static void 2017static void
@@ -2083,6 +2085,92 @@ bnx2_set_rx_mode(struct net_device *dev)
2083 spin_unlock_bh(&bp->phy_lock); 2085 spin_unlock_bh(&bp->phy_lock);
2084} 2086}
2085 2087
2088#define FW_BUF_SIZE 0x8000
2089
2090static int
2091bnx2_gunzip_init(struct bnx2 *bp)
2092{
2093 if ((bp->gunzip_buf = vmalloc(FW_BUF_SIZE)) == NULL)
2094 goto gunzip_nomem1;
2095
2096 if ((bp->strm = kmalloc(sizeof(*bp->strm), GFP_KERNEL)) == NULL)
2097 goto gunzip_nomem2;
2098
2099 bp->strm->workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
2100 if (bp->strm->workspace == NULL)
2101 goto gunzip_nomem3;
2102
2103 return 0;
2104
2105gunzip_nomem3:
2106 kfree(bp->strm);
2107 bp->strm = NULL;
2108
2109gunzip_nomem2:
2110 vfree(bp->gunzip_buf);
2111 bp->gunzip_buf = NULL;
2112
2113gunzip_nomem1:
2114 printk(KERN_ERR PFX "%s: Cannot allocate firmware buffer for "
2115 "uncompression.\n", bp->dev->name);
2116 return -ENOMEM;
2117}
2118
2119static void
2120bnx2_gunzip_end(struct bnx2 *bp)
2121{
2122 kfree(bp->strm->workspace);
2123
2124 kfree(bp->strm);
2125 bp->strm = NULL;
2126
2127 if (bp->gunzip_buf) {
2128 vfree(bp->gunzip_buf);
2129 bp->gunzip_buf = NULL;
2130 }
2131}
2132
2133static int
2134bnx2_gunzip(struct bnx2 *bp, u8 *zbuf, int len, void **outbuf, int *outlen)
2135{
2136 int n, rc;
2137
2138 /* check gzip header */
2139 if ((zbuf[0] != 0x1f) || (zbuf[1] != 0x8b) || (zbuf[2] != Z_DEFLATED))
2140 return -EINVAL;
2141
2142 n = 10;
2143
2144#define FNAME 0x8
2145 if (zbuf[3] & FNAME)
2146 while ((zbuf[n++] != 0) && (n < len));
2147
2148 bp->strm->next_in = zbuf + n;
2149 bp->strm->avail_in = len - n;
2150 bp->strm->next_out = bp->gunzip_buf;
2151 bp->strm->avail_out = FW_BUF_SIZE;
2152
2153 rc = zlib_inflateInit2(bp->strm, -MAX_WBITS);
2154 if (rc != Z_OK)
2155 return rc;
2156
2157 rc = zlib_inflate(bp->strm, Z_FINISH);
2158
2159 *outlen = FW_BUF_SIZE - bp->strm->avail_out;
2160 *outbuf = bp->gunzip_buf;
2161
2162 if ((rc != Z_OK) && (rc != Z_STREAM_END))
2163 printk(KERN_ERR PFX "%s: Firmware decompression error: %s\n",
2164 bp->dev->name, bp->strm->msg);
2165
2166 zlib_inflateEnd(bp->strm);
2167
2168 if (rc == Z_STREAM_END)
2169 return 0;
2170
2171 return rc;
2172}
2173
2086static void 2174static void
2087load_rv2p_fw(struct bnx2 *bp, u32 *rv2p_code, u32 rv2p_code_len, 2175load_rv2p_fw(struct bnx2 *bp, u32 *rv2p_code, u32 rv2p_code_len,
2088 u32 rv2p_proc) 2176 u32 rv2p_proc)
@@ -2092,9 +2180,9 @@ load_rv2p_fw(struct bnx2 *bp, u32 *rv2p_code, u32 rv2p_code_len,
2092 2180
2093 2181
2094 for (i = 0; i < rv2p_code_len; i += 8) { 2182 for (i = 0; i < rv2p_code_len; i += 8) {
2095 REG_WR(bp, BNX2_RV2P_INSTR_HIGH, *rv2p_code); 2183 REG_WR(bp, BNX2_RV2P_INSTR_HIGH, cpu_to_le32(*rv2p_code));
2096 rv2p_code++; 2184 rv2p_code++;
2097 REG_WR(bp, BNX2_RV2P_INSTR_LOW, *rv2p_code); 2185 REG_WR(bp, BNX2_RV2P_INSTR_LOW, cpu_to_le32(*rv2p_code));
2098 rv2p_code++; 2186 rv2p_code++;
2099 2187
2100 if (rv2p_proc == RV2P_PROC1) { 2188 if (rv2p_proc == RV2P_PROC1) {
@@ -2134,7 +2222,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
2134 int j; 2222 int j;
2135 2223
2136 for (j = 0; j < (fw->text_len / 4); j++, offset += 4) { 2224 for (j = 0; j < (fw->text_len / 4); j++, offset += 4) {
2137 REG_WR_IND(bp, offset, fw->text[j]); 2225 REG_WR_IND(bp, offset, cpu_to_le32(fw->text[j]));
2138 } 2226 }
2139 } 2227 }
2140 2228
@@ -2190,15 +2278,32 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
2190 REG_WR_IND(bp, cpu_reg->mode, val); 2278 REG_WR_IND(bp, cpu_reg->mode, val);
2191} 2279}
2192 2280
2193static void 2281static int
2194bnx2_init_cpus(struct bnx2 *bp) 2282bnx2_init_cpus(struct bnx2 *bp)
2195{ 2283{
2196 struct cpu_reg cpu_reg; 2284 struct cpu_reg cpu_reg;
2197 struct fw_info fw; 2285 struct fw_info fw;
2286 int rc = 0;
2287 void *text;
2288 u32 text_len;
2289
2290 if ((rc = bnx2_gunzip_init(bp)) != 0)
2291 return rc;
2198 2292
2199 /* Initialize the RV2P processor. */ 2293 /* Initialize the RV2P processor. */
2200 load_rv2p_fw(bp, bnx2_rv2p_proc1, sizeof(bnx2_rv2p_proc1), RV2P_PROC1); 2294 rc = bnx2_gunzip(bp, bnx2_rv2p_proc1, sizeof(bnx2_rv2p_proc1), &text,
2201 load_rv2p_fw(bp, bnx2_rv2p_proc2, sizeof(bnx2_rv2p_proc2), RV2P_PROC2); 2295 &text_len);
2296 if (rc)
2297 goto init_cpu_err;
2298
2299 load_rv2p_fw(bp, text, text_len, RV2P_PROC1);
2300
2301 rc = bnx2_gunzip(bp, bnx2_rv2p_proc2, sizeof(bnx2_rv2p_proc2), &text,
2302 &text_len);
2303 if (rc)
2304 goto init_cpu_err;
2305
2306 load_rv2p_fw(bp, text, text_len, RV2P_PROC2);
2202 2307
2203 /* Initialize the RX Processor. */ 2308 /* Initialize the RX Processor. */
2204 cpu_reg.mode = BNX2_RXP_CPU_MODE; 2309 cpu_reg.mode = BNX2_RXP_CPU_MODE;
@@ -2222,7 +2327,13 @@ bnx2_init_cpus(struct bnx2 *bp)
2222 fw.text_addr = bnx2_RXP_b06FwTextAddr; 2327 fw.text_addr = bnx2_RXP_b06FwTextAddr;
2223 fw.text_len = bnx2_RXP_b06FwTextLen; 2328 fw.text_len = bnx2_RXP_b06FwTextLen;
2224 fw.text_index = 0; 2329 fw.text_index = 0;
2225 fw.text = bnx2_RXP_b06FwText; 2330
2331 rc = bnx2_gunzip(bp, bnx2_RXP_b06FwText, sizeof(bnx2_RXP_b06FwText),
2332 &text, &text_len);
2333 if (rc)
2334 goto init_cpu_err;
2335
2336 fw.text = text;
2226 2337
2227 fw.data_addr = bnx2_RXP_b06FwDataAddr; 2338 fw.data_addr = bnx2_RXP_b06FwDataAddr;
2228 fw.data_len = bnx2_RXP_b06FwDataLen; 2339 fw.data_len = bnx2_RXP_b06FwDataLen;
@@ -2268,7 +2379,13 @@ bnx2_init_cpus(struct bnx2 *bp)
2268 fw.text_addr = bnx2_TXP_b06FwTextAddr; 2379 fw.text_addr = bnx2_TXP_b06FwTextAddr;
2269 fw.text_len = bnx2_TXP_b06FwTextLen; 2380 fw.text_len = bnx2_TXP_b06FwTextLen;
2270 fw.text_index = 0; 2381 fw.text_index = 0;
2271 fw.text = bnx2_TXP_b06FwText; 2382
2383 rc = bnx2_gunzip(bp, bnx2_TXP_b06FwText, sizeof(bnx2_TXP_b06FwText),
2384 &text, &text_len);
2385 if (rc)
2386 goto init_cpu_err;
2387
2388 fw.text = text;
2272 2389
2273 fw.data_addr = bnx2_TXP_b06FwDataAddr; 2390 fw.data_addr = bnx2_TXP_b06FwDataAddr;
2274 fw.data_len = bnx2_TXP_b06FwDataLen; 2391 fw.data_len = bnx2_TXP_b06FwDataLen;
@@ -2314,7 +2431,13 @@ bnx2_init_cpus(struct bnx2 *bp)
2314 fw.text_addr = bnx2_TPAT_b06FwTextAddr; 2431 fw.text_addr = bnx2_TPAT_b06FwTextAddr;
2315 fw.text_len = bnx2_TPAT_b06FwTextLen; 2432 fw.text_len = bnx2_TPAT_b06FwTextLen;
2316 fw.text_index = 0; 2433 fw.text_index = 0;
2317 fw.text = bnx2_TPAT_b06FwText; 2434
2435 rc = bnx2_gunzip(bp, bnx2_TPAT_b06FwText, sizeof(bnx2_TPAT_b06FwText),
2436 &text, &text_len);
2437 if (rc)
2438 goto init_cpu_err;
2439
2440 fw.text = text;
2318 2441
2319 fw.data_addr = bnx2_TPAT_b06FwDataAddr; 2442 fw.data_addr = bnx2_TPAT_b06FwDataAddr;
2320 fw.data_len = bnx2_TPAT_b06FwDataLen; 2443 fw.data_len = bnx2_TPAT_b06FwDataLen;
@@ -2360,7 +2483,13 @@ bnx2_init_cpus(struct bnx2 *bp)
2360 fw.text_addr = bnx2_COM_b06FwTextAddr; 2483 fw.text_addr = bnx2_COM_b06FwTextAddr;
2361 fw.text_len = bnx2_COM_b06FwTextLen; 2484 fw.text_len = bnx2_COM_b06FwTextLen;
2362 fw.text_index = 0; 2485 fw.text_index = 0;
2363 fw.text = bnx2_COM_b06FwText; 2486
2487 rc = bnx2_gunzip(bp, bnx2_COM_b06FwText, sizeof(bnx2_COM_b06FwText),
2488 &text, &text_len);
2489 if (rc)
2490 goto init_cpu_err;
2491
2492 fw.text = text;
2364 2493
2365 fw.data_addr = bnx2_COM_b06FwDataAddr; 2494 fw.data_addr = bnx2_COM_b06FwDataAddr;
2366 fw.data_len = bnx2_COM_b06FwDataLen; 2495 fw.data_len = bnx2_COM_b06FwDataLen;
@@ -2384,6 +2513,9 @@ bnx2_init_cpus(struct bnx2 *bp)
2384 2513
2385 load_cpu_fw(bp, &cpu_reg, &fw); 2514 load_cpu_fw(bp, &cpu_reg, &fw);
2386 2515
2516init_cpu_err:
2517 bnx2_gunzip_end(bp);
2518 return rc;
2387} 2519}
2388 2520
2389static int 2521static int
@@ -3256,7 +3388,9 @@ bnx2_init_chip(struct bnx2 *bp)
3256 * context block must have already been enabled. */ 3388 * context block must have already been enabled. */
3257 bnx2_init_context(bp); 3389 bnx2_init_context(bp);
3258 3390
3259 bnx2_init_cpus(bp); 3391 if ((rc = bnx2_init_cpus(bp)) != 0)
3392 return rc;
3393
3260 bnx2_init_nvram(bp); 3394 bnx2_init_nvram(bp);
3261 3395
3262 bnx2_set_mac_addr(bp); 3396 bnx2_set_mac_addr(bp);
@@ -3556,7 +3690,9 @@ bnx2_reset_nic(struct bnx2 *bp, u32 reset_code)
3556 if (rc) 3690 if (rc)
3557 return rc; 3691 return rc;
3558 3692
3559 bnx2_init_chip(bp); 3693 if ((rc = bnx2_init_chip(bp)) != 0)
3694 return rc;
3695
3560 bnx2_init_tx_ring(bp); 3696 bnx2_init_tx_ring(bp);
3561 bnx2_init_rx_ring(bp); 3697 bnx2_init_rx_ring(bp);
3562 return 0; 3698 return 0;
@@ -4034,6 +4170,8 @@ bnx2_timer(unsigned long data)
4034 msg = (u32) ++bp->fw_drv_pulse_wr_seq; 4170 msg = (u32) ++bp->fw_drv_pulse_wr_seq;
4035 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_PULSE_MB, msg); 4171 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_PULSE_MB, msg);
4036 4172
4173 bp->stats_blk->stat_FwRxDrop = REG_RD_IND(bp, BNX2_FW_RX_DROP_COUNT);
4174
4037 if ((bp->phy_flags & PHY_SERDES_FLAG) && 4175 if ((bp->phy_flags & PHY_SERDES_FLAG) &&
4038 (CHIP_NUM(bp) == CHIP_NUM_5706)) { 4176 (CHIP_NUM(bp) == CHIP_NUM_5706)) {
4039 4177
@@ -4252,7 +4390,7 @@ bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
4252} 4390}
4253#endif 4391#endif
4254 4392
4255/* Called with dev->xmit_lock. 4393/* Called with netif_tx_lock.
4256 * hard_start_xmit is pseudo-lockless - a lock is only required when 4394 * hard_start_xmit is pseudo-lockless - a lock is only required when
4257 * the tx queue is full. This way, we get the benefit of lockless 4395 * the tx queue is full. This way, we get the benefit of lockless
4258 * operations most of the time without the complexities to handle 4396 * operations most of the time without the complexities to handle
@@ -4310,7 +4448,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
4310 ip_tcp_len = (skb->nh.iph->ihl << 2) + sizeof(struct tcphdr); 4448 ip_tcp_len = (skb->nh.iph->ihl << 2) + sizeof(struct tcphdr);
4311 4449
4312 skb->nh.iph->check = 0; 4450 skb->nh.iph->check = 0;
4313 skb->nh.iph->tot_len = ntohs(mss + ip_tcp_len + tcp_opt_len); 4451 skb->nh.iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
4314 skb->h.th->check = 4452 skb->h.th->check =
4315 ~csum_tcpudp_magic(skb->nh.iph->saddr, 4453 ~csum_tcpudp_magic(skb->nh.iph->saddr,
4316 skb->nh.iph->daddr, 4454 skb->nh.iph->daddr,
@@ -4504,6 +4642,10 @@ bnx2_get_stats(struct net_device *dev)
4504 net_stats->tx_aborted_errors + 4642 net_stats->tx_aborted_errors +
4505 net_stats->tx_carrier_errors; 4643 net_stats->tx_carrier_errors;
4506 4644
4645 net_stats->rx_missed_errors =
4646 (unsigned long) (stats_blk->stat_IfInMBUFDiscards +
4647 stats_blk->stat_FwRxDrop);
4648
4507 return net_stats; 4649 return net_stats;
4508} 4650}
4509 4651
@@ -4986,7 +5128,7 @@ bnx2_set_rx_csum(struct net_device *dev, u32 data)
4986 return 0; 5128 return 0;
4987} 5129}
4988 5130
4989#define BNX2_NUM_STATS 45 5131#define BNX2_NUM_STATS 46
4990 5132
4991static struct { 5133static struct {
4992 char string[ETH_GSTRING_LEN]; 5134 char string[ETH_GSTRING_LEN];
@@ -5036,6 +5178,7 @@ static struct {
5036 { "rx_mac_ctrl_frames" }, 5178 { "rx_mac_ctrl_frames" },
5037 { "rx_filtered_packets" }, 5179 { "rx_filtered_packets" },
5038 { "rx_discards" }, 5180 { "rx_discards" },
5181 { "rx_fw_discards" },
5039}; 5182};
5040 5183
5041#define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4) 5184#define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4)
@@ -5086,6 +5229,7 @@ static const unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = {
5086 STATS_OFFSET32(stat_MacControlFramesReceived), 5229 STATS_OFFSET32(stat_MacControlFramesReceived),
5087 STATS_OFFSET32(stat_IfInFramesL2FilterDiscards), 5230 STATS_OFFSET32(stat_IfInFramesL2FilterDiscards),
5088 STATS_OFFSET32(stat_IfInMBUFDiscards), 5231 STATS_OFFSET32(stat_IfInMBUFDiscards),
5232 STATS_OFFSET32(stat_FwRxDrop),
5089}; 5233};
5090 5234
5091/* stat_IfHCInBadOctets and stat_Dot3StatsCarrierSenseErrors are 5235/* stat_IfHCInBadOctets and stat_Dot3StatsCarrierSenseErrors are
@@ -5096,7 +5240,7 @@ static u8 bnx2_5706_stats_len_arr[BNX2_NUM_STATS] = {
5096 4,0,4,4,4,4,4,4,4,4, 5240 4,0,4,4,4,4,4,4,4,4,
5097 4,4,4,4,4,4,4,4,4,4, 5241 4,4,4,4,4,4,4,4,4,4,
5098 4,4,4,4,4,4,4,4,4,4, 5242 4,4,4,4,4,4,4,4,4,4,
5099 4,4,4,4,4, 5243 4,4,4,4,4,4,
5100}; 5244};
5101 5245
5102static u8 bnx2_5708_stats_len_arr[BNX2_NUM_STATS] = { 5246static u8 bnx2_5708_stats_len_arr[BNX2_NUM_STATS] = {
@@ -5104,7 +5248,7 @@ static u8 bnx2_5708_stats_len_arr[BNX2_NUM_STATS] = {
5104 4,4,4,4,4,4,4,4,4,4, 5248 4,4,4,4,4,4,4,4,4,4,
5105 4,4,4,4,4,4,4,4,4,4, 5249 4,4,4,4,4,4,4,4,4,4,
5106 4,4,4,4,4,4,4,4,4,4, 5250 4,4,4,4,4,4,4,4,4,4,
5107 4,4,4,4,4, 5251 4,4,4,4,4,4,
5108}; 5252};
5109 5253
5110#define BNX2_NUM_TESTS 6 5254#define BNX2_NUM_TESTS 6
@@ -5634,7 +5778,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
5634 } 5778 }
5635 } 5779 }
5636 5780
5637 if (CHIP_NUM(bp) == CHIP_NUM_5708) 5781 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
5782 (CHIP_ID(bp) == CHIP_ID_5708_B0) ||
5783 (CHIP_ID(bp) == CHIP_ID_5708_B1))
5638 bp->flags |= NO_WOL_FLAG; 5784 bp->flags |= NO_WOL_FLAG;
5639 5785
5640 if (CHIP_ID(bp) == CHIP_ID_5706_A0) { 5786 if (CHIP_ID(bp) == CHIP_ID_5706_A0) {
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index b87925f6a228..5845e334941b 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -231,6 +231,7 @@ struct statistics_block {
231 u32 stat_GenStat13; 231 u32 stat_GenStat13;
232 u32 stat_GenStat14; 232 u32 stat_GenStat14;
233 u32 stat_GenStat15; 233 u32 stat_GenStat15;
234 u32 stat_FwRxDrop;
234}; 235};
235 236
236 237
@@ -3481,6 +3482,8 @@ struct l2_fhdr {
3481 3482
3482#define BNX2_COM_SCRATCH 0x00120000 3483#define BNX2_COM_SCRATCH 0x00120000
3483 3484
3485#define BNX2_FW_RX_DROP_COUNT 0x00120084
3486
3484 3487
3485/* 3488/*
3486 * cp_reg definition 3489 * cp_reg definition
@@ -3747,7 +3750,12 @@ struct l2_fhdr {
3747#define DMA_READ_CHANS 5 3750#define DMA_READ_CHANS 5
3748#define DMA_WRITE_CHANS 3 3751#define DMA_WRITE_CHANS 3
3749 3752
3750#define BCM_PAGE_BITS 12 3753/* Use CPU native page size up to 16K for the ring sizes. */
3754#if (PAGE_SHIFT > 14)
3755#define BCM_PAGE_BITS 14
3756#else
3757#define BCM_PAGE_BITS PAGE_SHIFT
3758#endif
3751#define BCM_PAGE_SIZE (1 << BCM_PAGE_BITS) 3759#define BCM_PAGE_SIZE (1 << BCM_PAGE_BITS)
3752 3760
3753#define TX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct tx_bd)) 3761#define TX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct tx_bd))
@@ -3770,7 +3778,7 @@ struct l2_fhdr {
3770 3778
3771#define RX_RING_IDX(x) ((x) & bp->rx_max_ring_idx) 3779#define RX_RING_IDX(x) ((x) & bp->rx_max_ring_idx)
3772 3780
3773#define RX_RING(x) (((x) & ~MAX_RX_DESC_CNT) >> 8) 3781#define RX_RING(x) (((x) & ~MAX_RX_DESC_CNT) >> (BCM_PAGE_BITS - 4))
3774#define RX_IDX(x) ((x) & MAX_RX_DESC_CNT) 3782#define RX_IDX(x) ((x) & MAX_RX_DESC_CNT)
3775 3783
3776/* Context size. */ 3784/* Context size. */
@@ -4048,6 +4056,9 @@ struct bnx2 {
4048 u32 flash_size; 4056 u32 flash_size;
4049 4057
4050 int status_stats_size; 4058 int status_stats_size;
4059
4060 struct z_stream_s *strm;
4061 void *gunzip_buf;
4051}; 4062};
4052 4063
4053static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset); 4064static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset);
diff --git a/drivers/net/bnx2_fw.h b/drivers/net/bnx2_fw.h
index 8158974c35a8..2d753dca0d75 100644
--- a/drivers/net/bnx2_fw.h
+++ b/drivers/net/bnx2_fw.h
@@ -7,7 +7,7 @@
7 * the Free Software Foundation, except as noted below. 7 * the Free Software Foundation, except as noted below.
8 * 8 *
9 * This file contains firmware data derived from proprietary unpublished 9 * This file contains firmware data derived from proprietary unpublished
10 * source code, Copyright (c) 2004, 2005 Broadcom Corporation. 10 * source code, Copyright (c) 2004, 2005, 2006 Broadcom Corporation.
11 * 11 *
12 * Permission is hereby granted for the distribution of this firmware data 12 * Permission is hereby granted for the distribution of this firmware data
13 * in hexadecimal or equivalent format, provided this copyright notice is 13 * in hexadecimal or equivalent format, provided this copyright notice is
@@ -28,943 +28,641 @@ static const u32 bnx2_COM_b06FwBssAddr = 0x08005860;
28static const int bnx2_COM_b06FwBssLen = 0x88; 28static const int bnx2_COM_b06FwBssLen = 0x88;
29static const u32 bnx2_COM_b06FwSbssAddr = 0x08005840; 29static const u32 bnx2_COM_b06FwSbssAddr = 0x08005840;
30static const int bnx2_COM_b06FwSbssLen = 0x1c; 30static const int bnx2_COM_b06FwSbssLen = 0x1c;
31static u32 bnx2_COM_b06FwText[(0x57bc/4) + 1] = { 31static u8 bnx2_COM_b06FwText[] = {
32 0x0a00022d, 0x00000000, 0x00000000, 0x0000000d, 0x636f6d20, 0x322e352e, 32 0x1f, 0x8b, 0x08, 0x08, 0x09, 0x83, 0x41, 0x44, 0x00, 0x03, 0x74, 0x65,
33 0x38000000, 0x02050802, 0x00000000, 0x00000003, 0x00000014, 0x00000032, 33 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xec, 0x5b, 0x7d, 0x6c,
34 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 34 0x5b, 0xd7, 0x75, 0x3f, 0xef, 0xf1, 0x51, 0x7a, 0x96, 0x68, 0xf9, 0x99,
35 0x00000010, 0x000003e8, 0x0000ea60, 0x00000001, 0x00000000, 0x00000000, 35 0x7e, 0x96, 0x59, 0x4f, 0xb1, 0x49, 0xf1, 0xc9, 0xd2, 0x62, 0x2d, 0x63,
36 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 36 0x34, 0x35, 0xd1, 0x3a, 0x26, 0x66, 0x48, 0xda, 0x71, 0x36, 0x67, 0xa0,
37 0x0000ffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 37 0x1d, 0x05, 0x51, 0x51, 0xaf, 0xd0, 0x48, 0xd9, 0xcd, 0xb2, 0x0c, 0x73,
38 0x00000000, 0x00000000, 0x00000002, 0x00000020, 0x00000000, 0x00000000, 38 0x96, 0xb4, 0x70, 0xbc, 0xb4, 0xa1, 0x25, 0x79, 0xf5, 0x06, 0x45, 0xcf,
39 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 39 0xb3, 0x34, 0x39, 0xc0, 0x82, 0x41, 0x10, 0x9d, 0x3a, 0x7f, 0x30, 0xa5,
40 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 40 0xed, 0x7c, 0x19, 0xe8, 0x12, 0x29, 0xb2, 0x93, 0xb5, 0x43, 0xd0, 0xa6,
41 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 41 0x68, 0xff, 0xe8, 0x8a, 0x6e, 0x30, 0x52, 0x0c, 0xf3, 0x3a, 0xa0, 0x30,
42 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 42 0xfa, 0xc7, 0xe6, 0x2d, 0x1f, 0xdc, 0xef, 0xdc, 0x77, 0x1f, 0xf9, 0x48,
43 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 43 0x51, 0x96, 0x1c, 0x34, 0x5d, 0xb7, 0x99, 0x80, 0xf0, 0xde, 0xbd, 0xf7,
44 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 44 0xbc, 0x7b, 0xcf, 0x3d, 0xdf, 0xe7, 0xdc, 0xab, 0x5f, 0x53, 0xa9, 0x85,
45 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 45 0xe4, 0x6f, 0x2d, 0xfe, 0xc2, 0x7f, 0xf4, 0xc7, 0xb9, 0xdb, 0x3e, 0x7d,
46 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 46 0x5b, 0x1f, 0x5e, 0x07, 0x54, 0xdd, 0xaf, 0x72, 0xbf, 0x0f, 0x7f, 0x26,
47 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 47 0xfe, 0xfa, 0xe4, 0x7b, 0xa3, 0x9f, 0x81, 0xbf, 0x2b, 0x18, 0x1c, 0xfe,
48 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 48 0x09, 0x91, 0xb2, 0x0c, 0x8c, 0xf7, 0x57, 0x2e, 0x5f, 0x7f, 0x9c, 0x17,
49 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 49 0x0e, 0xaf, 0x62, 0x9e, 0x9b, 0xbf, 0x9b, 0xbf, 0x9b, 0xbf, 0x9b, 0xbf,
50 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 50 0x9b, 0xbf, 0x9b, 0xbf, 0x9b, 0xbf, 0xff, 0x3f, 0x3f, 0x9f, 0x13, 0x72,
51 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 51 0x88, 0x98, 0x85, 0xff, 0x48, 0x57, 0xe3, 0x89, 0xa1, 0xa4, 0x45, 0xba,
52 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 52 0x2f, 0x7e, 0x65, 0x28, 0x67, 0x11, 0x25, 0x8a, 0xdb, 0xc3, 0x29, 0xfa,
53 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 53 0xb0, 0x9c, 0x37, 0x35, 0xe2, 0xfe, 0x5b, 0xe2, 0x1f, 0x3c, 0xfd, 0xfa,
54 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 54 0x9d, 0x91, 0xab, 0xb3, 0x3e, 0xd2, 0x8d, 0xf8, 0xcb, 0xba, 0xb1, 0x8d,
55 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 55 0xf4, 0x0e, 0x7c, 0xf3, 0x5c, 0xf7, 0x7f, 0xa8, 0xd4, 0xe6, 0xce, 0x75,
56 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 56 0xa5, 0xfc, 0x7a, 0x37, 0xe5, 0x37, 0xc7, 0x75, 0x52, 0xe3, 0x5d, 0x3f,
57 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 57 0x48, 0xfa, 0x8c, 0x61, 0x5f, 0xdc, 0xa0, 0xf9, 0x12, 0x65, 0x0e, 0x4c,
58 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 58 0xf0, 0x1a, 0xb1, 0x75, 0xf7, 0x62, 0x2e, 0x2d, 0x3e, 0x3c, 0xf4, 0x67,
59 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 59 0xd6, 0xd3, 0x65, 0xd5, 0xb2, 0x7a, 0xe6, 0x28, 0x30, 0xf0, 0x7c, 0x3f,
60 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 60 0xc6, 0x8b, 0x91, 0x1e, 0xa2, 0x3b, 0x49, 0xb5, 0xf2, 0x01, 0x9f, 0xa5,
61 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 61 0x53, 0xb2, 0x64, 0x51, 0xaa, 0x44, 0xf4, 0x77, 0x45, 0x85, 0x9e, 0xb7,
62 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 62 0xda, 0x69, 0xae, 0xf7, 0x83, 0x72, 0x02, 0xb8, 0xbc, 0x6d, 0x0d, 0x0f,
63 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 63 0x8d, 0x5b, 0x3c, 0x57, 0x7c, 0x9d, 0x83, 0x6f, 0x6f, 0x5b, 0xce, 0xd2,
64 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 64 0x68, 0xb4, 0xc8, 0x7d, 0xbd, 0x2d, 0xdc, 0xe7, 0x8f, 0x3f, 0x1c, 0x7c,
65 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 65 0xde, 0x0a, 0xc8, 0xbe, 0x1f, 0xa5, 0x92, 0x98, 0x6f, 0xac, 0xc8, 0xb0,
66 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 66 0xcf, 0xde, 0x91, 0xb3, 0x4c, 0xd9, 0x6f, 0xc5, 0x93, 0x56, 0x08, 0xfd,
67 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 67 0x1d, 0x72, 0x2c, 0xbd, 0x2e, 0x67, 0x59, 0x72, 0xac, 0x88, 0x6f, 0x7a,
68 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 68 0x65, 0xff, 0x3b, 0xa9, 0x9c, 0x15, 0x93, 0xfd, 0x57, 0x93, 0x49, 0xab,
69 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 69 0x5f, 0xf6, 0x1f, 0xbe, 0x2b, 0x67, 0xc5, 0x65, 0xff, 0xf7, 0x81, 0x8b,
70 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 70 0x41, 0xc7, 0x8a, 0x61, 0xfc, 0x25, 0x30, 0xfe, 0x9a, 0x41, 0x6d, 0x19,
71 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 71 0x8c, 0x61, 0xef, 0xb6, 0x4e, 0x97, 0x7d, 0x21, 0x7a, 0xbd, 0xfb, 0x32,
72 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 72 0x68, 0x63, 0xd0, 0xd9, 0x12, 0x29, 0x99, 0xee, 0x10, 0x68, 0x62, 0xd2,
73 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 73 0xb9, 0x52, 0x2b, 0xf9, 0x4e, 0xfa, 0xb0, 0xe7, 0xcf, 0x51, 0xd6, 0xd4,
74 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 74 0x69, 0xfd, 0x8c, 0x42, 0x9d, 0x7d, 0x6b, 0x28, 0x61, 0xe4, 0x29, 0xd5,
75 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 75 0x8d, 0x28, 0x6e, 0xd2, 0x24, 0x6d, 0x66, 0x71, 0xbd, 0x8a, 0x1e, 0x95,
76 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 76 0x22, 0xa1, 0x2c, 0x28, 0x3c, 0x72, 0xfa, 0x5d, 0x8e, 0x39, 0xb1, 0x26,
77 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 77 0xff, 0x85, 0x29, 0x35, 0x71, 0x2b, 0x0d, 0x1b, 0x8c, 0x0f, 0x80, 0x05,
78 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 78 0x1f, 0x74, 0x25, 0x79, 0x2a, 0x44, 0xc7, 0xec, 0x80, 0x92, 0x3a, 0x75,
79 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 79 0x37, 0x25, 0x63, 0x64, 0xaa, 0xd4, 0x25, 0xbe, 0x2d, 0x14, 0x43, 0x34,
80 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 80 0x6e, 0x93, 0x92, 0xb4, 0x99, 0x5e, 0xed, 0x18, 0x6f, 0x13, 0xb0, 0xe8,
81 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 81 0xeb, 0xf0, 0x51, 0x97, 0x91, 0x22, 0x9d, 0x71, 0x46, 0x7f, 0x50, 0x49,
82 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 82 0x8b, 0x39, 0x44, 0x7f, 0x78, 0x8c, 0x02, 0x74, 0xba, 0x68, 0x4a, 0xd8,
83 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 83 0x72, 0x39, 0x19, 0x33, 0x00, 0x07, 0xda, 0xd9, 0x26, 0x0d, 0xe3, 0x39,
84 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 84 0x6a, 0xf3, 0xfa, 0x21, 0xc8, 0xcc, 0xb7, 0x87, 0xb2, 0xd3, 0x62, 0xbe,
85 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 85 0xb0, 0x2f, 0xce, 0xf3, 0x75, 0x00, 0xee, 0x1d, 0xe0, 0xa5, 0x90, 0x26,
86 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 86 0x78, 0x95, 0xa0, 0xec, 0x84, 0x02, 0x79, 0xc2, 0x53, 0xd0, 0x2d, 0x0d,
87 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 87 0xfc, 0x35, 0xb2, 0xfa, 0x14, 0xca, 0x59, 0x9b, 0x28, 0x6f, 0xa0, 0x5d,
88 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 88 0xbc, 0xa0, 0x26, 0xed, 0x66, 0x4a, 0x69, 0x61, 0xec, 0x5f, 0xc8, 0x0a,
89 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 89 0x8d, 0xe1, 0x1b, 0xd5, 0x62, 0x98, 0x9f, 0x61, 0xef, 0xc3, 0x82, 0xfe,
90 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 90 0x4d, 0xf1, 0xfd, 0x74, 0x69, 0x22, 0xaf, 0x26, 0x4b, 0xed, 0xe4, 0x9b,
91 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 91 0x89, 0x40, 0x9a, 0xc7, 0xd5, 0xd4, 0x19, 0x8d, 0xfc, 0x93, 0x0a, 0x41,
92 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 92 0x3e, 0x0c, 0x5f, 0xfc, 0xb8, 0xba, 0xb3, 0x74, 0x41, 0x4d, 0x95, 0xf8,
93 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 93 0x1b, 0xc0, 0x16, 0x55, 0xd0, 0x96, 0xdf, 0xb7, 0x83, 0x96, 0x34, 0xac,
94 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 94 0xc6, 0x75, 0x3d, 0x51, 0x64, 0x99, 0xe5, 0x6f, 0xc1, 0x0f, 0xec, 0xe5,
95 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 95 0x9c, 0x0d, 0xfe, 0x08, 0x7e, 0x85, 0xc1, 0xaf, 0x6f, 0x82, 0x5f, 0xfd,
96 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 96 0xe0, 0x53, 0x8c, 0xde, 0x28, 0xf5, 0xd2, 0x6b, 0xa5, 0x1e, 0x7a, 0x15,
97 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 97 0x32, 0xf9, 0x4a, 0x29, 0x4c, 0x2f, 0x97, 0x3a, 0xe8, 0xa5, 0x52, 0x88,
98 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 98 0xce, 0x0b, 0x1e, 0xa6, 0x21, 0xff, 0x82, 0xaf, 0xfa, 0x26, 0xf0, 0xa4,
99 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 99 0x1d, 0x3c, 0x59, 0x0f, 0x79, 0xd9, 0x08, 0xf9, 0x9b, 0xee, 0xd6, 0x69,
100 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 100 0xaa, 0x9b, 0x12, 0x41, 0xf4, 0x6f, 0x89, 0x6b, 0x82, 0x4e, 0x1a, 0xc6,
101 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 101 0xc7, 0x26, 0xfc, 0x94, 0x32, 0x4e, 0xd3, 0x7b, 0x93, 0x1a, 0x8d, 0x95,
102 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 102 0xa6, 0x36, 0x3a, 0x7c, 0xe3, 0xf6, 0x2c, 0x5d, 0x44, 0x5f, 0xca, 0x98,
103 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 103 0xa5, 0x4b, 0xdb, 0x54, 0x1a, 0x9d, 0xfe, 0x1b, 0x4a, 0x9e, 0x39, 0x4d,
104 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 104 0x3f, 0xfe, 0x3a, 0x51, 0x06, 0x34, 0x51, 0xfb, 0x7e, 0x5a, 0x4e, 0x18,
105 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 105 0xa0, 0x45, 0x5f, 0xaf, 0x90, 0x08, 0xb5, 0x8f, 0x79, 0x19, 0x86, 0xae,
106 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 106 0x68, 0x4a, 0xca, 0x7e, 0x01, 0xfa, 0xd2, 0xaa, 0x24, 0xa7, 0x88, 0x72,
107 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 107 0x53, 0x65, 0xca, 0xc5, 0xfc, 0xf4, 0x98, 0x51, 0xa6, 0x74, 0xac, 0x89,
108 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 108 0xbe, 0x68, 0xb4, 0xd3, 0x68, 0xef, 0x6f, 0xf8, 0xdc, 0x5c, 0x65, 0xba,
109 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 109 0xd4, 0x8f, 0x77, 0xee, 0x23, 0x9a, 0x12, 0xef, 0x4e, 0x7f, 0xbe, 0xe4,
110 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 110 0xa7, 0x84, 0x99, 0x0f, 0x69, 0xf4, 0x8e, 0xcf, 0xc1, 0x29, 0xe1, 0x8e,
111 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 111 0x81, 0x57, 0xc3, 0xb0, 0x0f, 0x8e, 0x0c, 0x66, 0x27, 0xd6, 0x5c, 0x4b,
112 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 112 0x88, 0x6e, 0xc0, 0x0b, 0xd9, 0xd3, 0x18, 0x8f, 0x61, 0x25, 0x6e, 0x52,
113 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 113 0xa7, 0xd0, 0x8d, 0x7e, 0xc0, 0x0c, 0x28, 0xfb, 0x4a, 0xcc, 0x6b, 0xbc,
114 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 114 0x17, 0x19, 0xd7, 0xcd, 0x80, 0xd5, 0xf0, 0x4c, 0x48, 0x9c, 0xbd, 0x78,
115 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 115 0xf2, 0x5c, 0x8c, 0x27, 0x3f, 0x7f, 0xcf, 0x83, 0xe7, 0xe7, 0x2b, 0xef,
116 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 116 0x53, 0x9e, 0xf7, 0x7c, 0xe9, 0x4f, 0x03, 0x0e, 0x7e, 0x4c, 0xcf, 0x01,
117 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 117 0x1a, 0x9d, 0x38, 0x2c, 0xd7, 0xc2, 0x7b, 0x91, 0xd7, 0x38, 0x0d, 0x3a,
118 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 118 0x09, 0xc8, 0x15, 0xd6, 0x3a, 0xec, 0x59, 0xeb, 0x49, 0xcf, 0x5a, 0x4f,
119 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 119 0x7a, 0xd6, 0xca, 0x83, 0xb6, 0xb4, 0x4e, 0xb5, 0xfc, 0xd0, 0x51, 0xee,
120 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 120 0x39, 0x8e, 0x39, 0x9f, 0x03, 0x5f, 0xbe, 0x0a, 0x98, 0x38, 0x2d, 0xda,
121 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 121 0xa0, 0xc7, 0x94, 0x46, 0x7b, 0x4d, 0x7e, 0x7f, 0xb1, 0xd5, 0xc1, 0x8b,
122 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 122 0xdf, 0x2f, 0x48, 0x9c, 0x5a, 0x1d, 0xb8, 0xd2, 0x15, 0xa1, 0xff, 0xf3,
123 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 123 0x25, 0xd6, 0x4f, 0x8a, 0xf9, 0x2c, 0x3a, 0x94, 0x8e, 0xb5, 0xd3, 0x98,
124 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 124 0xa1, 0xc4, 0x46, 0x7b, 0x9a, 0x99, 0x8e, 0x09, 0xd5, 0x6a, 0x85, 0x0e,
125 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, 0x3c020800, 0x24425840, 125 0x50, 0x58, 0x65, 0xdb, 0x25, 0xf0, 0x7b, 0x49, 0xe2, 0x61, 0x70, 0x3b,
126 0x3c030800, 0x246358e8, 0xac400000, 0x0043202b, 0x1480fffd, 0x24420004, 126 0xa3, 0x5a, 0xc1, 0xba, 0x7e, 0x96, 0xdf, 0x57, 0xf0, 0xce, 0x32, 0x9c,
127 0x3c1d0800, 0x37bd7ffc, 0x03a0f021, 0x3c100800, 0x261008b4, 0x3c1c0800, 127 0xd4, 0x9c, 0xb5, 0x5f, 0x45, 0x9b, 0xed, 0xce, 0x66, 0xd9, 0x76, 0xc7,
128 0x279c5840, 0x0e0002f7, 0x00000000, 0x0000000d, 0x27bdffe8, 0x3c1a8000, 128 0xff, 0xa0, 0xa9, 0xb6, 0xfd, 0x05, 0xb3, 0xb6, 0xed, 0xea, 0x82, 0xd7,
129 0x3c020008, 0x0342d825, 0x3c036010, 0xafbf0010, 0x8c655000, 0x3c020800, 129 0x66, 0xf1, 0xde, 0xc2, 0xe4, 0xb3, 0x58, 0x8e, 0xfc, 0xc0, 0x35, 0x06,
130 0x24470f30, 0x3c040800, 0x24865860, 0x2402ff7f, 0x00a22824, 0x34a5380c, 130 0x3d, 0x6c, 0x96, 0x38, 0x7c, 0x4b, 0xe2, 0x00, 0x5c, 0x01, 0x37, 0x5a,
131 0xac655000, 0x00002821, 0x24020037, 0x24030c80, 0xaf420008, 0xaf430024, 131 0xe2, 0x6f, 0x04, 0x4b, 0xea, 0xda, 0x4c, 0x43, 0xf7, 0x7d, 0xad, 0x18,
132 0xacc70000, 0x24a50001, 0x2ca20016, 0x1440fffc, 0x24c60004, 0x24845860, 132 0xbf, 0xec, 0xe3, 0x75, 0xdc, 0x27, 0x29, 0x69, 0xe8, 0xc9, 0xd8, 0xb4,
133 0x3c020800, 0x24420f3c, 0x3c030800, 0x24630e2c, 0xac820004, 0x3c020800, 133 0x46, 0xd9, 0xd8, 0x26, 0x21, 0xd7, 0xd9, 0x58, 0xd5, 0x06, 0x8c, 0x4e,
134 0x24420a2c, 0x3c050800, 0x24a51268, 0xac82000c, 0x3c020800, 0x244243dc, 134 0xd4, 0xdb, 0x00, 0xfe, 0x8e, 0x6d, 0x80, 0xa3, 0xfb, 0x63, 0xd3, 0x6c,
135 0xac830008, 0x3c030800, 0x24633698, 0xac820014, 0x3c020800, 0x24423c24, 135 0x0b, 0x1c, 0xdd, 0x3f, 0x36, 0xc1, 0x36, 0x41, 0xcc, 0x09, 0xfd, 0x67,
136 0xac830018, 0xac83001c, 0x3c030800, 0x24630f44, 0xac820024, 0x3c020800, 136 0x3b, 0xe0, 0xda, 0x00, 0xfe, 0x86, 0x6d, 0x80, 0x0f, 0xf2, 0xcd, 0xf3,
137 0x244243ac, 0xac83002c, 0x3c030800, 0x246343cc, 0xac820030, 0x3c020800, 137 0xb9, 0x6b, 0x8f, 0xd7, 0xcd, 0x3b, 0xce, 0xb6, 0x45, 0xd9, 0xd9, 0xcd,
138 0x244242f0, 0xac830034, 0x3c030800, 0x24633d78, 0xac82003c, 0x3c020800, 138 0x30, 0xc7, 0xb1, 0x76, 0x80, 0x0a, 0xd3, 0xcc, 0xc3, 0x48, 0xe8, 0x08,
139 0x24420fd4, 0xac850010, 0xac850020, 0xac830040, 0x0e0010b7, 0xac820050, 139 0x1d, 0x17, 0x36, 0xef, 0xf4, 0x04, 0x25, 0x0e, 0x9e, 0x18, 0xa0, 0x34,
140 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x27bdffe0, 0xafb00010, 0x27500100, 140 0x6c, 0xc0, 0xdc, 0xc4, 0xb5, 0x32, 0xf8, 0x78, 0x47, 0x13, 0x59, 0xb0,
141 0xafbf0018, 0xafb10014, 0x9203000b, 0x24020003, 0x1462005b, 0x96110008, 141 0x75, 0xf0, 0x93, 0xfd, 0x7e, 0xf2, 0xc5, 0xe3, 0x90, 0xb7, 0x98, 0xf0,
142 0x32220001, 0x10400009, 0x27430080, 0x8e020000, 0x96040014, 0x000211c2, 142 0x5d, 0xd5, 0x9f, 0xa6, 0xed, 0xaa, 0x69, 0x37, 0xc1, 0x3f, 0x62, 0xde,
143 0x00021040, 0x00621821, 0xa4640000, 0x0a0002d0, 0x3c020800, 0x3c020800, 143 0xfe, 0x98, 0x90, 0x4d, 0xef, 0x2f, 0x09, 0x1b, 0x94, 0x8c, 0x7d, 0x08,
144 0x8c430020, 0x1060002a, 0x3c030800, 0x0e00148e, 0x00000000, 0x97420108, 144 0xf9, 0x75, 0x69, 0xe4, 0xea, 0x1f, 0xdb, 0xfa, 0x2b, 0x1e, 0x1f, 0xb2,
145 0x8f850018, 0x9743010c, 0x3042003e, 0x00021400, 0x00621825, 0xaca30000, 145 0x05, 0x76, 0xdf, 0x84, 0x3c, 0xb9, 0x76, 0x9f, 0xed, 0x71, 0x88, 0x6d,
146 0x8f840018, 0x8f420100, 0xac820004, 0x97430116, 0x9742010e, 0x8f840018, 146 0x26, 0xf4, 0x8d, 0x6d, 0x70, 0x80, 0xd4, 0x19, 0x4d, 0xda, 0x69, 0x5d,
147 0x00031c00, 0x00431025, 0xac820008, 0x97430110, 0x97440112, 0x8f850018, 147 0xda, 0xe9, 0x00, 0x6c, 0x34, 0xb7, 0x0d, 0xd9, 0x36, 0x45, 0x1b, 0xf6,
148 0x00031c00, 0x00832025, 0xaca4000c, 0x97420114, 0x8f840018, 0x3042ffff, 148 0x1a, 0xf6, 0x70, 0x77, 0x3a, 0x35, 0xc1, 0xfe, 0x10, 0xbe, 0x7b, 0x86,
149 0xac820010, 0x8f830018, 0xac600014, 0x8f820018, 0x3c030800, 0xac400018, 149 0x75, 0xf8, 0xdb, 0x43, 0x23, 0xd3, 0xc2, 0x07, 0xb0, 0xff, 0x80, 0x65,
150 0x946258ce, 0x8f840018, 0x3c032000, 0x00431025, 0xac82001c, 0x0e0014cc, 150 0x66, 0x1b, 0xce, 0xb6, 0x1c, 0xfb, 0x2e, 0x62, 0xdd, 0x8a, 0xad, 0x64,
151 0x24040001, 0x3c030800, 0x8c620040, 0x24420001, 0xac620040, 0x3c020800, 151 0x39, 0xf1, 0xe2, 0xc5, 0x38, 0xad, 0x21, 0xf5, 0xa4, 0x43, 0x6b, 0x35,
152 0x8c430044, 0x32240004, 0x24630001, 0x10800017, 0xac430044, 0x8f4202b8, 152 0xfe, 0xa8, 0x46, 0x2d, 0x4c, 0x63, 0xc6, 0x7f, 0x2b, 0x70, 0xe6, 0x7d,
153 0x04430007, 0x8e020020, 0x3c040800, 0x8c830060, 0x24020001, 0x24630001, 153 0xfd, 0x4f, 0xe0, 0xcc, 0xeb, 0xd6, 0xe3, 0x4d, 0x7a, 0x6b, 0xfc, 0xac,
154 0x0a0002f2, 0xac830060, 0x3c060800, 0x8cc4005c, 0xaf420280, 0x96030016, 154 0xfe, 0xf0, 0x33, 0xa4, 0x37, 0xc7, 0xcf, 0xd2, 0xbf, 0x58, 0x74, 0x9f,
155 0x00001021, 0xa7430284, 0x8e050004, 0x24840001, 0x3c031000, 0xaf450288, 155 0x0e, 0x3f, 0xdb, 0xad, 0xc0, 0xcf, 0x16, 0xa1, 0xef, 0x53, 0x3a, 0x1d,
156 0xaf4302b8, 0x0a0002f2, 0xacc4005c, 0x32220002, 0x0a0002f2, 0x0002102b, 156 0x3c, 0x15, 0xc9, 0xfc, 0x2b, 0x45, 0x61, 0x3f, 0x76, 0xd0, 0xc8, 0x94,
157 0x3c026000, 0xac400808, 0x0000000d, 0x00001021, 0x8fbf0018, 0x8fb10014, 157 0x42, 0x7a, 0x17, 0xb5, 0xc3, 0x7f, 0xf4, 0x37, 0x61, 0xfe, 0x5d, 0x44,
158 0x8fb00010, 0x03e00008, 0x27bd0020, 0x27bdffc8, 0xafbf0034, 0xafbe0030, 158 0x9b, 0x1d, 0xbf, 0xd9, 0x15, 0x1e, 0x05, 0xff, 0xd3, 0x2f, 0x7e, 0x05,
159 0xafb7002c, 0xafb60028, 0xafb50024, 0xafb40020, 0xafb3001c, 0xafb20018, 159 0xdf, 0x3c, 0x4d, 0x07, 0xa7, 0x0e, 0x2b, 0x39, 0xfb, 0x08, 0xe0, 0x97,
160 0xafb10014, 0x0e000244, 0xafb00010, 0x3c170800, 0x3c160800, 0x24110020, 160 0x83, 0xd5, 0x01, 0x9b, 0x07, 0xec, 0x97, 0x31, 0xef, 0xd3, 0xa4, 0xdf,
161 0x24150030, 0x2794000c, 0x27930008, 0x3c124000, 0x3c1e0800, 0x8f820004, 161 0x1e, 0x19, 0x48, 0x28, 0xc0, 0xe3, 0x45, 0x01, 0x2f, 0x7d, 0x71, 0x97,
162 0x3c040800, 0x8c830020, 0x10430005, 0x8ee200a4, 0xaf830004, 0x0e001593, 162 0xb1, 0x53, 0xf0, 0x3f, 0x40, 0xef, 0x15, 0x2f, 0x80, 0xbe, 0xbd, 0xf0,
163 0x00000000, 0x8ee200a4, 0x8ec300a0, 0x10430004, 0x26c400a0, 0x94820002, 163 0x39, 0x91, 0x67, 0x61, 0x93, 0xe1, 0x8f, 0x22, 0x57, 0x31, 0x2d, 0x7c,
164 0xa742009e, 0xaee300a4, 0x8f500000, 0x32020007, 0x1040ffee, 0x32020001, 164 0x11, 0x29, 0x0f, 0x76, 0xa7, 0x41, 0xef, 0x38, 0xfc, 0xd3, 0x00, 0xfc,
165 0x1040002c, 0x32020002, 0x8f420100, 0xaf420020, 0x8f430104, 0xaf4300a8, 165 0x53, 0x0c, 0xbe, 0xa9, 0x07, 0x7e, 0xc9, 0x82, 0x5f, 0x0a, 0x83, 0x1f,
166 0x9342010b, 0x93630000, 0x306300ff, 0x10710005, 0x304400ff, 0x10750006, 166 0x06, 0xcd, 0xc2, 0x47, 0xcd, 0x42, 0xfe, 0xe7, 0x66, 0x48, 0x19, 0x04,
167 0x2c820016, 0x0a000333, 0x00000000, 0xaf940000, 0x0a000334, 0x2c820016, 167 0xad, 0xcf, 0xc1, 0x3f, 0x26, 0x63, 0x77, 0x42, 0xcf, 0x22, 0x17, 0x66,
168 0xaf930000, 0x0a000334, 0x00000000, 0xaf800000, 0x14400005, 0x00041880, 168 0xd5, 0x41, 0xca, 0xc1, 0x9f, 0x77, 0x6e, 0x8b, 0x62, 0xbd, 0x26, 0x4a,
169 0x0e0003cc, 0x00000000, 0x0a000340, 0x00000000, 0x3c020800, 0x24425860, 169 0x84, 0x5c, 0x1d, 0xe5, 0xdf, 0x7e, 0x85, 0xac, 0x7f, 0x06, 0xef, 0x22,
170 0x00621821, 0x8c620000, 0x0040f809, 0x00000000, 0x10400005, 0x3c030800, 170 0x61, 0xa2, 0x3d, 0x94, 0xb5, 0xa3, 0x46, 0xa7, 0xda, 0x03, 0x18, 0x6e,
171 0x8f420104, 0x3c016020, 0xac220014, 0x3c030800, 0x8c620034, 0xaf520138, 171 0x87, 0x95, 0x03, 0x53, 0x11, 0x05, 0xfb, 0x03, 0xcd, 0x27, 0x60, 0xeb,
172 0x24420001, 0xac620034, 0x32020002, 0x1040001a, 0x32020004, 0x8f420140, 172 0xcb, 0x34, 0x1e, 0x63, 0x3d, 0x29, 0xd3, 0xf3, 0xb1, 0xc8, 0x40, 0x9e,
173 0xaf420020, 0x93630000, 0x306300ff, 0x10710005, 0x00000000, 0x10750006, 173 0x5a, 0xe9, 0x98, 0x39, 0x21, 0x7c, 0xbc, 0x16, 0x3f, 0x21, 0x74, 0x2c,
174 0x00000000, 0x0a00035d, 0x00000000, 0xaf940000, 0x0a00035e, 0x00000000, 174 0x67, 0xe1, 0x59, 0xec, 0x54, 0xb2, 0x53, 0xbc, 0x7e, 0x14, 0x5a, 0xee,
175 0xaf930000, 0x0a00035e, 0x00000000, 0xaf800000, 0x0e000c7b, 0x00000000, 175 0xc7, 0x93, 0xe7, 0x07, 0xdd, 0xfa, 0x49, 0x39, 0xd8, 0x9d, 0x87, 0x77,
176 0x3c040800, 0x8c820038, 0xaf520178, 0x24420001, 0xac820038, 0x32020004, 176 0x88, 0x18, 0x8b, 0x58, 0x39, 0x35, 0x11, 0x0d, 0x45, 0x55, 0x8d, 0x86,
177 0x1040ffa4, 0x00000000, 0x8f420180, 0xaf420020, 0x93630000, 0x306300ff, 177 0x35, 0x85, 0x46, 0x61, 0x6f, 0xd2, 0xb1, 0xff, 0x2c, 0x1f, 0x33, 0x79,
178 0x10710005, 0x00000000, 0x10750006, 0x00000000, 0x0a000378, 0x00000000, 178 0xbc, 0x99, 0xbe, 0x2a, 0xfc, 0x0d, 0xd6, 0x2e, 0x4c, 0x63, 0x5d, 0x3f,
179 0xaf940000, 0x0a000379, 0x00000000, 0xaf930000, 0x0a000379, 0x00000000, 179 0xf8, 0xcb, 0xeb, 0xf2, 0x3c, 0x68, 0xc3, 0xf6, 0x6b, 0x56, 0xe4, 0xd9,
180 0xaf800000, 0x8f430180, 0x24020f00, 0x14620005, 0x00000000, 0x8f420188, 180 0x3c, 0xed, 0x00, 0x6d, 0xd9, 0x66, 0xc1, 0x3e, 0x0c, 0x60, 0xed, 0x5e,
181 0xa742009c, 0x0a000387, 0x8fc2003c, 0x93620000, 0x14510004, 0x8fc2003c, 181 0xd8, 0x4f, 0x3c, 0x93, 0xbd, 0x1c, 0x07, 0x05, 0x68, 0xd8, 0x64, 0x79,
182 0x0e000bad, 0x00000000, 0x8fc2003c, 0xaf5201b8, 0x24420001, 0x0a00030b, 182 0xd4, 0xe5, 0x98, 0xe9, 0x19, 0xf3, 0xcb, 0xb1, 0x20, 0xfe, 0xe0, 0x7f,
183 0xafc2003c, 0x27bdffe8, 0xafbf0010, 0x97420108, 0x24033000, 0x30447000, 183 0x4d, 0x96, 0x19, 0x6e, 0x73, 0x4c, 0xc6, 0x34, 0x09, 0xd3, 0xdc, 0x64,
184 0x10830016, 0x28823001, 0x10400007, 0x24024000, 0x1080000b, 0x24022000, 184 0x02, 0x34, 0x8b, 0x9c, 0x4d, 0x10, 0xd3, 0x0c, 0x46, 0x7b, 0x7f, 0x82,
185 0x1082000c, 0x00000000, 0x0a0003b3, 0x00000000, 0x10820010, 0x24025000, 185 0xbe, 0x64, 0xaf, 0xf7, 0x3b, 0xb6, 0xb0, 0x55, 0x49, 0xc1, 0x17, 0xa8,
186 0x10820012, 0x00000000, 0x0a0003b3, 0x00000000, 0x0000000d, 0x0a0003b5, 186 0x56, 0x0b, 0x7c, 0x45, 0x98, 0x5e, 0x15, 0xb0, 0x64, 0xa8, 0xf1, 0x68,
187 0x00001021, 0x0e000442, 0x00000000, 0x0a0003b6, 0x8fbf0010, 0x0e00041a, 187 0xe8, 0x4b, 0x74, 0xab, 0xb0, 0x11, 0x09, 0xc3, 0x4b, 0xe3, 0xff, 0x52,
188 0x00000000, 0x0a0003b5, 0x00001021, 0x0e000669, 0x00000000, 0x0a0003b5, 188 0xc9, 0x72, 0xbf, 0x69, 0xa5, 0xec, 0x20, 0xf3, 0x89, 0xd7, 0x33, 0x68,
189 0x00001021, 0x0e001467, 0x00000000, 0x0a0003b5, 0x00001021, 0x0000000d, 189 0xae, 0xe4, 0xbc, 0xfb, 0x10, 0xa3, 0x16, 0x60, 0x6b, 0xce, 0x4f, 0xaa,
190 0x00001021, 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x93620000, 0x24030020, 190 0xf4, 0xf8, 0x1d, 0xf0, 0x65, 0xb1, 0x6d, 0x58, 0xcb, 0xc4, 0x78, 0x1e,
191 0x304400ff, 0x10830005, 0x24020030, 0x10820007, 0x00000000, 0x0a0003c9, 191 0x6d, 0x15, 0x6d, 0xe8, 0x99, 0x11, 0x02, 0x8f, 0xb9, 0x9f, 0xe1, 0x4c,
192 0x00000000, 0x2782000c, 0xaf820000, 0x03e00008, 0x00000000, 0x27820008, 192 0xfc, 0xbd, 0xcf, 0xb1, 0x75, 0x3e, 0xab, 0xde, 0x4a, 0x14, 0x64, 0x7a,
193 0xaf820000, 0x03e00008, 0x00000000, 0xaf800000, 0x03e00008, 0x00000000, 193 0xc5, 0x40, 0x2b, 0xcb, 0x50, 0xd5, 0x6d, 0xc2, 0x5f, 0x3b, 0xb6, 0xc4,
194 0x0000000d, 0x03e00008, 0x00001021, 0x03e00008, 0x00001021, 0x27440100, 194 0x82, 0x2e, 0xc2, 0xe6, 0xf6, 0x79, 0x75, 0x91, 0xe3, 0x09, 0x57, 0x17,
195 0x94830008, 0x30620004, 0x10400017, 0x30620002, 0x8f4202b8, 0x04430007, 195 0x23, 0xa1, 0x84, 0x0a, 0x5b, 0xdc, 0xa7, 0xd1, 0x09, 0xd1, 0x56, 0x28,
196 0x8c820020, 0x3c040800, 0x8c830060, 0x24020001, 0x24630001, 0x03e00008, 196 0x31, 0x18, 0x09, 0x2d, 0xa8, 0x1c, 0x4b, 0x33, 0x6c, 0x18, 0xf1, 0x4a,
197 0xac830060, 0xaf420280, 0x94830016, 0x3c060800, 0xa7430284, 0x8c850004, 197 0x40, 0xc2, 0x22, 0x9e, 0xb3, 0xdd, 0x98, 0x30, 0x84, 0x7e, 0x53, 0xf4,
198 0x8cc4005c, 0x00001021, 0x3c031000, 0x24840001, 0xaf450288, 0xaf4302b8, 198 0x1f, 0xab, 0xe8, 0xa8, 0x13, 0xff, 0xa9, 0x88, 0x11, 0x0b, 0x88, 0x11,
199 0x03e00008, 0xacc4005c, 0x14400003, 0x3c040800, 0x03e00008, 0x00001021, 199 0x53, 0x42, 0x47, 0x8d, 0x04, 0x72, 0x04, 0xd0, 0xdc, 0xd1, 0xcf, 0x42,
200 0x8c830084, 0x24020001, 0x24630001, 0x03e00008, 0xac830084, 0x27450100, 200 0x91, 0x71, 0xc9, 0xb1, 0x5c, 0x0e, 0x00, 0x99, 0x13, 0x8e, 0x7d, 0xa4,
201 0x3c040800, 0x8c820088, 0x94a3000c, 0x24420001, 0x007a1821, 0xac820088, 201 0x3c, 0xc7, 0x91, 0xa3, 0xea, 0x53, 0x34, 0x5c, 0x60, 0x3f, 0x8e, 0x3f,
202 0x8ca40018, 0x90664000, 0xaf440038, 0x8ca2001c, 0x2403fff8, 0x00063600, 202 0x9b, 0x6d, 0x2d, 0xec, 0xa3, 0xf0, 0xc5, 0x51, 0xf0, 0x39, 0x0f, 0x1a,
203 0x00431024, 0x34420004, 0x3c030005, 0xaf42003c, 0xaf430030, 0x00000000, 203 0xac, 0x97, 0x74, 0xdd, 0x4f, 0x07, 0xec, 0x3d, 0xa0, 0x79, 0x9c, 0x46,
204 0x00000000, 0x00000000, 0xaf460404, 0x00000000, 0x00000000, 0x00000000, 204 0x4e, 0x8d, 0xb0, 0xcc, 0xf6, 0x14, 0x28, 0xd2, 0x73, 0x8c, 0xb6, 0x1b,
205 0x3c020006, 0x34420001, 0xaf420030, 0x00000000, 0x00000000, 0x00000000, 205 0x73, 0x2c, 0xdf, 0x83, 0xe5, 0x1d, 0xe0, 0x85, 0xd0, 0x51, 0xc8, 0x20,
206 0x8f420000, 0x30420010, 0x1040fffd, 0x00001021, 0x03e00008, 0x00000000, 206 0x65, 0x0b, 0x23, 0xf4, 0x58, 0x89, 0xfb, 0xf2, 0xa0, 0x1d, 0xe2, 0xda,
207 0x3c020800, 0x8c430020, 0x27bdffe8, 0xafb00010, 0x27500100, 0x1060001e, 207 0xfe, 0xfd, 0x52, 0xce, 0x31, 0x9f, 0xe6, 0xce, 0x37, 0x22, 0xe7, 0x63,
208 0xafbf0014, 0x0e00148e, 0x00000000, 0x8f830018, 0x8e020018, 0xac620000, 208 0x38, 0x86, 0xe1, 0x6f, 0xaa, 0xf3, 0xee, 0x14, 0x3c, 0x8d, 0x18, 0x5d,
209 0x8f840018, 0x9602000c, 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 209 0x6a, 0x79, 0x87, 0x1f, 0xe3, 0xcf, 0xf7, 0xf3, 0x3b, 0xe6, 0x81, 0xef,
210 0xac40000c, 0x8f830018, 0xac600010, 0x8f820018, 0xac400014, 0x8f840018, 210 0x6f, 0xb6, 0xf6, 0x00, 0x76, 0x10, 0x73, 0xfa, 0xa9, 0xb3, 0xdd, 0xc5,
211 0x3c026000, 0x8c434448, 0xac830018, 0x96020008, 0x3c030800, 0x946458ce, 211 0x37, 0x81, 0xb5, 0xd9, 0xcf, 0x31, 0x9f, 0x1f, 0xa1, 0xec, 0xa9, 0x7c,
212 0x8f850018, 0x00021400, 0x00441025, 0x24040001, 0x0e0014cc, 0xaca2001c, 212 0x8f, 0x0a, 0x19, 0x9b, 0xcd, 0x28, 0xe4, 0xb7, 0x1e, 0xa6, 0xdc, 0xa9,
213 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x27bdffe8, 0xafb00010, 213 0xa3, 0x6c, 0x37, 0x40, 0xab, 0x3d, 0xb4, 0x6b, 0x22, 0xd2, 0x73, 0x80,
214 0x27500100, 0xafbf0014, 0x92020009, 0x14400003, 0x3c020800, 0x0a00046c, 214 0x34, 0xb1, 0xce, 0x5b, 0x24, 0xe8, 0x1f, 0x9b, 0x15, 0xbe, 0x20, 0x43,
215 0x24020001, 0x8c430020, 0x1060001f, 0x00001021, 0x0e00148e, 0x00000000, 215 0xe9, 0x89, 0xed, 0xa1, 0x4b, 0xe8, 0x1b, 0x1e, 0x8c, 0x84, 0x17, 0xe8,
216 0x8f830018, 0x8e020018, 0xac620000, 0x8f840018, 0x9602000c, 0xac820004, 216 0x09, 0xd0, 0xe5, 0x23, 0xf8, 0x22, 0xab, 0x67, 0x0c, 0x3a, 0x84, 0x9c,
217 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010, 217 0x0a, 0xeb, 0x8f, 0x4a, 0xda, 0xe0, 0xbb, 0xcc, 0x51, 0xd0, 0x8f, 0xf2,
218 0x8f820018, 0xac400014, 0x8f840018, 0x3c026000, 0x8c434448, 0xac830018, 218 0x0e, 0x4d, 0x99, 0x9e, 0x4c, 0xcb, 0xaf, 0xc0, 0xf6, 0x1c, 0x11, 0xb1,
219 0x96020008, 0x3c030800, 0x946458ce, 0x8f850018, 0x00021400, 0x00441025, 219 0x4b, 0x56, 0xd0, 0xee, 0xd2, 0x06, 0x47, 0x0e, 0x60, 0x8b, 0x30, 0xef,
220 0x24040001, 0x0e0014cc, 0xaca2001c, 0x00001021, 0x8fbf0014, 0x8fb00010, 220 0xe5, 0x41, 0x85, 0xb6, 0x20, 0x4e, 0x3f, 0x24, 0x78, 0xeb, 0xa3, 0x7d,
221 0x03e00008, 0x27bd0018, 0x3c0b0800, 0x8d6808b0, 0x3c070800, 0x24e700b0, 221 0x66, 0xd4, 0xd8, 0x47, 0xf3, 0x7e, 0x27, 0x56, 0xc0, 0x3c, 0x3d, 0xf7,
222 0x00084900, 0x01271821, 0xac640000, 0x93620005, 0x97660008, 0x00e95021, 222 0x60, 0x0f, 0x90, 0x53, 0xfb, 0xeb, 0xeb, 0xa8, 0x2d, 0x12, 0x4e, 0xa8,
223 0x93630023, 0x9364003f, 0x25080001, 0x00021600, 0x00063400, 0x00461025, 223 0x09, 0xfa, 0x93, 0xd2, 0xdd, 0xe4, 0xe8, 0x77, 0x2b, 0xdb, 0x7e, 0xf0,
224 0x00031a00, 0x00431025, 0x00822025, 0xad440004, 0x9362007e, 0x9366007f, 224 0xb0, 0xd3, 0x69, 0x5b, 0x78, 0x16, 0x3a, 0xb1, 0x1e, 0xe3, 0xfe, 0xac,
225 0x8f630178, 0x9364007a, 0x00021600, 0x00063400, 0x00461025, 0x00031a00, 225 0xc0, 0x7d, 0x84, 0xba, 0xa1, 0x6b, 0x22, 0x8f, 0x39, 0x51, 0x8b, 0x17,
226 0x00431025, 0x00822025, 0xad440008, 0x93620080, 0x9363007d, 0x3108007f, 226 0xf3, 0xbc, 0x9e, 0xcf, 0x5f, 0xc6, 0x3c, 0xdc, 0xcf, 0x70, 0x78, 0x2f,
227 0x01403821, 0xad6808b0, 0x00021600, 0x00031c00, 0x00431025, 0x00451025, 227 0x3c, 0x41, 0x23, 0x90, 0xc7, 0x5c, 0x7f, 0x57, 0x68, 0x0c, 0xdf, 0xa4,
228 0x03e00008, 0xace2000c, 0x27bdffb8, 0xafb3002c, 0x00009821, 0xafbe0040, 228 0x4a, 0x4d, 0x74, 0x54, 0xe3, 0xf1, 0x48, 0x38, 0xaf, 0x1e, 0x42, 0xdc,
229 0x0000f021, 0xafb50034, 0x27550100, 0xafbf0044, 0xafb7003c, 0xafb60038, 229 0xf3, 0xb8, 0xea, 0xb7, 0x7e, 0xe6, 0x67, 0xbf, 0xe3, 0xb7, 0xae, 0x29,
230 0xafb40030, 0xafb20028, 0xafb10024, 0xafb00020, 0xafa00010, 0xafa00014, 230 0xd5, 0xb9, 0x10, 0x87, 0x8a, 0xdc, 0x60, 0x41, 0x19, 0x2c, 0x5d, 0x52,
231 0x96a20008, 0x8f540100, 0x8eb10018, 0x30420001, 0x10400037, 0x02a0b821, 231 0x92, 0x85, 0x6b, 0x4a, 0xaa, 0xc4, 0x30, 0x8e, 0xce, 0x67, 0xcf, 0x74,
232 0x8f630054, 0x2622ffff, 0x00431023, 0x18400006, 0x00000000, 0x0000000d, 232 0x82, 0x4e, 0x1f, 0x89, 0xef, 0xe6, 0x7a, 0x8f, 0x50, 0xea, 0xd4, 0xad,
233 0x00000000, 0x2400015c, 0x0a0004e5, 0x00002021, 0x8f62004c, 0x02221023, 233 0x94, 0x9e, 0xe6, 0xbc, 0x34, 0x02, 0x7c, 0x3f, 0x2a, 0xe7, 0x62, 0x41,
234 0x18400028, 0x00002021, 0x93650120, 0x93640121, 0x3c030800, 0x8c62008c, 234 0xca, 0x9d, 0xe1, 0x31, 0xb6, 0x5f, 0xd6, 0xd5, 0x45, 0x1f, 0xef, 0x9f,
235 0x308400ff, 0x24420001, 0x30a500ff, 0x00803821, 0x1485000b, 0xac62008c, 235 0xf9, 0x6f, 0x52, 0xc1, 0x7e, 0x53, 0xd2, 0x8f, 0xdf, 0x7d, 0x9c, 0x93,
236 0x3c040800, 0x8c830090, 0x24630001, 0xac830090, 0x93620122, 0x30420001, 236 0xe1, 0xf7, 0x6f, 0x86, 0xd3, 0xb7, 0x95, 0x16, 0x36, 0xdc, 0xc8, 0x3e,
237 0x00021023, 0x30420005, 0x0a0004e5, 0x34440004, 0x27660100, 0x00041080, 237 0x57, 0xb3, 0xc7, 0x47, 0x7d, 0x7e, 0x6b, 0x7b, 0x13, 0xb5, 0x84, 0x80,
238 0x00c21021, 0x8c430000, 0x02231823, 0x04600004, 0x24820001, 0x30440007, 238 0xc3, 0x4a, 0x7b, 0x64, 0x98, 0x5f, 0x87, 0x1c, 0xb0, 0x4d, 0xd9, 0x0d,
239 0x1485fff9, 0x00041080, 0x10870007, 0x3c030800, 0xa3640121, 0x8c620094, 239 0x7e, 0x5a, 0x6c, 0xc3, 0x60, 0x93, 0x76, 0x53, 0xae, 0xc4, 0xb2, 0x1d,
240 0x24040005, 0x24420001, 0x0a0004e5, 0xac620094, 0x24040004, 0x00809821, 240 0x35, 0x32, 0x90, 0xb1, 0x34, 0x75, 0xb1, 0x1e, 0xb9, 0xba, 0x07, 0xdb,
241 0x9362003f, 0x304400ff, 0x38830016, 0x2c630001, 0x38820010, 0x2c420001, 241 0x9d, 0x87, 0xed, 0x46, 0x3c, 0x64, 0x53, 0xbe, 0x29, 0xce, 0x36, 0xbc,
242 0x00621825, 0x1460000c, 0x24020001, 0x38830008, 0x2c630001, 0x38820014, 242 0x0b, 0xb2, 0x85, 0xbe, 0x62, 0x55, 0x17, 0x77, 0x2d, 0xc1, 0x5d, 0x5b,
243 0x2c420001, 0x00621825, 0x14600005, 0x24020001, 0x24020012, 0x14820002, 243 0xc2, 0xa3, 0x02, 0xd5, 0xe2, 0x3f, 0x4b, 0x8c, 0xff, 0x5f, 0x00, 0xff,
244 0x00001021, 0x24020001, 0x10400009, 0x00000000, 0x8ea20020, 0x8f630040, 244 0xcf, 0x01, 0x7f, 0xc6, 0xa9, 0x31, 0xfe, 0x3b, 0x2b, 0xf8, 0x33, 0x0c,
245 0x0040b021, 0x00431023, 0x5c400010, 0x8f760040, 0x0a000511, 0x00000000, 245 0xfc, 0x1c, 0x64, 0xf1, 0x0d, 0xe8, 0xe2, 0x6b, 0x36, 0x7c, 0x9d, 0x0d,
246 0x9343010b, 0x24020004, 0x1462000a, 0x8eb60020, 0x8f630040, 0x3c021000, 246 0xff, 0x67, 0xc3, 0xdf, 0xd9, 0xf0, 0x8b, 0x36, 0x7c, 0x1e, 0xf6, 0x74,
247 0x00761823, 0x0043102a, 0x10400004, 0x00000000, 0x0000000d, 0x00000000, 247 0x0e, 0x36, 0xe9, 0xac, 0x9d, 0x34, 0x58, 0x9f, 0x92, 0x31, 0xf6, 0x9d,
248 0x240002fa, 0x9343010b, 0x24020004, 0x5462000b, 0x96a20008, 0x24020001, 248 0xbb, 0x65, 0xde, 0x1d, 0x92, 0x71, 0xf7, 0xa7, 0x64, 0x2c, 0x7b, 0x00,
249 0xafa20010, 0x96a20008, 0x24030001, 0xafa30018, 0x8eb2001c, 0x36730002, 249 0xb1, 0xec, 0x66, 0x1a, 0xed, 0xe1, 0x9c, 0xa4, 0x05, 0xcf, 0x75, 0x78,
250 0x30420020, 0x0a000526, 0xafa20014, 0x36730080, 0x30420002, 0x10400003, 250 0x22, 0x6e, 0xed, 0x49, 0x48, 0xbd, 0xfc, 0x0c, 0x62, 0x5c, 0xd8, 0xff,
251 0xafa00018, 0x0a000526, 0x8eb2001c, 0x8eb20014, 0x2402fffb, 0x02628024, 251 0x1e, 0xe4, 0x37, 0x19, 0xc4, 0x6a, 0x56, 0x1f, 0xc7, 0xe5, 0xb0, 0x65,
252 0x1200002a, 0x3c030800, 0x8c620030, 0x02021024, 0x10400026, 0x3c020800, 252 0xef, 0x37, 0x39, 0x76, 0xfe, 0x2e, 0x19, 0x03, 0xbb, 0xed, 0x56, 0xc0,
253 0x8c430020, 0x10600024, 0x32620004, 0x0e00148e, 0x00000000, 0x8f830018, 253 0xa4, 0xd1, 0xd7, 0x8a, 0x6f, 0x7e, 0x07, 0xb2, 0xdf, 0x86, 0xf6, 0xce,
254 0x8f420100, 0xac620000, 0x8f840018, 0x02401821, 0x32620002, 0xac900004, 254 0x3a, 0x18, 0xe4, 0xb3, 0x56, 0x16, 0x7d, 0x11, 0xc0, 0xb4, 0x61, 0x9d,
255 0x8f840018, 0x54400001, 0x02c01821, 0xac830008, 0x8f830018, 0x8ee20020, 255 0x0e, 0xb4, 0xf7, 0xa0, 0x7d, 0x8b, 0xb3, 0x8e, 0xf1, 0x2b, 0x68, 0xa7,
256 0xac62000c, 0x8f840018, 0x8f620040, 0xac820010, 0x8f830018, 0x8ee20018, 256 0xea, 0xbe, 0xd9, 0x8a, 0xbe, 0x4c, 0x5d, 0xdf, 0x9b, 0xe8, 0x4b, 0xa2,
257 0xac620014, 0x8f850018, 0x3c026000, 0x8c434448, 0x24040001, 0x3c020800, 257 0x6f, 0x51, 0x7e, 0x97, 0x47, 0x3b, 0x52, 0x07, 0xb3, 0x88, 0x3e, 0xc6,
258 0xaca30018, 0x944358ce, 0x8f850018, 0x3c024010, 0x00621825, 0x0e0014cc, 258 0xf1, 0x5b, 0x78, 0xde, 0x47, 0xa3, 0x19, 0x8e, 0x03, 0xdc, 0xb1, 0xdc,
259 0xaca3001c, 0x32620004, 0x10400063, 0x00003821, 0x3c029000, 0x34420001, 259 0x7a, 0x6a, 0xe3, 0xdc, 0xf7, 0x43, 0x21, 0x3b, 0xf3, 0xd2, 0x46, 0xa7,
260 0x3c038000, 0x02821025, 0xa360007c, 0xaf420020, 0x8f420020, 0x00431024, 260 0x27, 0xd8, 0x4f, 0x8c, 0x20, 0xee, 0xe1, 0x71, 0xe1, 0x9c, 0x3c, 0xfd,
261 0x1440fffd, 0x00000000, 0x93620023, 0x30420080, 0x10400011, 0x00000000, 261 0x1f, 0x00, 0xf6, 0x61, 0x8c, 0x21, 0x56, 0xb7, 0xcb, 0x4d, 0x8d, 0xc7,
262 0x8f65005c, 0x8f63004c, 0x9764003c, 0x8f620064, 0x00a32823, 0x00852821, 262 0x1f, 0xc5, 0xf8, 0x5f, 0xca, 0x6f, 0x2b, 0x73, 0x03, 0xfe, 0x1b, 0x75,
263 0x00a2102b, 0x54400006, 0x3c023fff, 0x93620023, 0x3042007f, 0xa3620023, 263 0x7d, 0x6a, 0xb0, 0xb6, 0xbd, 0xd6, 0xf3, 0xbe, 0x4d, 0x5f, 0xfa, 0xfd,
264 0xaf710064, 0x3c023fff, 0x0a000580, 0x3442ffff, 0x8f62005c, 0x02221023, 264 0x48, 0x1d, 0xfc, 0xef, 0x6e, 0xa8, 0x6d, 0x3f, 0xc5, 0xdf, 0x20, 0x87,
265 0x04400011, 0x00000000, 0x8f65005c, 0x8f630064, 0x9764003c, 0x3c023fff, 265 0x70, 0xdb, 0x09, 0xc8, 0x1d, 0xdb, 0xa4, 0xfa, 0x79, 0x3e, 0x6b, 0xd4,
266 0x3442ffff, 0xaf710064, 0x00a32823, 0x00852821, 0x0045102b, 0x10400004, 266 0xf6, 0x6d, 0x32, 0x6b, 0xdb, 0x1c, 0x27, 0x31, 0x5c, 0x08, 0xf2, 0xde,
267 0x02251021, 0x3c053fff, 0x34a5ffff, 0x02251021, 0xaf62005c, 0x24070001, 267 0xa1, 0xec, 0xb2, 0x7f, 0x13, 0xe3, 0x61, 0xe5, 0x5e, 0xdb, 0x8b, 0x67,
268 0xaf71004c, 0x8f620054, 0x16220005, 0x00000000, 0x93620023, 0x30420040, 268 0x48, 0xe6, 0x46, 0xe1, 0x4a, 0xcc, 0x3b, 0x5f, 0x0a, 0x40, 0xae, 0x3e,
269 0x10400017, 0x24020001, 0x9762006a, 0x00022880, 0x50a00001, 0x24050001, 269 0x0f, 0x9e, 0x73, 0xdc, 0x53, 0xd5, 0xf1, 0xf7, 0x68, 0x39, 0x1d, 0x67,
270 0x97630068, 0x93640081, 0x3c020800, 0x8c46004c, 0x00652821, 0x00852804, 270 0x1f, 0xc0, 0x31, 0xfe, 0x36, 0x11, 0x1f, 0xfb, 0xe2, 0x4f, 0x70, 0x0c,
271 0x00c5102b, 0x54400001, 0x00a03021, 0x3c020800, 0x8c440050, 0x00c4182b, 271 0xf6, 0xb4, 0xe3, 0x5b, 0x2c, 0xf8, 0x43, 0xb4, 0x4b, 0x7e, 0xc7, 0x6e,
272 0x54600001, 0x00c02021, 0x8f420074, 0x2403fffe, 0x00832824, 0x00a21021, 272 0x22, 0x9f, 0xc8, 0x16, 0xd8, 0x9f, 0xb1, 0x0f, 0x89, 0xc0, 0x4e, 0xb3,
273 0xaf62000c, 0x93620082, 0x30420080, 0x50400001, 0xa3600081, 0x3c028000, 273 0x1f, 0xfd, 0x24, 0x7d, 0xc6, 0x5d, 0xcd, 0x6c, 0xfb, 0x34, 0xeb, 0x05,
274 0x34420001, 0x02821025, 0xaf420020, 0x9363007e, 0x9362007a, 0x10620004, 274 0xc4, 0x0b, 0x1c, 0xe7, 0xb1, 0xed, 0xc6, 0x7b, 0xd1, 0x8d, 0x57, 0xee,
275 0x00000000, 0x0e0013c4, 0x00000000, 0x00403821, 0x54e00001, 0x241e0001, 275 0xd7, 0xc8, 0xaa, 0xfa, 0x11, 0x67, 0x8f, 0x5b, 0x59, 0x37, 0x56, 0xb1,
276 0x8f700040, 0x8f620040, 0x14520003, 0x00521023, 0x0a0005bf, 0x00001021, 276 0xef, 0xc6, 0xb6, 0xed, 0xc7, 0x75, 0xb6, 0xe1, 0xb2, 0xb0, 0x0d, 0x0f,
277 0x28420001, 0x10400041, 0x8fa20010, 0x0e000fae, 0x02402021, 0xaf720040, 277 0x6a, 0x7e, 0xeb, 0xf7, 0x9b, 0x1d, 0x79, 0x6d, 0x6c, 0x1b, 0xee, 0xad,
278 0x9362003e, 0x30420001, 0x1440000b, 0x3c029000, 0x93620022, 0x24420001, 278 0xd8, 0x06, 0x57, 0x5e, 0xbd, 0x79, 0xeb, 0x0f, 0xc0, 0x1b, 0x0b, 0xbc,
279 0xa3620022, 0x93630022, 0x3c020800, 0x8c440098, 0x0064182b, 0x14600027, 279 0xa9, 0xaf, 0xd5, 0x70, 0x8e, 0xe2, 0x87, 0x1f, 0xe2, 0x18, 0x91, 0x73,
280 0x3c020800, 0x3c029000, 0x34420001, 0x02821025, 0xaf420020, 0x3c038000, 280 0xd9, 0x18, 0xe5, 0x62, 0x45, 0xc4, 0x6a, 0x91, 0xd9, 0xd9, 0x4a, 0x8e,
281 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 0x9362007d, 0x3c038000, 281 0xf5, 0x35, 0x69, 0xbb, 0x6b, 0xe2, 0x22, 0x7a, 0xbc, 0x78, 0x09, 0xf8,
282 0x34420001, 0xa362007d, 0x8f640074, 0x34630001, 0x02831825, 0xaf430020, 282 0x73, 0xbc, 0xa5, 0x49, 0x1b, 0xc1, 0xfd, 0xe3, 0x12, 0x47, 0x7e, 0xe7,
283 0x04810006, 0x3c038000, 0x02802021, 0x0e000470, 0x24050273, 0x0a0005f2, 283 0x3a, 0x1e, 0x7c, 0x69, 0xf1, 0x47, 0xe0, 0x15, 0xc7, 0x7d, 0x51, 0x27,
284 0x24050001, 0x8f4201f8, 0x00431024, 0x1440fffd, 0x24020002, 0x3c031000, 284 0xde, 0xab, 0x89, 0xa9, 0xd7, 0xf8, 0xc9, 0xe2, 0x78, 0x89, 0x61, 0x74,
285 0xaf5401c0, 0xa34201c4, 0xaf4301f8, 0x24050001, 0x24020001, 0xa7620012, 285 0x19, 0x2f, 0x05, 0x64, 0x5e, 0x63, 0xc8, 0x3c, 0x87, 0x63, 0x6d, 0xae,
286 0xa3600022, 0x0a0005fe, 0x2ca20001, 0x9743007a, 0x9444002a, 0x00002821, 286 0xb1, 0xd6, 0xc7, 0x50, 0x0b, 0x43, 0xc1, 0x6d, 0xcc, 0x13, 0x8e, 0xa1,
287 0x00641821, 0x3063fffe, 0xa7630012, 0x2ca20001, 0x00021023, 0x03c2f024, 287 0xda, 0x28, 0x39, 0xe3, 0xc4, 0x50, 0x4e, 0x9d, 0xcd, 0xcd, 0x71, 0x5c,
288 0x8fa20010, 0x10400004, 0x8fa30014, 0x0e0013c1, 0x00000000, 0x8fa30014, 288 0x5c, 0xd9, 0x0f, 0xef, 0xc0, 0x3e, 0x45, 0x9e, 0x14, 0x74, 0xea, 0x7f,
289 0x10600003, 0x00000000, 0x0e0010eb, 0x00000000, 0x13c0001f, 0x3c029000, 289 0x1a, 0xec, 0xf6, 0x51, 0xf4, 0x8f, 0xba, 0xfd, 0x9e, 0x5c, 0xc3, 0xc5,
290 0x34420001, 0x02821025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 290 0x85, 0x7d, 0xbd, 0x1b, 0xd3, 0xed, 0x96, 0x31, 0x1d, 0x62, 0x18, 0xdb,
291 0x1440fffd, 0x00000000, 0x9362007d, 0x3c038000, 0xa362007d, 0x8f640074, 291 0xc9, 0xbb, 0xf6, 0x16, 0x33, 0xe8, 0xe3, 0x75, 0x11, 0x1b, 0x12, 0xc7,
292 0x34630001, 0x02831825, 0xaf430020, 0x04810006, 0x3c038000, 0x02802021, 292 0x49, 0x90, 0xaf, 0xfd, 0x91, 0x50, 0x58, 0xad, 0xc7, 0xab, 0x75, 0xa1,
293 0x0e000470, 0x2405036c, 0x0a00062b, 0x8fa20018, 0x8f4201f8, 0x00431024, 293 0x16, 0xaf, 0x41, 0xf1, 0xdd, 0xf8, 0x92, 0xef, 0x48, 0xc4, 0x92, 0xe3,
294 0x1440fffd, 0x24020002, 0x3c031000, 0xaf5401c0, 0xa34201c4, 0xaf4301f8, 294 0xf6, 0x10, 0xe8, 0xc5, 0xf8, 0xb9, 0xba, 0xe1, 0xc6, 0xc9, 0x8c, 0xd3,
295 0x8fa20018, 0x5040002f, 0x96a20008, 0x8f620048, 0x8f630024, 0x00761821, 295 0x3f, 0x82, 0xc6, 0xbb, 0x15, 0xfe, 0x7e, 0xcc, 0xde, 0x2f, 0xe8, 0x96,
296 0xaf630048, 0x9764003c, 0x00501023, 0x0044102b, 0x10400025, 0x3c029000, 296 0x15, 0xb8, 0x0e, 0x7b, 0x70, 0x1d, 0x91, 0xb8, 0xb2, 0x2e, 0xb0, 0x7e,
297 0x34420001, 0x3c040800, 0x8c830080, 0x8f450100, 0x3c068000, 0x24630001, 297 0x78, 0x6b, 0x9a, 0xa6, 0xd8, 0x1b, 0x70, 0x0e, 0xf3, 0xb9, 0xb9, 0x6a,
298 0x00a21025, 0xac830080, 0xaf420020, 0x8f420020, 0x00461024, 0x1440fffd, 298 0x2d, 0x0c, 0xf9, 0xb6, 0xc1, 0x1f, 0x02, 0xd7, 0xac, 0x88, 0x43, 0x03,
299 0x00000000, 0x9362007d, 0x3c038000, 0x34420004, 0xa362007d, 0x8f640074, 299 0x0b, 0xf5, 0x34, 0x1c, 0xc7, 0x5a, 0x88, 0xdb, 0x81, 0x8f, 0xcb, 0xf3,
300 0x34630001, 0x00a31825, 0xaf430020, 0x04810006, 0x3c038000, 0x00a02021, 300 0x26, 0x89, 0xcf, 0x37, 0xc5, 0xdc, 0x63, 0xa2, 0x06, 0xea, 0xd3, 0x39,
301 0x0e000470, 0x2405038a, 0x0a00065b, 0x96a20008, 0x8f4201f8, 0x00431024, 301 0x77, 0xc9, 0x0a, 0xde, 0x69, 0x92, 0x77, 0x8f, 0x56, 0xf0, 0x73, 0x78,
302 0x1440fffd, 0x24020002, 0x3c031000, 0xaf4501c0, 0xa34201c4, 0xaf4301f8, 302 0x1c, 0x90, 0x74, 0xe5, 0xdc, 0x95, 0x75, 0x5a, 0xf0, 0xa7, 0x9d, 0x73,
303 0x96a20008, 0x8fbf0044, 0x8fbe0040, 0x8fb7003c, 0x8fb60038, 0x8fb50034, 303 0xd3, 0x41, 0x6a, 0x14, 0x23, 0x2f, 0x0c, 0xa9, 0xdb, 0x1c, 0x3a, 0x3a,
304 0x8fb40030, 0x8fb3002c, 0x8fb20028, 0x8fb10024, 0x8fb00020, 0x00021042, 304 0x31, 0xf2, 0xda, 0xba, 0x18, 0xf9, 0xb6, 0x20, 0xc7, 0x5a, 0xc3, 0x50,
305 0x30420001, 0x03e00008, 0x27bd0048, 0x27bdffe0, 0xafbf0018, 0x97420108, 305 0x82, 0x79, 0xf8, 0xba, 0x97, 0x6d, 0xc8, 0x36, 0x70, 0x3d, 0x5f, 0x53,
306 0x24030019, 0x304400ff, 0x10830065, 0x2882001a, 0x1040001a, 0x2882000a, 306 0xbb, 0xec, 0x59, 0xa6, 0xd6, 0x1c, 0x20, 0xdf, 0x0c, 0xfb, 0x0e, 0x0b,
307 0x1040000f, 0x28820008, 0x10400040, 0x24020001, 0x1082003a, 0x28820002, 307 0x79, 0x06, 0x91, 0x36, 0xc9, 0x3a, 0xcb, 0xbe, 0xbd, 0x1a, 0x67, 0xcf,
308 0x50400005, 0x24020006, 0x10800032, 0x3c026000, 0x0a0006fb, 0x00000000, 308 0x51, 0xa3, 0x18, 0xfb, 0x46, 0xfd, 0xfa, 0x79, 0xbf, 0xdf, 0x3a, 0xac,
309 0x1082003d, 0x00000000, 0x0a0006fb, 0x00000000, 0x2402000b, 0x10820044, 309 0x3b, 0x36, 0x73, 0x25, 0xbf, 0xee, 0xc2, 0xed, 0x41, 0x9c, 0xad, 0x50,
310 0x2882000b, 0x1440004b, 0x2402000e, 0x10820045, 0x00000000, 0x0a0006fb, 310 0x93, 0x55, 0xc0, 0xfe, 0xde, 0xf0, 0x37, 0x5b, 0xae, 0x2e, 0x06, 0x68,
311 0x00000000, 0x24020020, 0x10820062, 0x28820021, 0x1040000e, 0x2402001c, 311 0xfd, 0xcc, 0x2d, 0x42, 0x1f, 0x8d, 0xc9, 0xaa, 0x3e, 0x8e, 0x82, 0x37,
312 0x1082004c, 0x2882001d, 0x10400005, 0x2402001b, 0x10820043, 0x00000000, 312 0x19, 0xa7, 0x06, 0x60, 0xae, 0xa7, 0xeb, 0xd7, 0x0b, 0xc6, 0xed, 0x37,
313 0x0a0006fb, 0x00000000, 0x2402001f, 0x10820050, 0x00000000, 0x0a0006fb, 313 0xfd, 0xaa, 0xe5, 0xca, 0xc0, 0xf5, 0xf2, 0x91, 0x4f, 0xd5, 0xd1, 0xba,
314 0x00000000, 0x240200c1, 0x10820042, 0x288200c2, 0x10400005, 0x24020080, 314 0x51, 0x4d, 0xf8, 0x2c, 0xe8, 0x1a, 0x47, 0xde, 0x1d, 0x79, 0x81, 0x10,
315 0x10820021, 0x00000000, 0x0a0006fb, 0x00000000, 0x240200c2, 0x1082003d, 315 0x3b, 0x39, 0x79, 0x78, 0x1a, 0xb9, 0x77, 0xe4, 0x02, 0xe7, 0xe3, 0x6e,
316 0x240200c9, 0x50820049, 0xafa00010, 0x0a0006fb, 0x00000000, 0x0e001163, 316 0x7e, 0xfe, 0x6a, 0x29, 0x72, 0x36, 0x8f, 0x9c, 0x79, 0x1e, 0x39, 0xf9,
317 0xac400808, 0x0a0006fd, 0x8fbf0018, 0x3c026000, 0x8c444448, 0x3c030800, 317 0xcb, 0xc8, 0xc9, 0xcf, 0x97, 0x7a, 0x41, 0xff, 0x1e, 0x99, 0x8f, 0xb3,
318 0xac640064, 0x0e001163, 0x00000000, 0x3c026000, 0x8c444448, 0x3c030800, 318 0x8e, 0x99, 0x74, 0x11, 0xb9, 0xd3, 0x77, 0x67, 0xd8, 0x46, 0x74, 0xd1,
319 0x0a0006fc, 0xac640068, 0x8f440100, 0x0e0006ff, 0x00000000, 0x3c026000, 319 0x3d, 0xc8, 0x35, 0xbe, 0x3f, 0xa9, 0x68, 0x9d, 0x7d, 0x01, 0x5f, 0xc2,
320 0x8c444448, 0x3c030800, 0x0a0006fc, 0xac64006c, 0x0e001191, 0x00000000, 320 0xb8, 0x91, 0x38, 0x71, 0x29, 0x4f, 0x1a, 0xc7, 0x8a, 0x23, 0x4d, 0x7e,
321 0x0a0006fd, 0x8fbf0018, 0x8f440100, 0x0e0011bb, 0x00000000, 0x0a0006fd, 321 0x6b, 0xae, 0x95, 0x5a, 0xf6, 0x2c, 0xcb, 0x93, 0x6a, 0xac, 0xe8, 0xc2,
322 0x8fbf0018, 0x0e001202, 0x00000000, 0x0a0006fd, 0x8fbf0018, 0x0000000d, 322 0x19, 0xd4, 0xd9, 0xf7, 0x87, 0x9c, 0xdb, 0xc4, 0x48, 0xe4, 0xd3, 0xeb,
323 0x0a0006fd, 0x8fbf0018, 0x0e000826, 0x00000000, 0x0a0006fd, 0x8fbf0018, 323 0xe8, 0xed, 0x93, 0x65, 0xda, 0x19, 0xbb, 0x56, 0xbe, 0x68, 0xad, 0xa3,
324 0x8f440100, 0x0e001264, 0x00000000, 0x0a0006fd, 0x8fbf0018, 0x0e00134e, 324 0x6c, 0xef, 0x43, 0x32, 0x97, 0x5c, 0x78, 0x28, 0x69, 0xe5, 0x43, 0x3e,
325 0x00000000, 0x0a0006fd, 0x8fbf0018, 0x0e00087c, 0x27440100, 0x0a0006fd, 325 0xf7, 0x7c, 0x62, 0x42, 0x47, 0x84, 0xc8, 0xbf, 0x20, 0xcd, 0x0d, 0x20,
326 0x8fbf0018, 0x8f640040, 0x0e000fae, 0x00000000, 0x0a0006fd, 0x8fbf0018, 326 0x71, 0x6e, 0xd9, 0xfe, 0x02, 0x1f, 0x10, 0xb1, 0x6d, 0x9c, 0x33, 0x03,
327 0x8f440100, 0x0e001059, 0x00000000, 0x0a0006fd, 0x8fbf0018, 0x0e001417, 327 0xa2, 0xd6, 0xb6, 0xd1, 0xe2, 0x7e, 0x03, 0xfc, 0xbe, 0x8f, 0xe6, 0x90,
328 0x00000000, 0x0a0006fd, 0x8fbf0018, 0xafa00014, 0x8f440100, 0x8f450118, 328 0x43, 0x14, 0x44, 0x1e, 0xde, 0x0e, 0x78, 0x37, 0x0f, 0xbf, 0x1f, 0xb9,
329 0x8f46011c, 0x0e001439, 0x8f470120, 0x0a0006fd, 0x8fbf0018, 0x0000000d, 329 0x01, 0xd3, 0xd8, 0x04, 0xfc, 0x6f, 0x03, 0xc6, 0x6b, 0x43, 0x9f, 0x6b,
330 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x27bdffe8, 0xafbf0010, 0x9742010c, 330 0x22, 0xf1, 0x3d, 0x8f, 0xb7, 0x13, 0xd7, 0x65, 0xab, 0xf3, 0xf2, 0x9c,
331 0x1440005e, 0x00803821, 0x3c029000, 0x34420001, 0x00e21025, 0xaf420020, 331 0x3c, 0xf6, 0x61, 0xf9, 0xf6, 0xbe, 0x3e, 0xcf, 0xdc, 0x6d, 0x9e, 0xb9,
332 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 0x93620023, 332 0xef, 0xf0, 0xcc, 0xed, 0xc3, 0xb7, 0x2e, 0x3e, 0x41, 0x7c, 0xeb, 0xae,
333 0x30420010, 0x14400026, 0x3c030800, 0x8f630074, 0x3c027fff, 0x3442ffff, 333 0xf1, 0xb7, 0x9e, 0x35, 0x5c, 0xdc, 0xdb, 0x3d, 0xb8, 0xbf, 0x8f, 0xf9,
334 0x00621824, 0xaf630074, 0x93620005, 0x34420001, 0xa3620005, 0x8f63004c, 334 0xb9, 0xcf, 0xf4, 0xf4, 0xf1, 0x9a, 0x1b, 0x68, 0x6e, 0xb0, 0x8d, 0x16,
335 0x8f620054, 0x10620021, 0x24040001, 0x9762006a, 0x00022880, 0x50a00001, 335 0x4f, 0x72, 0x5f, 0xd0, 0x83, 0x0b, 0xe3, 0x17, 0x90, 0x63, 0x6d, 0x74,
336 0x24050001, 0x97630068, 0x93640081, 0x3c020800, 0x8c46004c, 0x00652821, 336 0xf1, 0x64, 0x8b, 0xc0, 0x9b, 0xfd, 0xf9, 0xc6, 0xca, 0x9a, 0x57, 0xb0,
337 0x00852804, 0x00c5102b, 0x54400001, 0x00a03021, 0x3c020800, 0x8c440050, 337 0xa6, 0x3b, 0x97, 0x89, 0x6f, 0x19, 0x96, 0xf1, 0xe3, 0x31, 0xee, 0xe3,
338 0x00c4182b, 0x54600001, 0x00c02021, 0x8f420074, 0x2403fffe, 0x00832824, 338 0xb1, 0x37, 0xcb, 0x5f, 0x33, 0x82, 0xce, 0x9e, 0x0d, 0xc6, 0xcd, 0xfd,
339 0x00a21021, 0xaf62000c, 0x0a00073d, 0x24040001, 0x8c6200a8, 0x00002021, 339 0x56, 0x6b, 0x26, 0x8b, 0xdb, 0x9d, 0x34, 0x1b, 0xd4, 0xc0, 0x37, 0x55,
340 0x24420001, 0xac6200a8, 0x0000000d, 0x00000000, 0x2400044d, 0x3c028000, 340 0xfa, 0x28, 0xae, 0x23, 0xa8, 0x4a, 0xb4, 0x8f, 0xf9, 0xbc, 0x4e, 0xd6,
341 0x34420001, 0x00e21025, 0xaf420020, 0x1080001f, 0x3c029000, 0x34420001, 341 0xaf, 0x5b, 0x30, 0x6f, 0xd8, 0xcd, 0xd1, 0x88, 0xe5, 0x38, 0x27, 0xec,
342 0x00e21025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, 342 0xbe, 0x26, 0xc7, 0xd9, 0xee, 0xb3, 0xdf, 0xc7, 0x53, 0xc8, 0xaa, 0x3c,
343 0x00000000, 0x9362007d, 0x3c038000, 0xa362007d, 0x8f640074, 0x34630001, 343 0xaf, 0x29, 0xed, 0xa0, 0x83, 0x50, 0xcf, 0x8b, 0xb2, 0x9e, 0xb2, 0xe8,
344 0x00e31825, 0xaf430020, 0x04810006, 0x3c038000, 0x00e02021, 0x0e000470, 344 0xad, 0x99, 0x18, 0x4e, 0x1c, 0xe3, 0x9c, 0xed, 0xac, 0x85, 0xfe, 0xe0,
345 0x24050455, 0x0a000761, 0x00000000, 0x8f4201f8, 0x00431024, 0x1440fffd, 345 0xbd, 0x98, 0x00, 0x1e, 0x61, 0x8a, 0xe2, 0xaf, 0x50, 0xca, 0xe3, 0x69,
346 0x24020002, 0x3c031000, 0xaf4701c0, 0xa34201c4, 0xaf4301f8, 0x0e001163, 346 0xe1, 0xa9, 0xe0, 0xc9, 0xf5, 0x0c, 0x1d, 0x4f, 0xe8, 0x18, 0xec, 0x53,
347 0x00000000, 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x27bdffd8, 0xafbf0024, 347 0xb4, 0xef, 0x92, 0x93, 0x3f, 0x41, 0x37, 0xde, 0x9e, 0x74, 0xea, 0x51,
348 0xafb40020, 0xafb3001c, 0xafb20018, 0xafb10014, 0xafb00010, 0x93630005, 348 0x8b, 0xd6, 0x72, 0xf5, 0xa8, 0x3f, 0x67, 0x9e, 0x9c, 0x70, 0xeb, 0x51,
349 0x00809821, 0x24020030, 0x30630030, 0x146200ac, 0x00a0a021, 0x3c020800, 349 0x8b, 0x24, 0xea, 0x51, 0x27, 0x56, 0xa8, 0x47, 0x25, 0x56, 0x5f, 0x8f,
350 0x8c430020, 0x106000a6, 0x00000000, 0x0e00148e, 0x00000000, 0x8f830018, 350 0xe2, 0xf9, 0x35, 0xda, 0xd7, 0x4f, 0xca, 0x17, 0x64, 0x3d, 0xea, 0x3d,
351 0xac730000, 0x936200c4, 0x30420002, 0x10400004, 0x24020001, 0x8f830018, 351 0x72, 0xea, 0x51, 0x17, 0xa9, 0x71, 0x3d, 0xea, 0x78, 0x5d, 0x3d, 0x2a,
352 0x0a000784, 0x00000000, 0x8f830018, 0x24020003, 0xac620004, 0x8f6200dc, 352 0x28, 0xea, 0x51, 0x3c, 0x8f, 0x53, 0x8f, 0x12, 0xed, 0xbe, 0x88, 0xa7,
353 0x8f630040, 0x00431023, 0x18400004, 0x00000000, 0x0000000d, 0x00000000, 353 0xee, 0x42, 0xf4, 0xee, 0x64, 0x07, 0x68, 0x66, 0xd0, 0xf7, 0x1a, 0xda,
354 0x24000509, 0x8f840018, 0x8f6200dc, 0xac820008, 0x8f830018, 0xac60000c, 354 0x34, 0x45, 0xc8, 0xdb, 0x4a, 0x35, 0xd0, 0x07, 0x6e, 0xb8, 0xbe, 0xa2,
355 0x8f820018, 0xac400010, 0x8f830018, 0x8f62004c, 0x3c100800, 0xac620014, 355 0xd0, 0x06, 0xcc, 0x9b, 0xec, 0x7b, 0xd8, 0x53, 0x63, 0x61, 0x9a, 0xff,
356 0x8f850018, 0x3c026000, 0x8c434448, 0x261258c0, 0x00002021, 0xaca30018, 356 0x62, 0xea, 0x2c, 0x07, 0x45, 0x9d, 0xe5, 0x87, 0x6b, 0xbc, 0x75, 0x96,
357 0x9642000e, 0x8f850018, 0x3c034010, 0x00431025, 0x0e0014cc, 0xaca2001c, 357 0x45, 0xba, 0x7e, 0x9d, 0xe5, 0x60, 0x83, 0x3a, 0xcb, 0x5b, 0x54, 0xad,
358 0x8f830018, 0xac730000, 0x9362003e, 0x9363003f, 0x8f840018, 0x00021200, 358 0xb3, 0xbc, 0x45, 0xd5, 0x3a, 0xcb, 0xc1, 0x12, 0xe7, 0xe2, 0x3e, 0x89,
359 0x00621825, 0xac830004, 0x93620081, 0x93630082, 0x8f840018, 0x00021600, 359 0x5f, 0x06, 0xed, 0x41, 0xf1, 0xc7, 0xb5, 0x97, 0xc5, 0xca, 0x1e, 0x7e,
360 0x00031c00, 0x00431025, 0xac820008, 0x8f830018, 0x8f620040, 0xac62000c, 360 0xd9, 0x6a, 0x2f, 0x6c, 0x03, 0x22, 0x17, 0x2e, 0xd7, 0xd4, 0x5e, 0xb8,
361 0x8f840018, 0x8f620048, 0xac820010, 0x8f71004c, 0x8f820018, 0xac510014, 361 0x0d, 0x9d, 0xb1, 0xd7, 0x08, 0x19, 0x99, 0x83, 0x7f, 0x5f, 0x9c, 0x0c,
362 0x8f620050, 0x8f850018, 0x00401821, 0x02221023, 0x5c400001, 0x02201821, 362 0x61, 0xce, 0x0e, 0xf8, 0x8c, 0x0e, 0xe4, 0x06, 0x61, 0xb4, 0x15, 0xda,
363 0x00002021, 0xaca30018, 0x9642000e, 0x8f850018, 0x3c03c00b, 0x00431025, 363 0x64, 0x0d, 0xa1, 0x8f, 0xc7, 0xd9, 0x0e, 0x43, 0xb7, 0x6c, 0x77, 0x7f,
364 0x0e0014cc, 0xaca2001c, 0x8f620054, 0x8f840018, 0x00401821, 0x02221023, 364 0x0f, 0x48, 0x1a, 0x44, 0x68, 0xb8, 0x9d, 0xf4, 0x20, 0xfb, 0x8e, 0xc9,
365 0x5c400001, 0x02201821, 0xac830000, 0x8f840018, 0x8f630058, 0xac830004, 365 0x3d, 0x74, 0xc8, 0xde, 0x22, 0xf6, 0xbd, 0xc1, 0xaa, 0x95, 0xb9, 0xc1,
366 0x93620023, 0x30420010, 0x10400004, 0x00000000, 0x8f830018, 0x0a0007dd, 366 0x1b, 0x90, 0xb9, 0xcc, 0xaa, 0x65, 0x8e, 0xe5, 0xcd, 0x39, 0xf7, 0xdd,
367 0x8f620148, 0x8f830018, 0x8f62005c, 0xac620008, 0x8f830018, 0x8f620060, 367 0x60, 0xf1, 0xfa, 0x1d, 0x02, 0xa7, 0x77, 0x1b, 0xc8, 0xfb, 0x18, 0xec,
368 0xac62000c, 0x8f840018, 0x8f620064, 0xac820010, 0x97630068, 0x9762006a, 368 0x8e, 0x33, 0xbf, 0x2e, 0xd7, 0xab, 0x8f, 0x87, 0x9f, 0x6d, 0x66, 0xff,
369 0x8f840018, 0x00031c00, 0x00431025, 0xac820014, 0x8f850018, 0x00002021, 369 0xbd, 0x72, 0x3d, 0xb1, 0xde, 0x7f, 0xaf, 0xe4, 0x47, 0x15, 0x61, 0x93,
370 0x2402ffff, 0x260358c0, 0xaca20018, 0x9462000e, 0x8f850018, 0x3c03c00c, 370 0xb3, 0x25, 0xae, 0xed, 0x7b, 0xf9, 0x33, 0x8f, 0x9c, 0x00, 0x7d, 0x42,
371 0x00431025, 0x0e0014cc, 0xaca2001c, 0x8f840018, 0x8f630018, 0xac830000, 371 0x0f, 0x98, 0xae, 0x41, 0xf0, 0x01, 0xeb, 0xd8, 0x4f, 0xc9, 0x5a, 0x16,
372 0x936200c4, 0x30420002, 0x10400006, 0x00000000, 0x976200c8, 0x8f830018, 372 0x9e, 0x05, 0x97, 0x7f, 0xad, 0xb0, 0x99, 0xee, 0x18, 0xdb, 0x01, 0x0b,
373 0x3042ffff, 0x0a000803, 0xac620004, 0x8f820018, 0xac400004, 0x8f830018, 373 0xfe, 0x8f, 0xeb, 0x28, 0x7c, 0x8e, 0xca, 0xfd, 0x2e, 0x5f, 0xbb, 0x2e,
374 0x8f62006c, 0xac620008, 0x8f840018, 0x8f6200dc, 0xac82000c, 0x8f830018, 374 0xbc, 0xa7, 0x72, 0xbb, 0x5c, 0xce, 0x8a, 0x7a, 0x2d, 0xa9, 0x9d, 0x7d,
375 0xac600010, 0x93620005, 0x8f830018, 0x00021600, 0x00541025, 0xac620014, 375 0xd3, 0x2d, 0x6c, 0x6b, 0xb6, 0x58, 0xae, 0xcc, 0x26, 0xf0, 0xce, 0x7c,
376 0x8f850018, 0x3c026000, 0x8c434448, 0x24040001, 0x260258c0, 0xaca30018, 376 0x7d, 0x17, 0x36, 0x9c, 0xcf, 0xaa, 0xbf, 0x23, 0x6a, 0x04, 0x73, 0x36,
377 0x9443000e, 0x8f850018, 0x3c02400d, 0x00621825, 0x0e0014cc, 0xaca3001c, 377 0xdb, 0x6b, 0x8e, 0x41, 0x7f, 0x0b, 0xb2, 0xc4, 0xef, 0x51, 0x71, 0x2e,
378 0x0e00122e, 0x02602021, 0x8fbf0024, 0x8fb40020, 0x8fb3001c, 0x8fb20018, 378 0x21, 0x6a, 0xf8, 0x83, 0xdc, 0x76, 0xed, 0x4a, 0x94, 0xed, 0x30, 0xf6,
379 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0028, 0x27bdffe0, 0xafb00010, 379 0x5c, 0xa5, 0x31, 0xe2, 0x23, 0xc8, 0x0c, 0xc7, 0xb1, 0x0c, 0xe7, 0xc6,
380 0x27500100, 0xafbf0018, 0xafb10014, 0x9603000c, 0x240200c1, 0x54620024, 380 0x9e, 0x9a, 0xa7, 0x66, 0xab, 0xcb, 0xb8, 0x88, 0x75, 0x39, 0x00, 0x9a,
381 0x8e040000, 0x3c029000, 0x8f450100, 0x34420001, 0x3c038000, 0x00a21025, 381 0xed, 0x10, 0x31, 0xea, 0xb8, 0x5d, 0xa6, 0xea, 0x19, 0x3f, 0xd3, 0xdc,
382 0xaf420020, 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 0x9362007d, 382 0x39, 0xe7, 0x3f, 0x66, 0x2f, 0x47, 0xfb, 0xcd, 0x37, 0x48, 0x7b, 0x47,
383 0x3c038000, 0x34420004, 0xa362007d, 0x8f640074, 0x34630001, 0x00a31825, 383 0x1f, 0x6b, 0xe9, 0xae, 0x23, 0x7e, 0x71, 0xe9, 0xee, 0xfa, 0xa8, 0x49,
384 0xaf430020, 0x04810006, 0x3c038000, 0x00a02021, 0x0e000470, 0x240505b2, 384 0x49, 0x83, 0xa8, 0xac, 0x2b, 0x7e, 0x5a, 0x9e, 0x29, 0xfd, 0x5f, 0xd8,
385 0x0a000878, 0x8fbf0018, 0x8f4201f8, 0x00431024, 0x1440fffd, 0x24020002, 385 0xaf, 0xe2, 0xd9, 0xaf, 0xab, 0xbb, 0xfb, 0xe4, 0x7e, 0xc3, 0x75, 0xba,
386 0x3c031000, 0xaf4501c0, 0xa34201c4, 0xaf4301f8, 0x0a000878, 0x8fbf0018, 386 0x1b, 0x97, 0x75, 0xb9, 0x5f, 0x84, 0xee, 0xba, 0x7b, 0xe2, 0xb5, 0xb7,
387 0x8f65004c, 0x24060001, 0x0e0012a3, 0x240705be, 0x3c020800, 0x8c430020, 387 0x5c, 0x67, 0xdd, 0x67, 0x48, 0x8d, 0xaf, 0x14, 0x7b, 0xff, 0xb4, 0xf9,
388 0x9611000c, 0x1060001d, 0x8e100000, 0x0e00148e, 0x00000000, 0x8f820018, 388 0xe3, 0xc5, 0xde, 0x1f, 0x87, 0x9e, 0x5e, 0xbd, 0x65, 0x1a, 0xb6, 0x89,
389 0xac500000, 0x8f840018, 0x00111400, 0xac820004, 0x8f830018, 0xac600008, 389 0xb8, 0xc2, 0xd1, 0x1f, 0xd8, 0xe3, 0x82, 0x9f, 0x16, 0x1e, 0xd2, 0xe9,
390 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010, 0x8f840018, 0x240205c1, 390 0x9f, 0xee, 0xe4, 0xfa, 0xac, 0x26, 0x73, 0x7c, 0x6e, 0x7f, 0xb1, 0x95,
391 0xac820014, 0x8f850018, 0x3c026000, 0x8c434448, 0x24040001, 0x3c020800, 391 0x63, 0xab, 0x4d, 0xd6, 0x77, 0x44, 0x6e, 0x95, 0x57, 0x4d, 0x8f, 0x1f,
392 0xaca30018, 0x944358ce, 0x8f850018, 0x3c024019, 0x00621825, 0x0e0014cc, 392 0x31, 0x30, 0xce, 0x63, 0x61, 0xba, 0x1c, 0xbc, 0x91, 0xb8, 0xbc, 0xcb,
393 0xaca3001c, 0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 393 0x58, 0xf4, 0xad, 0x26, 0x2e, 0xbf, 0x55, 0xf7, 0x5b, 0x7f, 0xdd, 0x7a,
394 0x27bdffb0, 0xafb5003c, 0x0000a821, 0xafbe0048, 0x0000f021, 0xafb70044, 394 0xbd, 0x3a, 0x47, 0x35, 0x2e, 0xe7, 0x7c, 0x3e, 0xe8, 0xd4, 0x18, 0x4c,
395 0x0000b821, 0xafb30034, 0x00009821, 0xafb60040, 0x0080b021, 0xafbf004c, 395 0x8e, 0xcf, 0xd7, 0x4a, 0x9e, 0xf0, 0x3b, 0x72, 0x11, 0x1b, 0x79, 0x08,
396 0xafb40038, 0xafb20030, 0xafb1002c, 0xafb00028, 0xafa00010, 0x8f620040, 396 0x64, 0xfc, 0x55, 0xc8, 0xca, 0x2b, 0x36, 0xf2, 0x0e, 0x1b, 0xf9, 0x88,
397 0x8ec30014, 0x96d1000c, 0x00431023, 0x04410025, 0x8ed40000, 0x32220401, 397 0x8d, 0xdc, 0xc3, 0x46, 0xee, 0x61, 0xf7, 0xc8, 0x1c, 0x26, 0x23, 0xeb,
398 0x1040030c, 0x3c029000, 0x34420001, 0x02821025, 0xaf420020, 0x3c038000, 398 0x56, 0x7c, 0x46, 0xcb, 0xf9, 0x61, 0x5e, 0xc9, 0xd8, 0xe3, 0x7c, 0x1f,
399 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 0x9362007d, 0x3c038000, 399 0x41, 0x4d, 0xc6, 0x36, 0xca, 0x78, 0xf0, 0x38, 0xdf, 0x77, 0x28, 0xab,
400 0x34420004, 0xa362007d, 0x8f640074, 0x34630001, 0x02831825, 0xaf430020, 400 0x71, 0xae, 0x45, 0x91, 0xaa, 0xc6, 0x6f, 0x87, 0x8f, 0xda, 0x0e, 0xbc,
401 0x04810006, 0x3c038000, 0x02802021, 0x0e000470, 0x24050664, 0x0a000ba2, 401 0x9a, 0x79, 0xdc, 0xa7, 0xc6, 0x5b, 0x99, 0x76, 0x8a, 0x1a, 0x5f, 0x2b,
402 0x8fbf004c, 0x8f4201f8, 0x00431024, 0x1440fffd, 0x24020002, 0x3c031000, 402 0xcf, 0x0d, 0x7a, 0x03, 0x0e, 0xfe, 0xdd, 0xdc, 0xd6, 0xd4, 0xf8, 0xdd,
403 0xaf5401c0, 0xa34201c4, 0xaf4301f8, 0x0a000ba2, 0x8fbf004c, 0x32220010, 403 0xec, 0xd3, 0xc2, 0xa4, 0xba, 0xfd, 0xb7, 0x07, 0x98, 0xae, 0xa4, 0xde,
404 0x1040006b, 0x00003021, 0x9362003f, 0x92c6000f, 0x304500ff, 0x24c3fff8, 404 0x16, 0xe0, 0xb8, 0x76, 0xde, 0xf6, 0x8b, 0x3b, 0x05, 0xc9, 0x18, 0xd7,
405 0x2c62000f, 0x10400057, 0x3c020800, 0x244257c0, 0x00031880, 0x00621821, 405 0xcc, 0xb8, 0x5d, 0xa5, 0xab, 0xba, 0x2c, 0x5d, 0xfd, 0x95, 0xfa, 0x3f,
406 0x8c640000, 0x00800008, 0x00000000, 0x38a20012, 0x0a000924, 0x0002a82b, 406 0xd3, 0xd2, 0xc7, 0x70, 0xa2, 0x36, 0xc6, 0x34, 0x75, 0xe7, 0xe3, 0xf3,
407 0x2402000e, 0x14a20004, 0x2402000c, 0x24150001, 0x0a000924, 0x24060010, 407 0x66, 0x5e, 0x47, 0xdc, 0x63, 0xc0, 0xf3, 0x60, 0x33, 0xb5, 0x0d, 0x0e,
408 0x10a20049, 0x38a30010, 0x2c630001, 0x38a20016, 0x2c420001, 0x00621825, 408 0xf9, 0x2d, 0xef, 0xba, 0x6c, 0x43, 0x76, 0x90, 0x37, 0xc7, 0x5a, 0x7e,
409 0x1460004d, 0x0000a821, 0x24020014, 0x10a2004a, 0x00000000, 0x0000000d, 409 0xcd, 0xa8, 0x38, 0x1b, 0x49, 0xf6, 0x47, 0x85, 0xec, 0xb0, 0xac, 0x69,
410 0x00000000, 0x2400069c, 0x0a000924, 0x0000a821, 0x24020016, 0x14a20005, 410 0xe2, 0xce, 0xd5, 0x47, 0xe2, 0x1e, 0x09, 0xcb, 0x19, 0xcb, 0xf2, 0x78,
411 0x2402000c, 0x24150001, 0x24060010, 0x0a000924, 0x3231fffd, 0x10a20032, 411 0x7f, 0x57, 0x58, 0x53, 0x5b, 0xb0, 0x46, 0x98, 0xd2, 0x25, 0x71, 0x56,
412 0x38a30010, 0x2c630001, 0x38a2000e, 0x2c420001, 0x00621825, 0x14600036, 412 0x80, 0x7c, 0xe9, 0xdc, 0x3a, 0x6a, 0xfb, 0x07, 0xbd, 0x9a, 0xc7, 0x46,
413 0x0000a821, 0x24020014, 0x14a20003, 0x24150001, 0x0a000924, 0x24060012, 413 0x9d, 0xb3, 0x7a, 0xbb, 0xde, 0xff, 0x8d, 0x8a, 0x73, 0x65, 0xc7, 0x06,
414 0x0000000d, 0x00000000, 0x240006bc, 0x0a000924, 0x0000a821, 0x2402000e, 414 0xb9, 0xe7, 0xc3, 0xab, 0x3b, 0xff, 0xbe, 0xbe, 0x3e, 0xb5, 0xd4, 0xd7,
415 0x14a20004, 0x24020016, 0x24150001, 0x0a000924, 0x3231fffb, 0x14a20004, 415 0x0d, 0x24, 0x0d, 0x98, 0x36, 0x8d, 0xcf, 0xee, 0xe7, 0x4b, 0x7c, 0xaf,
416 0x24020014, 0x24150001, 0x0a000924, 0x3231fffd, 0x54a20013, 0x92c2000e, 416 0x25, 0x12, 0xe3, 0xdc, 0x6d, 0x44, 0xdc, 0xf9, 0x50, 0x21, 0x85, 0x3a,
417 0x24150001, 0x24060012, 0x0a000924, 0x3231fffd, 0x2402000c, 0x54a2000c, 417 0x8d, 0x19, 0x9c, 0xf3, 0x85, 0x86, 0x7d, 0x71, 0xca, 0x64, 0x27, 0x48,
418 0x92c2000e, 0x92c3000e, 0x2402000a, 0x10620005, 0x24150001, 0x0000000d, 418 0x43, 0xac, 0x98, 0xa9, 0xd6, 0x03, 0x1f, 0x5c, 0x43, 0x96, 0x2b, 0x97,
419 0x00000000, 0x240006e8, 0x24150001, 0x0a000924, 0x24060014, 0x92c2000e, 419 0x51, 0xce, 0x1f, 0x6a, 0xce, 0xed, 0x16, 0xe9, 0xb0, 0x72, 0xa0, 0x74,
420 0x14a20003, 0x00000000, 0x0a000924, 0x24150001, 0x10a6ffc1, 0x24020012, 420 0x84, 0x0e, 0x34, 0x8c, 0x29, 0x1b, 0xd7, 0x03, 0x2f, 0xd6, 0xd5, 0x14,
421 0x10a20005, 0x0000a821, 0x0000000d, 0x00000000, 0x24000704, 0x0000a821, 421 0x16, 0x44, 0x4d, 0x21, 0xb7, 0xc6, 0x6f, 0x3d, 0x19, 0x70, 0xee, 0xb5,
422 0x12a00022, 0x32220004, 0x10400002, 0x24020001, 0xafa20010, 0x32230102, 422 0x34, 0xd6, 0x93, 0x5d, 0x15, 0x3d, 0x71, 0xe1, 0xf8, 0x2c, 0xbe, 0x8d,
423 0x24020002, 0x1462000f, 0x00000000, 0x92c2000a, 0x30420020, 0x1440000b, 423 0x76, 0x8a, 0xb5, 0x0e, 0x2b, 0x59, 0xbb, 0x95, 0x76, 0x1a, 0x0e, 0xd6,
424 0x00000000, 0x8f630048, 0x8f620040, 0x14620004, 0x00000000, 0x8f620048, 424 0xa3, 0x36, 0xe3, 0x75, 0x58, 0x39, 0x68, 0xe7, 0x95, 0xb4, 0xa8, 0x3d,
425 0x24420001, 0xaf620048, 0x8f620040, 0x24420001, 0xaf620040, 0xa366003f, 425 0x70, 0x8c, 0xbf, 0xe6, 0xda, 0x30, 0x95, 0xe9, 0xed, 0x98, 0xfb, 0x3d,
426 0x38c30012, 0x2c630001, 0x38c20010, 0x2c420001, 0x00621825, 0x10600005, 426 0xc3, 0x78, 0x6b, 0x8a, 0x2e, 0x9d, 0xf8, 0x2e, 0x51, 0x58, 0xe6, 0x6f,
427 0x3c030800, 0x8c620074, 0x24420001, 0x0e00140d, 0xac620074, 0x32220040, 427 0xce, 0x7c, 0xb9, 0x29, 0xae, 0x25, 0xde, 0x8f, 0xfd, 0x33, 0xfc, 0x6e,
428 0x32230020, 0xafa30020, 0x32230080, 0xafa30024, 0x32230001, 0xafa30018, 428 0x25, 0x39, 0x55, 0x2e, 0xa7, 0x31, 0x3e, 0xd6, 0x7b, 0xaf, 0xc8, 0x8d,
429 0x32230008, 0xafa3001c, 0x32230100, 0x104000c4, 0xafa30014, 0x8ec60010, 429 0xd4, 0x38, 0x0d, 0x71, 0x8e, 0xac, 0x2d, 0xc9, 0x91, 0xd3, 0xd0, 0x35,
430 0x8f630054, 0x24c2ffff, 0x00431023, 0x18400006, 0x00000000, 0x0000000d, 430 0xc4, 0x20, 0x76, 0x13, 0xbe, 0x75, 0xe3, 0x91, 0xcf, 0xae, 0x75, 0x64,
431 0x00000000, 0x2400015c, 0x0a000989, 0x00009021, 0x8f62004c, 0x00c21023, 431 0xe4, 0xbb, 0x12, 0x0f, 0x1e, 0xff, 0xfb, 0x80, 0x7b, 0x0f, 0x28, 0x77,
432 0x18400028, 0x00009021, 0x93650120, 0x93640121, 0x3c030800, 0x8c62008c, 432 0x2a, 0x8d, 0xfd, 0x37, 0x51, 0xca, 0x74, 0xf2, 0xbb, 0xec, 0x99, 0x23,
433 0x308400ff, 0x24420001, 0x30a500ff, 0x00804021, 0x1485000b, 0xac62008c, 433 0x1b, 0x6a, 0xe1, 0xd1, 0x77, 0xca, 0x85, 0x0f, 0xd6, 0xc1, 0xf3, 0x19,
434 0x3c040800, 0x8c830090, 0x24630001, 0xac830090, 0x93620122, 0x30420001, 434 0xd7, 0x5f, 0xd5, 0xc1, 0x07, 0x3d, 0xf0, 0x66, 0x1d, 0x3c, 0xe2, 0xae,
435 0x00021023, 0x30420005, 0x0a000989, 0x34520004, 0x27670100, 0x00041080, 435 0x33, 0xdf, 0xa8, 0x83, 0x37, 0x3d, 0xf0, 0xed, 0x75, 0xf0, 0xed, 0x80,
436 0x00e21021, 0x8c430000, 0x00c31823, 0x04600004, 0x24820001, 0x30440007, 436 0x7f, 0xa3, 0x0e, 0x1e, 0x7d, 0xa7, 0x90, 0x13, 0x08, 0xda, 0x70, 0x8c,
437 0x1485fff9, 0x00041080, 0x10880007, 0x3c030800, 0xa3640121, 0x8c620094, 437 0x74, 0x48, 0xe6, 0x89, 0x78, 0x2e, 0xb9, 0x1f, 0xc9, 0xf2, 0xd3, 0x01,
438 0x24120005, 0x24420001, 0x0a000989, 0xac620094, 0x24120004, 0x32420001, 438 0x1a, 0x7b, 0xeb, 0xb5, 0x09, 0xd8, 0xa8, 0xaa, 0x4c, 0x39, 0xfa, 0xea,
439 0x10400021, 0x3c020800, 0x8c430020, 0x8ed00000, 0x1060001c, 0x8ed30010, 439 0x95, 0x25, 0x96, 0xbd, 0x3c, 0xe4, 0x15, 0x7a, 0x54, 0x80, 0x3e, 0x15,
440 0x0e00148e, 0x00000000, 0x8f820018, 0xac500000, 0x8f840018, 0x24020001, 440 0x5c, 0x5f, 0xca, 0x77, 0xaa, 0x22, 0xc7, 0x1d, 0x3d, 0x56, 0x68, 0xbd,
441 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 441 0x35, 0x2f, 0x73, 0x91, 0xab, 0x8c, 0x3b, 0xfc, 0x86, 0xeb, 0x3b, 0xe8,
442 0xac600010, 0x8f820018, 0xac530014, 0x8f850018, 0x3c026000, 0x8c434448, 442 0x84, 0x63, 0x57, 0x58, 0xbf, 0x79, 0x7e, 0x69, 0x5f, 0x4a, 0x2c, 0x87,
443 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 0x3c024010, 443 0xce, 0x3a, 0xe9, 0x25, 0x32, 0x1b, 0x5e, 0x52, 0x77, 0xf1, 0xd5, 0xd9,
444 0x00621825, 0x0e0014cc, 0xaca3001c, 0x24130001, 0x32420004, 0x10400068, 444 0x77, 0x12, 0xf6, 0x3d, 0xd7, 0xe2, 0xb7, 0x36, 0xac, 0xbd, 0x9e, 0x7d,
445 0x00003821, 0x3c029000, 0x8ec60010, 0x34420001, 0x3c038000, 0x02821025, 445 0xcf, 0x78, 0xec, 0x7b, 0x38, 0x58, 0xf5, 0xf9, 0x8f, 0x09, 0x9f, 0xdf,
446 0xa360007c, 0xaf420020, 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 446 0xd1, 0xc0, 0x66, 0xac, 0xde, 0xe7, 0xef, 0xfd, 0xd8, 0x3e, 0x7f, 0xb9,
447 0x93620023, 0x30420080, 0x10400011, 0x00000000, 0x8f65005c, 0x8f63004c, 447 0x75, 0x57, 0xe3, 0xf3, 0x1f, 0x69, 0xf9, 0x78, 0x3e, 0x9f, 0xd7, 0xac,
448 0x9764003c, 0x8f620064, 0x00a32823, 0x00852821, 0x00a2102b, 0x54400006, 448 0xaf, 0x65, 0x7a, 0xcf, 0x59, 0x8e, 0xca, 0x18, 0x7b, 0xb7, 0x27, 0xc6,
449 0x3c023fff, 0x93620023, 0x3042007f, 0xa3620023, 0xaf660064, 0x3c023fff, 449 0x66, 0xfc, 0xbe, 0x27, 0xef, 0x02, 0x9e, 0x5e, 0xeb, 0xc8, 0xdb, 0x51,
450 0x0a0009da, 0x3442ffff, 0x8f62005c, 0x00c21023, 0x04400011, 0x00000000, 450 0x19, 0xa7, 0x73, 0xec, 0x8d, 0xf7, 0xc2, 0x23, 0x90, 0xd1, 0x7c, 0x8f,
451 0x8f65005c, 0x8f630064, 0x9764003c, 0x3c023fff, 0x3442ffff, 0xaf660064, 451 0x8f, 0x54, 0x9a, 0x35, 0x9d, 0xb3, 0xed, 0x9f, 0x6f, 0xae, 0x17, 0xa1,
452 0x00a32823, 0x00852821, 0x0045102b, 0x10400004, 0x00c51021, 0x3c053fff, 452 0xcb, 0xc2, 0x9f, 0x24, 0x3e, 0x81, 0x5a, 0xea, 0x49, 0xc8, 0x8f, 0xbb,
453 0x34a5ffff, 0x00c51021, 0xaf62005c, 0x24070001, 0xaf66004c, 0x8fa20010, 453 0xaf, 0x95, 0x6a, 0xa9, 0xf5, 0xe7, 0x1f, 0x7c, 0xee, 0x41, 0xca, 0x03,
454 0x10400003, 0x00000000, 0xaf660050, 0xaf660054, 0x8f620054, 0x14c20005, 454 0x95, 0x73, 0x10, 0xaf, 0x4e, 0xe9, 0x94, 0x9d, 0x21, 0xdd, 0x8c, 0x93,
455 0x00000000, 0x93620023, 0x30420040, 0x10400017, 0x24020001, 0x9762006a, 455 0xb2, 0x8f, 0x71, 0x8e, 0xfd, 0xb0, 0x52, 0x6f, 0x3f, 0x24, 0x6b, 0x30,
456 0x00022880, 0x50a00001, 0x24050001, 0x97630068, 0x93640081, 0x3c020800, 456 0xea, 0xb2, 0x77, 0x82, 0x7e, 0x02, 0x7c, 0x58, 0xaf, 0x9c, 0x1a, 0x8c,
457 0x8c46004c, 0x00652821, 0x00852804, 0x00c5102b, 0x54400001, 0x00a03021, 457 0xea, 0xdc, 0x09, 0x3a, 0xfe, 0xf3, 0xbb, 0x13, 0xc4, 0xf3, 0x6b, 0xb4,
458 0x3c020800, 0x8c440050, 0x00c4182b, 0x54600001, 0x00c02021, 0x8f420074, 458 0xb7, 0xc1, 0x9d, 0x20, 0xdf, 0x2a, 0xef, 0x04, 0xad, 0x17, 0x35, 0x18,
459 0x2403fffe, 0x00832824, 0x00a21021, 0xaf62000c, 0x93620082, 0x30420080, 459 0x9e, 0xc7, 0xa9, 0xc1, 0x70, 0xbb, 0xb3, 0x8f, 0xe5, 0x3a, 0x4c, 0xa3,
460 0x50400001, 0xa3600081, 0x3c028000, 0x34420001, 0x02821025, 0xaf420020, 460 0x93, 0xb7, 0x88, 0x7b, 0xa8, 0x9d, 0x7d, 0xb5, 0xf2, 0xbd, 0xef, 0x13,
461 0x9363007e, 0x9362007a, 0x10620005, 0x00e0b821, 0x0e0013c4, 0x00000000, 461 0x8d, 0xa5, 0x79, 0xbd, 0xa3, 0x0d, 0xef, 0xb6, 0x24, 0x3f, 0xc1, 0x9a,
462 0x00403821, 0x00e0b821, 0x8fa30020, 0x10600009, 0x8fa20010, 0x8ec20018, 462 0xcb, 0x21, 0x51, 0x73, 0xb9, 0xb3, 0xcd, 0x5b, 0x73, 0x51, 0x57, 0xb8,
463 0xaf620018, 0x8ec3001c, 0xaf63001c, 0x8ec20020, 0x24170001, 0xaf620058, 463 0xdb, 0x72, 0xa8, 0x41, 0xcd, 0xc5, 0xef, 0xb9, 0xdb, 0xe2, 0xf7, 0xdc,
464 0x8fa20010, 0x10400057, 0x8fa30024, 0x93620023, 0x30420040, 0x10400053, 464 0x6d, 0x39, 0x24, 0xeb, 0x2b, 0xea, 0x2f, 0xd1, 0xdd, 0x96, 0xe4, 0x8a,
465 0x00000000, 0x16600021, 0x3c120800, 0x8e420020, 0x8f70004c, 0x1040001e, 465 0x77, 0x5b, 0xb6, 0x4a, 0x7d, 0xf5, 0xc2, 0xaf, 0xfe, 0xbc, 0x32, 0x55,
466 0x24130001, 0x0e00148e, 0x00000000, 0x8f820018, 0xac540000, 0x8f840018, 466 0x67, 0xe7, 0x13, 0xc2, 0xce, 0xdf, 0xd5, 0xea, 0xb7, 0x9e, 0x69, 0xbb,
467 0x24020001, 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 467 0x9e, 0x9d, 0xdf, 0x57, 0xd1, 0x53, 0xbe, 0xa3, 0xcd, 0x77, 0xbe, 0x58,
468 0x8f830018, 0xac600010, 0x8f820018, 0xac500014, 0x8f850018, 0x3c026000, 468 0x16, 0xf9, 0x7c, 0xa6, 0x89, 0x72, 0x03, 0xbf, 0x2a, 0x68, 0xf6, 0x58,
469 0x8c434448, 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 469 0x6f, 0xed, 0x99, 0x63, 0xf5, 0x5e, 0xa4, 0xee, 0xb9, 0x17, 0x69, 0xa2,
470 0x3c024010, 0x00621825, 0xaca3001c, 0x0e0014cc, 0x24130001, 0x8e420020, 470 0x5f, 0xaf, 0xab, 0x87, 0x04, 0xe4, 0xdd, 0x7e, 0xf8, 0xc2, 0x19, 0x43,
471 0x1040001c, 0x8ed00000, 0x0e00148e, 0x00000000, 0x8f820018, 0xac500000, 471 0xda, 0x5e, 0xc4, 0x70, 0x98, 0xae, 0x50, 0xe4, 0x3b, 0x95, 0x6d, 0xe4,
472 0x8f830018, 0xac600004, 0x8f820018, 0xac400008, 0x8f830018, 0xac60000c, 472 0x9b, 0x71, 0xce, 0x4b, 0x54, 0x11, 0x63, 0x42, 0x8e, 0x8b, 0x7e, 0xe1,
473 0x8f820018, 0xac400010, 0x8f830018, 0x24020798, 0xac620014, 0x8f850018, 473 0x6f, 0xd4, 0xb8, 0x23, 0xb3, 0xe3, 0xf6, 0x05, 0xe0, 0xbf, 0x21, 0x51,
474 0x3c026000, 0x8c434448, 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 474 0x6d, 0x9b, 0x95, 0x5a, 0xce, 0x58, 0xe5, 0x0e, 0xbf, 0x09, 0xfb, 0xe0,
475 0x8f850018, 0x3c024019, 0x00621825, 0x0e0014cc, 0xaca3001c, 0x3c029000, 475 0xdc, 0x07, 0xca, 0x98, 0x7c, 0x67, 0xe4, 0x62, 0x5b, 0xf5, 0x3e, 0xd0,
476 0x34420001, 0x02821025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 476 0x67, 0xa4, 0x9c, 0x3a, 0xf7, 0x81, 0x48, 0x4d, 0x40, 0x3e, 0x6e, 0xe4,
477 0x1440fffd, 0x24020001, 0xaf62000c, 0x93630023, 0x3c028000, 0x34420001, 477 0x3e, 0x50, 0xd7, 0x92, 0xfb, 0x40, 0x2b, 0xf3, 0x66, 0xe9, 0x7d, 0xa0,
478 0x02821025, 0x306300bf, 0xa3630023, 0xaf420020, 0x8fa30024, 0x10600012, 478 0xc6, 0xfc, 0xe1, 0xfb, 0x40, 0xff, 0xde, 0xe6, 0xdc, 0x43, 0x5d, 0x89,
479 0x8fa30018, 0x9362007c, 0x24420001, 0xa362007c, 0x9363007e, 0x9362007a, 479 0x3f, 0x6e, 0x9c, 0xf4, 0x11, 0xe0, 0xf9, 0x3e, 0x50, 0xe5, 0x1e, 0x90,
480 0x1462000b, 0x8fa30018, 0x9362007c, 0x3c030800, 0x8c640024, 0x0044102b, 480 0xe7, 0x0e, 0x10, 0xdf, 0x25, 0x59, 0xee, 0x0c, 0xce, 0x7b, 0xff, 0xa4,
481 0x14400005, 0x8fa30018, 0x0e0013c4, 0x00000000, 0x02e2b825, 0x8fa30018, 481 0xa7, 0x72, 0xff, 0xe4, 0x7c, 0xc9, 0xf5, 0xed, 0xee, 0xb9, 0x1c, 0xc7,
482 0x3062ffff, 0x10400003, 0x32220200, 0x0a000a94, 0x241e0004, 0x10400003, 482 0x39, 0xbb, 0x44, 0x8e, 0x7a, 0xae, 0x54, 0x5b, 0xc3, 0x60, 0xbe, 0x8f,
483 0x00000000, 0x241e0040, 0x24170001, 0x12a000d0, 0x32220002, 0x104000cf, 483 0x16, 0xcf, 0x81, 0x3e, 0x6f, 0x89, 0xdc, 0x00, 0x7c, 0xde, 0xe2, 0x23,
484 0x8fa2001c, 0x92c2000a, 0x30420002, 0x5040003b, 0x92c2000a, 0x93620023, 484 0xe6, 0x1d, 0x29, 0xa0, 0x8b, 0x38, 0xcb, 0x75, 0xf8, 0xdd, 0x21, 0x64,
485 0x30420008, 0x54400037, 0x92c2000a, 0x3c020800, 0x8c430020, 0x10600023, 485 0xc1, 0x91, 0x8b, 0xdd, 0x9e, 0xf3, 0xd0, 0xaa, 0x1c, 0x38, 0x67, 0xba,
486 0x3c029000, 0x0e00148e, 0x00000000, 0x8f840018, 0x8ec30000, 0xac830000, 486 0x0e, 0xef, 0x6a, 0x65, 0x46, 0x9c, 0xdd, 0x0c, 0xed, 0xb5, 0x9c, 0xf3,
487 0x92c2000a, 0x8f830018, 0x00021600, 0xac620004, 0x8f840018, 0x8f620040, 487 0xc6, 0xa8, 0x38, 0xb7, 0x6d, 0xaf, 0xb3, 0x5b, 0x3a, 0xe4, 0x06, 0x31,
488 0xac820008, 0x8f850018, 0x8f63004c, 0xaca3000c, 0x9362003f, 0x8f840018, 488 0x67, 0x8c, 0xeb, 0xd5, 0x8c, 0xfb, 0x66, 0xc1, 0xe3, 0x46, 0x67, 0x71,
489 0x304200ff, 0xac820010, 0x8f830018, 0x3c026000, 0xac600014, 0x8f850018, 489 0x2b, 0xd7, 0xf1, 0xdc, 0x9a, 0x0a, 0x21, 0x97, 0xd8, 0x9d, 0xce, 0x09,
490 0x8c434448, 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 490 0xbb, 0xe9, 0xac, 0xdd, 0x29, 0xd6, 0xde, 0x58, 0x77, 0x96, 0xcd, 0x72,
491 0x3c02401a, 0x00621825, 0x0e0014cc, 0xaca3001c, 0x3c029000, 0x34420001, 491 0xb5, 0x5c, 0x4c, 0x70, 0x3d, 0x9a, 0xde, 0xb3, 0x84, 0xa6, 0xb5, 0xba,
492 0x02821025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, 492 0x84, 0xdc, 0xb5, 0x62, 0xe3, 0x3b, 0x2a, 0xba, 0x34, 0x2e, 0xee, 0x21,
493 0x00000000, 0x93630023, 0x3c028000, 0x34420001, 0x02821025, 0x34630008, 493 0xbb, 0xe7, 0xb5, 0x0e, 0xfd, 0xaa, 0xba, 0xb7, 0x5c, 0x3c, 0x53, 0x4f,
494 0xa3630023, 0xaf420020, 0x92c2000a, 0x30420020, 0x1040008e, 0x8fa2001c, 494 0xbf, 0x4d, 0xff, 0x4b, 0xe8, 0x77, 0x15, 0xf4, 0xe3, 0x77, 0x03, 0xef,
495 0x93620023, 0x30420001, 0x14400035, 0x3c020800, 0x8c430020, 0x10600023, 495 0xef, 0x8a, 0x7a, 0xc0, 0xb9, 0x52, 0xe4, 0x78, 0x9e, 0x38, 0x4e, 0x88,
496 0x3c029000, 0x0e00148e, 0x00000000, 0x8f840018, 0x8ec30000, 0xac830000, 496 0xcc, 0x2e, 0x50, 0x0f, 0xe8, 0xc8, 0xff, 0xeb, 0xe2, 0xde, 0x9d, 0x60,
497 0x92c2000a, 0x8f830018, 0x00021600, 0xac620004, 0x8f840018, 0x8f620040, 497 0xfa, 0xb2, 0x7d, 0x8f, 0xbc, 0x70, 0x99, 0xd8, 0xc6, 0xdf, 0x8d, 0x7d,
498 0xac820008, 0x8f850018, 0x8f63004c, 0xaca3000c, 0x9362003f, 0x8f840018, 498 0x94, 0xcb, 0x2f, 0xc5, 0x5c, 0xfa, 0xb3, 0xee, 0x73, 0x9d, 0xaa, 0x76,
499 0x304200ff, 0xac820010, 0x8f830018, 0x3c026000, 0xac600014, 0x8f850018, 499 0x5f, 0x7b, 0x57, 0xed, 0x53, 0x1d, 0xf9, 0xcc, 0x34, 0x90, 0xcf, 0x8c,
500 0x8c434448, 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 500 0xdc, 0xa3, 0x6f, 0xa6, 0x71, 0xbc, 0x9a, 0x9a, 0xfc, 0xef, 0x5e, 0xae,
501 0x3c02401a, 0x00621825, 0x0e0014cc, 0xaca3001c, 0x3c029000, 0x34420001, 501 0x26, 0xb6, 0x8d, 0x22, 0x0a, 0xbf, 0xac, 0xd7, 0x4e, 0xe3, 0xa4, 0x61,
502 0x02821025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, 502 0x93, 0x3a, 0xad, 0x69, 0xd2, 0x60, 0xc7, 0x4b, 0x12, 0x29, 0xa5, 0xa4,
503 0x00000000, 0x93630023, 0x3c028000, 0x34420001, 0x02821025, 0x34630001, 503 0x52, 0x55, 0x45, 0x60, 0xa9, 0x21, 0x4e, 0xda, 0x0a, 0x71, 0x70, 0x0b,
504 0xa3630023, 0xaf420020, 0x93620023, 0x30420040, 0x10400052, 0x8fa2001c, 504 0x48, 0x51, 0xc5, 0x21, 0x4d, 0xd3, 0x7b, 0x85, 0x84, 0x54, 0xa1, 0x8a,
505 0x16600020, 0x3c120800, 0x8e420020, 0x8f70004c, 0x1040003c, 0x3c029000, 505 0x46, 0x4e, 0x02, 0x15, 0x4a, 0xe5, 0x0a, 0x96, 0x72, 0x41, 0xa2, 0xd8,
506 0x0e00148e, 0x00000000, 0x8f820018, 0xac540000, 0x8f840018, 0x24020001, 506 0x8e, 0x02, 0x52, 0x2a, 0xf7, 0xca, 0x85, 0xba, 0xbf, 0x08, 0x89, 0x03,
507 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 507 0x70, 0x06, 0x29, 0x2a, 0x3f, 0xe2, 0xc0, 0x8d, 0x1b, 0x54, 0x5d, 0xde,
508 0xac600010, 0x8f820018, 0xac500014, 0x8f850018, 0x3c026000, 0x8c434448, 508 0x37, 0xb3, 0x63, 0xaf, 0x77, 0xd7, 0x8e, 0x03, 0x11, 0x07, 0x27, 0xbb,
509 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 0x3c024010, 509 0xf6, 0xcc, 0xce, 0xec, 0xcc, 0x37, 0x6f, 0xbe, 0xf7, 0x37, 0xfd, 0xbe,
510 0x00621825, 0x0e0014cc, 0xaca3001c, 0x8e420020, 0x1040001e, 0x3c029000, 510 0x78, 0x8d, 0x5a, 0xdb, 0x5b, 0xf3, 0x55, 0xec, 0xe7, 0xaf, 0x37, 0x18,
511 0x0e00148e, 0x00000000, 0x8f820018, 0xac540000, 0x8f840018, 0x3c02008d, 511 0x57, 0xed, 0xba, 0xe4, 0xa9, 0xf5, 0xe3, 0x9a, 0x72, 0xd9, 0x1b, 0xf0,
512 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 512 0xfe, 0xc7, 0x68, 0x51, 0xd8, 0x86, 0x94, 0xad, 0xee, 0xc5, 0x40, 0x9b,
513 0xac600010, 0x8f840018, 0x240207ee, 0xac820014, 0x8f850018, 0x3c026000, 513 0xd9, 0xff, 0x33, 0x16, 0x03, 0x3e, 0x9b, 0x68, 0xad, 0x6d, 0x8a, 0xed,
514 0x8c434448, 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 514 0x71, 0xd9, 0x16, 0xde, 0xda, 0xc2, 0xb6, 0x10, 0x3c, 0x16, 0xfd, 0x9e,
515 0x3c024019, 0x00621825, 0x0e0014cc, 0xaca3001c, 0x3c029000, 0x34420001, 515 0xb1, 0xa8, 0xc9, 0xea, 0xa1, 0x16, 0xed, 0x74, 0x88, 0x21, 0xbf, 0x9d,
516 0x02821025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, 516 0x67, 0x6c, 0x05, 0xca, 0xce, 0x4f, 0x5d, 0x36, 0x3c, 0xe0, 0x73, 0xdc,
517 0x00000000, 0x93630023, 0x3c028000, 0x34420001, 0x02821025, 0x306300bf, 517 0x59, 0xeb, 0xc0, 0x27, 0xb5, 0x9d, 0x1a, 0x51, 0xed, 0x01, 0x8f, 0xc9,
518 0xa3630023, 0xaf420020, 0x8fa2001c, 0x1040000e, 0x8fa20014, 0x92c2000a, 518 0xc5, 0x45, 0x82, 0xbe, 0x86, 0x36, 0xe3, 0x82, 0xe3, 0xfa, 0x39, 0x14,
519 0xa3620082, 0x57c00005, 0x37de0008, 0x8fa30014, 0x10600004, 0x00000000, 519 0x8f, 0xf1, 0xfa, 0x1b, 0x88, 0xe5, 0x70, 0xda, 0x3f, 0xd9, 0x76, 0xae,
520 0x37de0008, 0x0a000b75, 0x24170001, 0x0e0012cf, 0x02802021, 0x8fa20014, 520 0x9c, 0xe5, 0xbd, 0x42, 0xd4, 0x63, 0xbd, 0xef, 0x52, 0xdb, 0x82, 0xa8,
521 0x10400003, 0x00000000, 0x37de0010, 0x24170001, 0x12e00020, 0x3c029000, 521 0x27, 0xe3, 0x20, 0x1c, 0x1d, 0xd0, 0xe1, 0xe2, 0x8d, 0x74, 0x3f, 0xff,
522 0x34420001, 0x02821025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 522 0x9e, 0x13, 0xcc, 0xdd, 0x7f, 0xdd, 0x1d, 0x36, 0x3f, 0x34, 0x64, 0xae,
523 0x1440fffd, 0x00000000, 0x9362007d, 0x3c038000, 0x03c21025, 0xa362007d, 523 0xde, 0x56, 0xdc, 0x5d, 0xd9, 0x89, 0x06, 0x85, 0xaf, 0xc1, 0xad, 0x7b,
524 0x8f640074, 0x34630001, 0x02831825, 0xaf430020, 0x04810006, 0x3c038000, 524 0x41, 0x76, 0x5d, 0xe0, 0x3d, 0x7c, 0xa8, 0xba, 0x7f, 0xef, 0x84, 0x7d,
525 0x02802021, 0x0e000470, 0x2405082a, 0x0a000b9b, 0x00000000, 0x8f4201f8, 525 0xe8, 0x99, 0x16, 0x62, 0x1d, 0x44, 0x8e, 0xe5, 0x2b, 0x53, 0xc8, 0x45,
526 0x00431024, 0x1440fffd, 0x24020002, 0x3c031000, 0xaf5401c0, 0xa34201c4, 526 0xaa, 0xe6, 0xef, 0x78, 0xf3, 0x3c, 0x20, 0x3f, 0x55, 0x9e, 0x87, 0xca,
527 0xaf4301f8, 0x9363003f, 0x24020012, 0x14620004, 0x8fbf004c, 0x0e00140d, 527 0x23, 0xc5, 0x7b, 0x24, 0x02, 0xf2, 0x3c, 0xdc, 0x32, 0x18, 0xf5, 0xea,
528 0x00000000, 0x8fbf004c, 0x8fbe0048, 0x8fb70044, 0x8fb60040, 0x8fb5003c, 528 0xdf, 0xc3, 0x2d, 0x7f, 0x57, 0x1c, 0xf9, 0x5b, 0xf0, 0xd8, 0xe3, 0x97,
529 0x8fb40038, 0x8fb30034, 0x8fb20030, 0x8fb1002c, 0x8fb00028, 0x03e00008, 529 0xf3, 0x6a, 0x2d, 0x20, 0xe7, 0x43, 0xf1, 0x94, 0xde, 0x00, 0x9e, 0x12,
530 0x27bd0050, 0x27bdffe8, 0xafbf0014, 0xafb00010, 0x8f500180, 0x97420184, 530 0x9c, 0xeb, 0xa1, 0xa5, 0x2f, 0xf2, 0x5e, 0x7e, 0x08, 0x7b, 0xb9, 0x51,
531 0x30420200, 0x14400015, 0x00000000, 0x8f430188, 0x3c02ff00, 0x00621824, 531 0x8b, 0xe9, 0x95, 0x72, 0xf0, 0xdc, 0x3a, 0x64, 0xa2, 0xca, 0xb9, 0x81,
532 0x3c020200, 0x10620031, 0x0043102b, 0x14400007, 0x3c020300, 0x1060000b, 532 0x5c, 0x44, 0x2c, 0x3c, 0xe6, 0xba, 0xe4, 0x60, 0x11, 0xbf, 0xa9, 0x58,
533 0x3c020100, 0x1062000d, 0x00000000, 0x0a000c2c, 0x00000000, 0x10620027, 533 0x52, 0xa5, 0x47, 0xbd, 0x23, 0xf2, 0x0c, 0xbe, 0x1b, 0x3f, 0xcc, 0x1c,
534 0x3c020400, 0x1062003e, 0x02002021, 0x0a000c2c, 0x00000000, 0x0e000c31, 534 0x18, 0xf2, 0x13, 0x76, 0xa6, 0x43, 0x0e, 0x1f, 0xbe, 0xcc, 0xbf, 0x8d,
535 0x02002021, 0x0a000c2e, 0x8fbf0014, 0x93620005, 0x30420020, 0x1440005e, 535 0x39, 0xd7, 0x92, 0x8b, 0xca, 0x6b, 0xa5, 0x4b, 0xfd, 0xd0, 0x41, 0xe6,
536 0x8fbf0014, 0x3c029000, 0x34420001, 0x02021025, 0xaf420020, 0x3c038000, 536 0x6f, 0x0e, 0x2f, 0xad, 0xb3, 0x41, 0xc4, 0x53, 0xda, 0xdb, 0x74, 0xa1,
537 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 0x93620005, 0x3c038000, 537 0xd8, 0x0c, 0x83, 0xf5, 0xf8, 0x4b, 0x79, 0x38, 0x4f, 0x42, 0x70, 0x9e,
538 0x34630001, 0x02031825, 0x34420020, 0xa3620005, 0xaf430020, 0x93620005, 538 0x9f, 0x3a, 0xc2, 0xe6, 0x44, 0x4f, 0xb3, 0x38, 0x9c, 0x53, 0x55, 0xfc,
539 0x30420020, 0x14400003, 0x02002021, 0x0000000d, 0x02002021, 0x0e000766, 539 0xa9, 0x72, 0xaa, 0x6f, 0x8f, 0x3a, 0x10, 0xa7, 0xe6, 0xc7, 0x04, 0xe6,
540 0x24055854, 0x0a000c2e, 0x8fbf0014, 0x93620005, 0x30420001, 0x1040003f, 540 0x1f, 0xfa, 0x9c, 0x5a, 0x87, 0xd0, 0xeb, 0x10, 0xf3, 0x87, 0x76, 0x8d,
541 0x3c029000, 0x34420001, 0x02021025, 0xaf420020, 0x3c038000, 0x8f420020, 541 0x06, 0x6b, 0xb0, 0x66, 0x13, 0x2f, 0x50, 0x2b, 0xb1, 0x7f, 0xc9, 0xd1,
542 0x00431024, 0x1440fffd, 0x00000000, 0x93620023, 0x34420004, 0xa3620023, 542 0x0a, 0x9d, 0xed, 0x69, 0xa6, 0xf3, 0x9e, 0x08, 0xd4, 0x79, 0x83, 0x72,
543 0x93630005, 0x3c048000, 0x3c020800, 0x306300fe, 0xa3630005, 0x8c430020, 543 0xa4, 0xcc, 0x80, 0x1c, 0x29, 0x37, 0x0e, 0x75, 0x17, 0x0e, 0xe3, 0x2e,
544 0x34840001, 0x02042025, 0x0a000c0a, 0xaf440020, 0x00002821, 0x00003021, 544 0x2e, 0x30, 0xc0, 0xdc, 0xb9, 0x8b, 0xf1, 0x04, 0xee, 0x1c, 0xa5, 0xd0,
545 0x0e000fb1, 0x240708d9, 0x3c020800, 0x8c430020, 0x10600023, 0x8fbf0014, 545 0x07, 0x6e, 0xee, 0xec, 0xf7, 0x13, 0x49, 0x5c, 0xfe, 0xdb, 0xdc, 0xa9,
546 0x0e00148e, 0x00000000, 0x8f820018, 0xac500000, 0x93630082, 0x9362003f, 546 0xa0, 0x7e, 0x27, 0x7c, 0xfd, 0x86, 0x1c, 0x9f, 0x6c, 0xc8, 0x13, 0x82,
547 0x8f840018, 0x00031a00, 0x00431025, 0xac820004, 0x8f830018, 0xac600008, 547 0x38, 0xfe, 0x4e, 0xf7, 0xd3, 0xbb, 0xf6, 0xd1, 0xa6, 0x09, 0xfd, 0x70,
548 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010, 0x8f820018, 0xac400014, 548 0x74, 0xb1, 0xba, 0xee, 0x5f, 0xf0, 0xd9, 0xb9, 0xc1, 0x67, 0x43, 0xc2,
549 0x8f850018, 0x3c026000, 0x8c434448, 0x24040001, 0x3c020800, 0xaca30018, 549 0x27, 0xd7, 0x25, 0xf6, 0x90, 0x9d, 0x93, 0x61, 0x9d, 0x1e, 0x19, 0x66,
550 0x944358ce, 0x8f850018, 0x3c02400a, 0x00621825, 0x0e0014cc, 0xaca3001c, 550 0xf7, 0xd4, 0xec, 0xfc, 0x88, 0x21, 0xec, 0x73, 0x74, 0x0e, 0xb9, 0xef,
551 0x0a000c2e, 0x8fbf0014, 0x0000000d, 0x8fbf0014, 0x8fb00010, 0x03e00008, 551 0x14, 0x1a, 0xc6, 0xa5, 0xe2, 0x3b, 0xe9, 0x1b, 0x38, 0x77, 0x04, 0xb2,
552 0x27bd0018, 0x27bdffe8, 0xafbf0010, 0x8f420188, 0x00803021, 0x93640000, 552 0x1b, 0xf2, 0xfc, 0xf4, 0x6c, 0xd8, 0x34, 0x1c, 0x1f, 0x03, 0xfc, 0x08,
553 0x24030020, 0x00021402, 0x10830008, 0x304500ff, 0x3c036018, 0x8c625000, 553 0xc0, 0xa9, 0x7a, 0x7e, 0x90, 0x0d, 0x3d, 0x68, 0x0e, 0x87, 0x7c, 0x73,
554 0x34420400, 0xac625000, 0x0000000d, 0x00000000, 0x24000955, 0x9363003f, 554 0x28, 0xf1, 0x06, 0x6e, 0x8f, 0x58, 0xbc, 0x83, 0x9e, 0x38, 0xc5, 0x9d,
555 0x24020012, 0x14620023, 0x3c029000, 0x34420001, 0x3c038000, 0x00c21025, 555 0x18, 0x93, 0xee, 0x80, 0x78, 0x41, 0xc4, 0xfa, 0xf9, 0xfa, 0xcb, 0xef,
556 0xaf650178, 0xa365007a, 0xaf420020, 0x8f420020, 0x00431024, 0x1440fffd, 556 0x7c, 0x51, 0xf3, 0xaf, 0xad, 0x49, 0x6d, 0xba, 0x3c, 0xad, 0x4d, 0x15,
557 0x00000000, 0x9362007d, 0x3c038000, 0xa362007d, 0x8f640074, 0x34630001, 557 0x51, 0xee, 0xa2, 0x56, 0xdb, 0x97, 0x36, 0x5d, 0x1c, 0x11, 0x7c, 0x30,
558 0x00c31825, 0xaf430020, 0x04810006, 0x3c038000, 0x00c02021, 0x0e000470, 558 0x79, 0xad, 0x42, 0x78, 0x4f, 0xdb, 0xbe, 0x25, 0xb8, 0xed, 0x80, 0x0f,
559 0x24050963, 0x0a000c79, 0x8fbf0010, 0x8f4201f8, 0x00431024, 0x1440fffd, 559 0xab, 0x8a, 0x73, 0x18, 0x2d, 0xbc, 0x97, 0xb4, 0xbd, 0xb8, 0xb9, 0x8e,
560 0x24020002, 0x3c031000, 0xaf4601c0, 0xa34201c4, 0xaf4301f8, 0x0a000c79, 560 0x5b, 0xbe, 0x3f, 0x1d, 0x20, 0xdf, 0x9b, 0xd9, 0x0a, 0x91, 0xbf, 0x29,
561 0x8fbf0010, 0x9362007e, 0x1445000e, 0x00000000, 0x8f620178, 0x1045000b, 561 0xe2, 0xb2, 0xa9, 0x68, 0x21, 0xde, 0xf1, 0x30, 0xe2, 0x7b, 0xe1, 0xd7,
562 0x00000000, 0x8f820000, 0xaf650178, 0x8f660178, 0x8f440180, 0x8f65004c, 562 0xa8, 0x62, 0xe1, 0x6e, 0x30, 0x16, 0xaa, 0xf6, 0x60, 0x1d, 0xb9, 0xa3,
563 0x8c430000, 0x0060f809, 0x30c600ff, 0x0a000c79, 0x8fbf0010, 0xaf650178, 563 0x2c, 0x8b, 0xc3, 0xe9, 0x5e, 0x0a, 0x99, 0x28, 0xff, 0x6c, 0xe2, 0x3e,
564 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x27bdffe8, 0xafbf0010, 0x93630000, 564 0x1d, 0x73, 0x78, 0x09, 0xfc, 0x3c, 0xb2, 0xde, 0x4c, 0x0b, 0x76, 0xe1,
565 0x24020020, 0x10620005, 0x00000000, 0x93630000, 0x24020030, 0x1462004d, 565 0x60, 0x7f, 0x46, 0x84, 0x65, 0xf3, 0x67, 0xbd, 0xad, 0xf9, 0x33, 0x54,
566 0x8fbf0010, 0x93420148, 0x2444ffff, 0x2c830005, 0x10600047, 0x3c020800, 566 0x39, 0xd4, 0xed, 0xa2, 0x35, 0x0b, 0x71, 0x92, 0xf0, 0x2f, 0x75, 0x77,
567 0x24425800, 0x00041880, 0x00621821, 0x8c640000, 0x00800008, 0x00000000, 567 0xb4, 0x9b, 0x41, 0xf2, 0x4f, 0xc5, 0x7e, 0x82, 0x1f, 0xc9, 0xb9, 0xba,
568 0x8f430144, 0x8f62000c, 0x14620006, 0x24020001, 0xaf62000c, 0x0e000d59, 568 0x41, 0x98, 0x3b, 0x9b, 0xbe, 0x6f, 0x30, 0x57, 0xdb, 0xb1, 0x29, 0x37,
569 0x00000000, 0x0a000cd1, 0x8fbf0010, 0x8f62000c, 0x0a000cca, 0x00000000, 569 0x9f, 0x2b, 0xc3, 0x33, 0x57, 0xd8, 0x8b, 0x9a, 0xcd, 0x95, 0xf2, 0x43,
570 0x97630010, 0x8f420144, 0x14430006, 0x24020001, 0xa7620010, 0x0e00137a, 570 0x2a, 0xdf, 0xdc, 0x51, 0xc8, 0x93, 0x45, 0xf7, 0x5c, 0xed, 0x8c, 0x7f,
571 0x00000000, 0x0a000cd1, 0x8fbf0010, 0x97620010, 0x0a000cca, 0x00000000, 571 0x4e, 0xce, 0xd9, 0x4e, 0xfb, 0xe0, 0x1a, 0x8f, 0x43, 0x34, 0xd0, 0x76,
572 0x97630012, 0x8f420144, 0x14430006, 0x24020001, 0xa7620012, 0x0e001395, 572 0x12, 0x2c, 0x33, 0xfc, 0x6b, 0xeb, 0x86, 0x5c, 0x5b, 0xcc, 0x2b, 0x9e,
573 0x00000000, 0x0a000cd1, 0x8fbf0010, 0x97620012, 0x0a000cca, 0x00000000, 573 0x6f, 0xb8, 0xb6, 0xb0, 0x0f, 0x5c, 0x70, 0xf6, 0x81, 0xd3, 0x3e, 0x7d,
574 0x97630014, 0x8f420144, 0x14430006, 0x24020001, 0xa7620014, 0x0e0013bb, 574 0x51, 0xd9, 0xbc, 0xff, 0xab, 0xed, 0x0d, 0xcf, 0x7d, 0x22, 0xce, 0xe9,
575 0x00000000, 0x0a000cd1, 0x8fbf0010, 0x97620014, 0x0a000cca, 0x00000000, 575 0xc8, 0x91, 0xdc, 0x47, 0xce, 0x37, 0xe4, 0x61, 0x3d, 0xdb, 0x5c, 0xa7,
576 0x97630016, 0x8f420144, 0x14430006, 0x24020001, 0xa7620016, 0x0e0013be, 576 0x6a, 0xee, 0x91, 0x73, 0x01, 0x79, 0x99, 0xa5, 0xf3, 0xf9, 0xc7, 0x06,
577 0x00000000, 0x0a000cd1, 0x8fbf0010, 0x97620016, 0x14400006, 0x8fbf0010, 577 0x75, 0xf7, 0x53, 0xa4, 0x1a, 0xd3, 0x72, 0x40, 0xf0, 0x61, 0xb7, 0xbe,
578 0x3c030800, 0x8c620070, 0x24420001, 0xac620070, 0x8fbf0010, 0x03e00008, 578 0xbc, 0xec, 0xe4, 0x28, 0xe6, 0x5c, 0x63, 0xb0, 0x9c, 0xcf, 0x36, 0x89,
579 0x27bd0018, 0x27bdffe0, 0x3c029000, 0xafbf001c, 0xafb20018, 0xafb10014, 579 0xa7, 0x6f, 0x25, 0x9e, 0x63, 0xc0, 0x23, 0x37, 0xbd, 0x73, 0x35, 0xa1,
580 0xafb00010, 0x8f500140, 0x34420001, 0x3c038000, 0x02021025, 0xaf420020, 580 0x65, 0xf2, 0xa8, 0xb3, 0x87, 0xce, 0xea, 0x9f, 0xf0, 0x18, 0x3d, 0xb1,
581 0x8f420020, 0x00431024, 0x1440fffd, 0x24020012, 0x24030080, 0xa362003f, 581 0x23, 0xe2, 0x9c, 0x11, 0xe0, 0xd2, 0xb6, 0x97, 0xcd, 0x0e, 0x5a, 0x94,
582 0xa3630082, 0x93620023, 0x30420040, 0x10400007, 0x00008821, 0x93620023, 582 0x7e, 0x46, 0x9a, 0xfa, 0xf8, 0x12, 0x15, 0x85, 0x7f, 0x0b, 0xb9, 0x51,
583 0x24110001, 0x304200bf, 0xa3620023, 0x0a000cf0, 0x3c028000, 0x3c028000, 583 0xb0, 0x71, 0xc3, 0x47, 0x87, 0xe7, 0xf0, 0xf7, 0x1b, 0x13, 0x8e, 0xcc,
584 0x34420001, 0x3c039000, 0x34630001, 0x3c048000, 0x02021025, 0x02031825, 584 0xfd, 0x93, 0x31, 0x8c, 0x7a, 0x38, 0x0b, 0x01, 0xeb, 0x9d, 0x34, 0xc9,
585 0xaf420020, 0xaf430020, 0x8f420020, 0x00441024, 0x1440fffd, 0x00000000, 585 0x31, 0xb9, 0x1d, 0x71, 0x4e, 0x80, 0x8c, 0xcd, 0xbb, 0x5d, 0xde, 0x8e,
586 0x9362007d, 0x3c038000, 0x34420020, 0xa362007d, 0x8f640074, 0x34630001, 586 0x4f, 0xa1, 0x55, 0xbd, 0xe4, 0xeb, 0x68, 0xd8, 0xfc, 0x72, 0xcf, 0xf6,
587 0x02031825, 0xaf430020, 0x04810006, 0x3c038000, 0x02002021, 0x0e000470, 587 0x7d, 0x0a, 0x2a, 0x77, 0x5f, 0x71, 0x58, 0x75, 0x2d, 0x73, 0x69, 0xc1,
588 0x24050a63, 0x0a000d13, 0x00000000, 0x8f4201f8, 0x00431024, 0x1440fffd, 588 0x99, 0xe7, 0xd7, 0x55, 0xde, 0x6d, 0x77, 0x40, 0xde, 0x6d, 0x88, 0xe6,
589 0x24020002, 0x3c031000, 0xaf5001c0, 0xa34201c4, 0xaf4301f8, 0x1220003f, 589 0x84, 0xaf, 0x2e, 0x44, 0x39, 0x47, 0x37, 0x93, 0x9c, 0x5a, 0xd9, 0x6a,
590 0x3c120800, 0x8e420020, 0x8f71004c, 0x1040003c, 0x8fbf001c, 0x0e00148e, 590 0x23, 0x4e, 0xfc, 0x29, 0xee, 0xdd, 0x39, 0xf9, 0x7c, 0x5f, 0x04, 0xcf,
591 0x00000000, 0x8f820018, 0xac500000, 0x8f840018, 0x24020001, 0xac820004, 591 0x46, 0x4e, 0xb5, 0x2d, 0x62, 0xf1, 0x33, 0xa2, 0x5c, 0xa7, 0xa7, 0x1c,
592 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010, 592 0xdf, 0x17, 0xd5, 0x33, 0x3b, 0xb9, 0x7c, 0x8a, 0x64, 0x0e, 0x7d, 0x27,
593 0x8f820018, 0xac510014, 0x8f850018, 0x3c026000, 0x8c434448, 0x24040001, 593 0xcd, 0x15, 0x9b, 0xf5, 0x6b, 0x1f, 0xe2, 0x81, 0xe3, 0xf0, 0x95, 0x0a,
594 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 0x3c024010, 0x00621825, 594 0xbf, 0x95, 0xa1, 0xfa, 0x80, 0x3e, 0xb5, 0x57, 0xfb, 0x04, 0xf9, 0x14,
595 0x0e0014cc, 0xaca3001c, 0x8e420020, 0x1040001e, 0x8fbf001c, 0x0e00148e, 595 0x12, 0x7e, 0x05, 0xbe, 0x76, 0xda, 0x99, 0x23, 0x77, 0xbf, 0xc2, 0xdc,
596 0x00000000, 0x8f820018, 0xac500000, 0x8f840018, 0x3c02008d, 0xac820004, 596 0x2f, 0x3c, 0xa7, 0xd3, 0x55, 0xb6, 0xd3, 0x55, 0xb6, 0x36, 0x5e, 0x3a,
597 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010, 597 0xeb, 0x54, 0x0b, 0xe5, 0x1f, 0x59, 0x2f, 0xfd, 0x56, 0xd8, 0xe6, 0xe6,
598 0x8f840018, 0x24020a6a, 0xac820014, 0x8f850018, 0x3c026000, 0x8c434448, 598 0xb3, 0x06, 0x2d, 0xac, 0xf7, 0xf2, 0x27, 0xc6, 0x1f, 0x94, 0xdb, 0xcb,
599 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 0x3c024019, 599 0xff, 0xdd, 0x9c, 0xa2, 0x5f, 0xc4, 0x02, 0xb6, 0xce, 0x07, 0x83, 0xf1,
600 0x00621825, 0x0e0014cc, 0xaca3001c, 0x8fbf001c, 0x8fb20018, 0x8fb10014, 600 0x1f, 0xbc, 0x6e, 0x13, 0x01, 0xeb, 0xb6, 0xf9, 0xbe, 0x22, 0xf7, 0x93,
601 0x8fb00010, 0x03e00008, 0x27bd0020, 0x27bdffe8, 0xafbf0010, 0x93620081, 601 0xe4, 0x95, 0x8a, 0x23, 0xaf, 0x36, 0x69, 0xd0, 0x27, 0xa7, 0x82, 0xd6,
602 0x3c030800, 0x8c640048, 0x0044102b, 0x14400005, 0x00000000, 0x0e000cd3, 602 0x29, 0xfa, 0x78, 0xca, 0xe9, 0xe3, 0x9b, 0xa2, 0x3f, 0xe3, 0x54, 0xa8,
603 0x00000000, 0x0a000da4, 0x8fbf0010, 0x93620081, 0x24420001, 0x0e0013c4, 603 0xe6, 0x0d, 0x1f, 0xe1, 0xeb, 0x98, 0xb2, 0xd1, 0x35, 0x90, 0xab, 0xdf,
604 0xa3620081, 0x9763006a, 0x00032880, 0x14a00002, 0x00403821, 0x24050001, 604 0x6c, 0x43, 0xc6, 0x04, 0x71, 0xb2, 0x03, 0x01, 0xfa, 0x80, 0xee, 0xd2,
605 0x97630068, 0x93640081, 0x3c020800, 0x8c46004c, 0x00652821, 0x00852804, 605 0x07, 0xe2, 0x55, 0x7d, 0x60, 0x45, 0xe8, 0x09, 0xbb, 0x1c, 0x1d, 0x34,
606 0x00c5102b, 0x54400001, 0x00a03021, 0x3c020800, 0x8c440050, 0x00c4182b, 606 0xd8, 0x16, 0x97, 0xcb, 0xe3, 0xcc, 0x1b, 0xd8, 0xf8, 0xa4, 0x1d, 0x7d,
607 0x54600001, 0x00c02021, 0x8f420074, 0x2403fffe, 0x00832824, 0x00a21021, 607 0xda, 0xaa, 0x9e, 0x99, 0xc3, 0xba, 0x65, 0x8d, 0x4b, 0xfb, 0xe5, 0x09,
608 0xaf62000c, 0x10e00021, 0x3c029000, 0x8f450140, 0x34420001, 0x3c038000, 608 0xce, 0xac, 0xa8, 0xcc, 0x3e, 0x30, 0xa3, 0xa4, 0xa5, 0x93, 0xf1, 0xa9,
609 0x00a21025, 0xaf420020, 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 609 0x50, 0x84, 0x16, 0xac, 0x28, 0x15, 0xac, 0x14, 0x73, 0x70, 0xf0, 0xe3,
610 0x9362007d, 0x3c038000, 0x34420004, 0xa362007d, 0x8f640074, 0x34630001, 610 0xd0, 0x80, 0x46, 0x11, 0x96, 0x35, 0x11, 0x2a, 0x95, 0x94, 0x4e, 0x76,
611 0x00a31825, 0xaf430020, 0x04810006, 0x3c038000, 0x00a02021, 0x0e000470, 611 0x86, 0xc8, 0x2c, 0xc6, 0xa4, 0x0d, 0x9b, 0x71, 0x9a, 0x1f, 0x33, 0xe6,
612 0x24050a92, 0x0a000da4, 0x8fbf0010, 0x8f4201f8, 0x00431024, 0x1440fffd, 612 0x49, 0x43, 0xcc, 0x8b, 0x93, 0xa3, 0x0e, 0x0c, 0x8a, 0x38, 0x4b, 0xfd,
613 0x24020002, 0x3c031000, 0xaf4501c0, 0xa34201c4, 0xaf4301f8, 0x8fbf0010, 613 0xe5, 0x91, 0x28, 0xb5, 0xa7, 0xa5, 0xcd, 0x68, 0x86, 0xdb, 0xf8, 0xc2,
614 0x03e00008, 0x27bd0018, 0x27bdffd8, 0xafb3001c, 0x27530100, 0xafbf0024, 614 0x8a, 0xd1, 0x95, 0x7c, 0xd2, 0x38, 0xc1, 0xed, 0x64, 0xac, 0x64, 0x62,
615 0xafb40020, 0xafb20018, 0xafb10014, 0xafb00010, 0x96620008, 0x3c140800, 615 0x92, 0x9f, 0x5d, 0x2c, 0x45, 0x28, 0x67, 0x45, 0xa8, 0x50, 0x4a, 0x19,
616 0x8f520100, 0x30420001, 0x104000da, 0x00000000, 0x8e700018, 0x8f630054, 616 0x43, 0x6d, 0xa2, 0xcd, 0x18, 0xda, 0x7c, 0x49, 0x1f, 0x33, 0x4e, 0x92,
617 0x2602ffff, 0x00431023, 0x18400006, 0x00000000, 0x0000000d, 0x00000000, 617 0xbb, 0xcd, 0xaf, 0x9c, 0x36, 0xbd, 0x6d, 0xfd, 0x61, 0xe3, 0xfe, 0x44,
618 0x2400015c, 0x0a000dea, 0x00008821, 0x8f62004c, 0x02021023, 0x18400028, 618 0xa8, 0x32, 0x7b, 0x9f, 0xf1, 0x92, 0x5b, 0x9d, 0x60, 0xd9, 0x14, 0x13,
619 0x00008821, 0x93650120, 0x93640121, 0x3c030800, 0x8c62008c, 0x308400ff, 619 0x67, 0xdb, 0x68, 0xe9, 0x34, 0xcb, 0x1d, 0x9c, 0x6d, 0x61, 0xd0, 0x62,
620 0x24420001, 0x30a500ff, 0x00803821, 0x1485000b, 0xac62008c, 0x3c040800, 620 0x39, 0x4e, 0xef, 0x57, 0xed, 0x07, 0x12, 0x43, 0x39, 0x91, 0x43, 0x84,
621 0x8c830090, 0x24630001, 0xac830090, 0x93620122, 0x30420001, 0x00021023, 621 0x33, 0x17, 0x2a, 0xb3, 0xbf, 0x9b, 0x5e, 0x7f, 0x3f, 0xeb, 0x5b, 0x1f,
622 0x30420005, 0x0a000dea, 0x34510004, 0x27660100, 0x00041080, 0x00c21021, 622 0xc5, 0x28, 0x72, 0x15, 0x71, 0xdd, 0x36, 0x5d, 0x1b, 0x4f, 0x5e, 0xd9,
623 0x8c430000, 0x02031823, 0x04600004, 0x24820001, 0x30440007, 0x1485fff9, 623 0x14, 0x79, 0x68, 0x09, 0x5a, 0x33, 0xa5, 0x3c, 0xcd, 0x71, 0xf9, 0x15,
624 0x00041080, 0x10870007, 0x3c030800, 0xa3640121, 0x8c620094, 0x24110005, 624 0x94, 0x5b, 0x4b, 0xd0, 0x3d, 0x91, 0x8f, 0xd6, 0x4e, 0x77, 0xf4, 0x18,
625 0x24420001, 0x0a000dea, 0xac620094, 0x24110004, 0x32220001, 0x1040001e, 625 0x85, 0x6e, 0x9a, 0xc6, 0xbc, 0xf0, 0x0b, 0x57, 0x66, 0x87, 0x86, 0x0d,
626 0x8e820020, 0x1040001d, 0x32220004, 0x0e00148e, 0x00000000, 0x8f820018, 626 0xd2, 0xae, 0xa2, 0x1e, 0xff, 0xbf, 0x89, 0xfb, 0x28, 0x61, 0x7e, 0x66,
627 0xac520000, 0x8f840018, 0x24020001, 0xac820004, 0x8f830018, 0xac600008, 627 0xac, 0x31, 0x5e, 0x49, 0xc3, 0xf1, 0x12, 0x64, 0xf3, 0x41, 0x89, 0xa5,
628 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010, 0x8f820018, 0xac500014, 628 0x39, 0x23, 0x42, 0xd0, 0x5f, 0x61, 0x7b, 0xeb, 0x35, 0x27, 0x7b, 0xa4,
629 0x8f850018, 0x3c026000, 0x8c434448, 0x24040001, 0x3c020800, 0xaca30018, 629 0xfe, 0xe4, 0x3b, 0x9b, 0x43, 0x9f, 0x19, 0x71, 0x9f, 0xcf, 0x51, 0x7b,
630 0x944358ce, 0x8f850018, 0x3c024010, 0x00621825, 0x0e0014cc, 0xaca3001c, 630 0x66, 0xc6, 0x92, 0xef, 0xb9, 0x52, 0xee, 0xa5, 0x25, 0x6e, 0x7b, 0x64,
631 0x32220004, 0x10400081, 0x00003821, 0x3c029000, 0x34420001, 0x3c038000, 631 0xf8, 0x8c, 0x73, 0xa6, 0x0f, 0xff, 0xd9, 0x8b, 0x7b, 0x85, 0xb7, 0x7d,
632 0x02421025, 0xa360007c, 0xaf420020, 0x8f420020, 0x00431024, 0x1440fffd, 632 0x7d, 0x14, 0xc5, 0x3d, 0x0d, 0xe8, 0x3c, 0xc7, 0xb0, 0xe9, 0x87, 0xc5,
633 0x00000000, 0x93620023, 0x30420080, 0x10400011, 0x00000000, 0x8f65005c, 633 0xb8, 0xa7, 0xe2, 0x98, 0xcb, 0xb9, 0xb8, 0x3a, 0x97, 0x08, 0x65, 0xba,
634 0x8f63004c, 0x9764003c, 0x8f620064, 0x00a32823, 0x00852821, 0x00a2102b, 634 0xe9, 0x91, 0xd5, 0x45, 0x3f, 0x8b, 0xf3, 0x47, 0xf8, 0xba, 0x84, 0x9c,
635 0x54400006, 0x3c023fff, 0x93620023, 0x3042007f, 0xa3620023, 0xaf700064, 635 0xa3, 0x36, 0xca, 0x64, 0xbb, 0x69, 0xb3, 0x14, 0x66, 0x71, 0x05, 0xec,
636 0x3c023fff, 0x0a000e37, 0x3442ffff, 0x8f62005c, 0x02021023, 0x04400011, 636 0x44, 0xb9, 0x4c, 0x81, 0xa6, 0xd6, 0x5f, 0xeb, 0x83, 0x1f, 0x66, 0x52,
637 0x00000000, 0x8f65005c, 0x8f630064, 0x9764003c, 0x3c023fff, 0x3442ffff, 637 0xab, 0x61, 0xe9, 0x51, 0x00, 0x96, 0x7e, 0xa9, 0xc3, 0xd2, 0xd1, 0xbe,
638 0xaf700064, 0x00a32823, 0x00852821, 0x0045102b, 0x10400004, 0x02051021, 638 0xe6, 0x58, 0xea, 0x77, 0x62, 0xd6, 0xa3, 0x14, 0x71, 0x70, 0xf4, 0x39,
639 0x3c053fff, 0x34a5ffff, 0x02051021, 0xaf62005c, 0x24070001, 0xaf70004c, 639 0xe3, 0xe8, 0x3d, 0xc6, 0xd1, 0xf1, 0x06, 0x38, 0xd2, 0x3c, 0x38, 0x3a,
640 0x8f620054, 0x16020005, 0x00000000, 0x93620023, 0x30420040, 0x10400017, 640 0x51, 0x87, 0xa3, 0x6c, 0x5f, 0x33, 0x1c, 0x1d, 0x0f, 0xa1, 0xff, 0xcd,
641 0x24020001, 0x9762006a, 0x00022880, 0x50a00001, 0x24050001, 0x97630068, 641 0xd6, 0x32, 0xfa, 0xb0, 0x9f, 0x39, 0xbd, 0x49, 0xa5, 0xd5, 0xe4, 0xf8,
642 0x93640081, 0x3c020800, 0x8c46004c, 0x00652821, 0x00852804, 0x00c5102b, 642 0x24, 0x55, 0x90, 0x73, 0x92, 0x58, 0xa2, 0xb4, 0xe0, 0x76, 0x05, 0x81,
643 0x54400001, 0x00a03021, 0x3c020800, 0x8c440050, 0x00c4182b, 0x54600001, 643 0xbf, 0x2c, 0x8f, 0xc9, 0xae, 0x06, 0xe7, 0xaa, 0x24, 0x9c, 0x79, 0x93,
644 0x00c02021, 0x8f420074, 0x2403fffe, 0x00832824, 0x00a21021, 0xaf62000c, 644 0x73, 0x99, 0xc9, 0x57, 0x66, 0x1f, 0x32, 0x36, 0xee, 0x6d, 0xe8, 0x3a,
645 0x93620082, 0x30420080, 0x50400001, 0xa3600081, 0x3c028000, 0x34420001, 645 0x7e, 0x0b, 0xb1, 0x8c, 0xbc, 0xbb, 0x81, 0x73, 0x5b, 0xe2, 0x74, 0xdf,
646 0x02421025, 0xaf420020, 0x9363007e, 0x9362007a, 0x10620004, 0x00000000, 646 0x1a, 0xa0, 0x7b, 0xd6, 0x7e, 0xba, 0x6b, 0x0d, 0xd2, 0x03, 0x0b, 0x6d,
647 0x0e0013c4, 0x00000000, 0x00403821, 0x10e0001f, 0x3c029000, 0x34420001, 647 0x60, 0x0e, 0xf8, 0x5e, 0xcc, 0x81, 0x46, 0x33, 0x31, 0x2e, 0x53, 0xda,
648 0x02421025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, 648 0x4f, 0x95, 0x92, 0xc2, 0x35, 0xb0, 0x03, 0x0c, 0x35, 0xc6, 0x4e, 0xa6,
649 0x00000000, 0x9362007d, 0x3c038000, 0xa362007d, 0x8f640074, 0x34630001, 649 0x0e, 0x3b, 0xb2, 0x0e, 0x30, 0xb3, 0xe4, 0xb7, 0xad, 0xed, 0x32, 0xf8,
650 0x02431825, 0xaf430020, 0x04810006, 0x3c038000, 0x02402021, 0x0e000470, 650 0x5d, 0x0d, 0xc6, 0x56, 0x58, 0xc4, 0x91, 0x24, 0x47, 0x67, 0x42, 0x90,
651 0x24050b3d, 0x0a000e8d, 0x00000000, 0x8f4201f8, 0x00431024, 0x1440fffd, 651 0x59, 0xb7, 0x18, 0x53, 0x3c, 0x17, 0x3c, 0x7e, 0xda, 0xf5, 0x41, 0x96,
652 0x24020002, 0x3c031000, 0xaf5201c0, 0xa34201c4, 0xaf4301f8, 0x9342010b, 652 0x39, 0x4f, 0x09, 0x1b, 0xf4, 0x94, 0xa9, 0xc7, 0x33, 0x64, 0x5f, 0xd6,
653 0x9343010b, 0x8e820020, 0x27500100, 0x38630006, 0x10400029, 0x2c710001, 653 0xcc, 0x31, 0x91, 0xeb, 0xb6, 0x54, 0xf6, 0x9e, 0x31, 0x91, 0xe1, 0xb1,
654 0x0e00148e, 0x00000000, 0x8f830018, 0x8e020000, 0xac620000, 0x8f840018, 654 0x57, 0x78, 0xf4, 0xca, 0xa1, 0x76, 0xaa, 0x38, 0x31, 0x4c, 0x85, 0x55,
655 0x96020008, 0xac820004, 0x8f830018, 0x8e020014, 0xac620008, 0x8f850018, 655 0xdb, 0x7e, 0xc8, 0xfc, 0x7f, 0xcd, 0x84, 0xcc, 0xfe, 0xdb, 0xae, 0xc4,
656 0x3c026000, 0x8c434448, 0xaca3000c, 0x8f840018, 0x96020012, 0xac820010, 656 0x74, 0x5a, 0x36, 0x55, 0xdf, 0xee, 0x08, 0x7c, 0x31, 0x47, 0xa4, 0x77,
657 0x8f850018, 0x8e030020, 0xaca30014, 0x9602000c, 0x9603000e, 0x8f840018, 657 0x37, 0xaa, 0xaf, 0xc4, 0xbf, 0xe3, 0xbb, 0xbf, 0x04, 0x97, 0x59, 0xab,
658 0x00021400, 0x00431025, 0xac820018, 0x12200005, 0x3c020800, 0x944358ce, 658 0x96, 0x85, 0xed, 0xf8, 0xd2, 0xd8, 0xc2, 0x2a, 0xce, 0x7e, 0x7b, 0xfc,
659 0x8f840018, 0x0a000eb8, 0x3c024013, 0x944358ce, 0x8f840018, 0x3c024014, 659 0xea, 0xf9, 0xd5, 0x5c, 0x1f, 0x4b, 0xd8, 0x94, 0x4e, 0x76, 0x68, 0x79,
660 0x00621825, 0xac83001c, 0x0e0014cc, 0x24040001, 0x8e700014, 0x8f620040, 660 0x3c, 0xf7, 0x5c, 0x98, 0x86, 0x19, 0x97, 0x38, 0x83, 0x6b, 0x6c, 0x34,
661 0x14500003, 0x00501023, 0x0a000ec3, 0x00001021, 0x28420001, 0x1040003a, 661 0x2c, 0xce, 0x38, 0xd9, 0xcd, 0x78, 0xc8, 0x0a, 0x3b, 0xfd, 0xd4, 0x91,
662 0x00000000, 0x0e000fae, 0x02002021, 0xaf700040, 0x9362003e, 0x30420001, 662 0x09, 0x9a, 0x2c, 0xa7, 0xf9, 0x53, 0x3f, 0x7e, 0xb5, 0xb9, 0xe3, 0xe1,
663 0x1440000b, 0x3c029000, 0x93620022, 0x24420001, 0xa3620022, 0x93630022, 663 0x48, 0xe3, 0x37, 0x37, 0xff, 0xa8, 0xd5, 0x9d, 0xe6, 0xba, 0x33, 0x5b,
664 0x3c020800, 0x8c440098, 0x0064182b, 0x14600025, 0x3c020800, 0x3c029000, 664 0xd6, 0x55, 0xe7, 0x12, 0xfd, 0x03, 0x69, 0xae, 0x1b, 0xa3, 0xbc, 0x57,
665 0x34420001, 0x02421025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 665 0x00, 0x00, 0x00 };
666 0x1440fffd, 0x00000000, 0x9362007d, 0x3c038000, 0x34420001, 0xa362007d,
667 0x8f640074, 0x34630001, 0x02431825, 0xaf430020, 0x04810006, 0x3c038000,
668 0x02402021, 0x0e000470, 0x24050273, 0x0a000ef6, 0x24020001, 0x8f4201f8,
669 0x00431024, 0x1440fffd, 0x24020002, 0x3c031000, 0xaf5201c0, 0xa34201c4,
670 0xaf4301f8, 0x24020001, 0xa7620012, 0x0a000efe, 0xa3600022, 0x9743007a,
671 0x9444002a, 0x00641821, 0x3063fffe, 0xa7630012, 0x97420108, 0x8fbf0024,
672 0x8fb40020, 0x8fb3001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x00021042,
673 0x30420001, 0x03e00008, 0x27bd0028, 0x27bdffe0, 0xafb20018, 0x3c120800,
674 0x8e420020, 0xafb00010, 0x27500100, 0xafbf001c, 0x10400046, 0xafb10014,
675 0x0e00148e, 0x00000000, 0x8f840018, 0x8e020000, 0xac820000, 0x936300b1,
676 0x936200c5, 0x8f850018, 0x00031e00, 0x00021400, 0x34420100, 0x00621825,
677 0xaca30004, 0x8f840018, 0x8e02001c, 0xac820008, 0x8f830018, 0x8f620048,
678 0xac62000c, 0x8f840018, 0x96020012, 0xac820010, 0x8f830018, 0x8f620040,
679 0x24040001, 0xac620014, 0x8f850018, 0x3c026000, 0x8c434448, 0x3c020800,
680 0x245158c0, 0xaca30018, 0x9623000e, 0x8f850018, 0x3c024016, 0x00621825,
681 0x0e0014cc, 0xaca3001c, 0x96030008, 0x30630010, 0x1060001c, 0x8e420020,
682 0x1040001a, 0x8e100000, 0x0e00148e, 0x00000000, 0x8f820018, 0xac500000,
683 0x8f830018, 0xac600004, 0x8f820018, 0xac400008, 0x8f830018, 0xac60000c,
684 0x8f820018, 0xac400010, 0x8f830018, 0xac600014, 0x8f850018, 0x3c036000,
685 0x8c634448, 0x24040001, 0xaca30018, 0x9622000e, 0x8f850018, 0x3c034015,
686 0x00431025, 0x0e0014cc, 0xaca2001c, 0x00001021, 0x8fbf001c, 0x8fb20018,
687 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 0x27bdffe0, 0xafb20018,
688 0x3c120800, 0x8e420020, 0xafb00010, 0x27500100, 0xafbf001c, 0x10400041,
689 0xafb10014, 0x0e00148e, 0x00000000, 0x8f830018, 0x8e020000, 0xac620000,
690 0x8f840018, 0x24020100, 0xac820004, 0x8f830018, 0x8e02001c, 0xac620008,
691 0x8f840018, 0x8e020018, 0xac82000c, 0x8f830018, 0x96020012, 0xac620010,
692 0x8f840018, 0x96020008, 0xac820014, 0x8f850018, 0x3c026000, 0x8c434448,
693 0x24040001, 0x3c020800, 0x245158c0, 0xaca30018, 0x9623000e, 0x8f850018,
694 0x3c024017, 0x00621825, 0x0e0014cc, 0xaca3001c, 0x96030008, 0x30630010,
695 0x1060001c, 0x8e420020, 0x1040001a, 0x8e100000, 0x0e00148e, 0x00000000,
696 0x8f820018, 0xac500000, 0x8f830018, 0xac600004, 0x8f820018, 0xac400008,
697 0x8f830018, 0xac60000c, 0x8f820018, 0xac400010, 0x8f830018, 0xac600014,
698 0x8f850018, 0x3c036000, 0x8c634448, 0x24040001, 0xaca30018, 0x9622000e,
699 0x8f850018, 0x3c034015, 0x00431025, 0x0e0014cc, 0xaca2001c, 0x00001021,
700 0x8fbf001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020,
701 0x27bdfff0, 0x03e00008, 0x27bd0010, 0x27bdffd0, 0xafb10014, 0x00808821,
702 0xafb40020, 0x00c0a021, 0xafbf0028, 0xafb50024, 0xafb3001c, 0xafb20018,
703 0xafb00010, 0x93620023, 0x00e0a821, 0x30420040, 0x1040003e, 0x30b3ffff,
704 0x3c120800, 0x8e420020, 0x1040003a, 0x8f70004c, 0x0e00148e, 0x00000000,
705 0x8f820018, 0xac510000, 0x8f840018, 0x24020001, 0xac820004, 0x8f830018,
706 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010, 0x8f820018,
707 0x24040001, 0xac500014, 0x8f850018, 0x3c026000, 0x8c434448, 0x3c020800,
708 0x245058c0, 0xaca30018, 0x9603000e, 0x8f850018, 0x3c024010, 0x00621825,
709 0x0e0014cc, 0xaca3001c, 0x8e430020, 0x1060001b, 0x00000000, 0x0e00148e,
710 0x00000000, 0x8f820018, 0xac510000, 0x8f840018, 0x3c02008d, 0xac820004,
711 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010,
712 0x8f820018, 0xac550014, 0x8f850018, 0x3c036000, 0x8c634448, 0x24040001,
713 0xaca30018, 0x9602000e, 0x8f850018, 0x3c034019, 0x00431025, 0x0e0014cc,
714 0xaca2001c, 0x93620023, 0x30420020, 0x14400003, 0x3c120800, 0x1280003f,
715 0x3c029000, 0x8e420020, 0x8f70004c, 0x1040003b, 0x3c029000, 0x0e00148e,
716 0x00000000, 0x8f820018, 0xac510000, 0x8f840018, 0x24020001, 0xac820004,
717 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010,
718 0x8f820018, 0x24040001, 0xac500014, 0x8f850018, 0x3c026000, 0x8c434448,
719 0x3c020800, 0x245058c0, 0xaca30018, 0x9603000e, 0x8f850018, 0x3c024010,
720 0x00621825, 0x0e0014cc, 0xaca3001c, 0x8e430020, 0x1060001c, 0x3c029000,
721 0x0e00148e, 0x00000000, 0x8f820018, 0xac510000, 0x8f840018, 0x00131400,
722 0xac820004, 0x8f830018, 0xac750008, 0x8f820018, 0xac40000c, 0x8f830018,
723 0xac600010, 0x8f820018, 0xac400014, 0x8f850018, 0x3c036000, 0x8c634448,
724 0x24040001, 0xaca30018, 0x9602000e, 0x8f850018, 0x3c03401b, 0x00431025,
725 0x0e0014cc, 0xaca2001c, 0x3c029000, 0x34420001, 0x02221025, 0xaf420020,
726 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 0x93630023,
727 0x3c028000, 0x34420001, 0x02221025, 0x8fbf0028, 0x8fb50024, 0x8fb40020,
728 0x8fb3001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x3063009f, 0xa3630023,
729 0xaf420020, 0x03e00008, 0x27bd0030, 0x27bdffe0, 0xafb10014, 0x27510100,
730 0x3c029000, 0x34420001, 0xafb00010, 0x00808021, 0x02021025, 0x3c038000,
731 0xafbf0018, 0xaf420020, 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000,
732 0xa7600008, 0x8f63005c, 0x3c028000, 0x34420001, 0xaf630148, 0x8f640050,
733 0x02021025, 0x3c039000, 0xaf64017c, 0xaf420020, 0x8f450100, 0x34630001,
734 0x3c048000, 0x00a31825, 0xaf430020, 0x8f420020, 0x00441024, 0x1440fffd,
735 0x00000000, 0x9362007d, 0x3c038000, 0x34420001, 0xa362007d, 0x8f640074,
736 0x34630001, 0x00a31825, 0xaf430020, 0x04810006, 0x3c038000, 0x00a02021,
737 0x0e000470, 0x24050de5, 0x0a001093, 0x3c020800, 0x8f4201f8, 0x00431024,
738 0x1440fffd, 0x24020002, 0x3c031000, 0xaf4501c0, 0xa34201c4, 0xaf4301f8,
739 0x3c020800, 0x8c430020, 0x1060001e, 0x8fbf0018, 0x0e00148e, 0x00000000,
740 0x8f830018, 0xac700000, 0x9622000c, 0x8f840018, 0x00021400, 0xac820004,
741 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010,
742 0x8f820018, 0xac400014, 0x8f850018, 0x3c026000, 0x8c434448, 0x24040001,
743 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 0x3c02401f, 0x00621825,
744 0x0e0014cc, 0xaca3001c, 0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x03e00008,
745 0x27bd0020, 0x3c020800, 0x24424c3c, 0xaf82000c, 0x03e00008, 0x00000000,
746 0x27bdffe8, 0xafb00010, 0x27500100, 0xafbf0014, 0x8e02001c, 0x14400003,
747 0x3c020800, 0x0000000d, 0x3c020800, 0x8c430020, 0x10600020, 0x00001021,
748 0x0e00148e, 0x00000000, 0x8f830018, 0x8e020000, 0xac620000, 0x8f840018,
749 0x8e02001c, 0xac820004, 0x8f830018, 0xac600008, 0x8f840018, 0x8e020018,
750 0xac82000c, 0x8f850018, 0x96020012, 0xaca20010, 0x8f830018, 0x3c026000,
751 0xac600014, 0x8f840018, 0x8c434448, 0x3c020800, 0xac830018, 0x944358ce,
752 0x8f840018, 0x3c024012, 0x00621825, 0xac83001c, 0x0e0014cc, 0x24040001,
753 0x00001021, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x3c020800,
754 0x97430078, 0x9444002e, 0x00001021, 0x00641821, 0x3063fffe, 0x03e00008,
755 0xa7630010, 0x27bdfff0, 0x00001021, 0x03e00008, 0x27bd0010, 0x8f420100,
756 0x34420001, 0xaf4200a4, 0x03e00008, 0x00001021, 0x27bdffe0, 0xafbf0018,
757 0xafb10014, 0xafb00010, 0x9362007e, 0x30d000ff, 0x16020031, 0x00808821,
758 0x8f620178, 0x1602002e, 0x00000000, 0x9362007f, 0x1602002b, 0x00000000,
759 0x9362007a, 0x16020004, 0x00000000, 0x0000000d, 0x00000000, 0x240009d2,
760 0x0e0013e6, 0x00000000, 0x3c039000, 0x34630001, 0x3c048000, 0x02231825,
761 0xa370007a, 0xaf430020, 0x8f420020, 0x00441024, 0x1440fffd, 0x00000000,
762 0x9362007d, 0x3c038000, 0xa362007d, 0x8f640074, 0x34630001, 0x02231825,
763 0xaf430020, 0x04810006, 0x3c038000, 0x02202021, 0x0e000470, 0x240509dd,
764 0x0a001138, 0x8fbf0018, 0x8f4201f8, 0x00431024, 0x1440fffd, 0x24020002,
765 0x3c031000, 0xaf5101c0, 0xa34201c4, 0xaf4301f8, 0x0a001138, 0x8fbf0018,
766 0x0000000d, 0x00000000, 0x240009e2, 0x8fbf0018, 0x8fb10014, 0x8fb00010,
767 0x03e00008, 0x27bd0020, 0x27bdffe8, 0x30a500ff, 0x3c029000, 0x34420001,
768 0x00803821, 0x00e21025, 0x3c038000, 0xafbf0010, 0xaf420020, 0x8f420020,
769 0x00431024, 0x1440fffd, 0x00000000, 0x9362007d, 0x3c038000, 0x00a21025,
770 0xa362007d, 0x8f640074, 0x34630001, 0x00e31825, 0xaf430020, 0x04810006,
771 0x3c038000, 0x00e02021, 0x0e000470, 0x00c02821, 0x0a001161, 0x8fbf0010,
772 0x8f4201f8, 0x00431024, 0x1440fffd, 0x24020002, 0x3c031000, 0xaf4701c0,
773 0xa34201c4, 0xaf4301f8, 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x3c020800,
774 0x8c430020, 0x27bdffe8, 0xafb00010, 0x27500100, 0x10600024, 0xafbf0014,
775 0x0e00148e, 0x00000000, 0x8f830018, 0x8e020000, 0xac620000, 0x8f840018,
776 0x8e020004, 0xac820004, 0x8f830018, 0x8e020018, 0xac620008, 0x8f840018,
777 0x8e03001c, 0xac83000c, 0x9602000c, 0x9203000a, 0x8f840018, 0x00021400,
778 0x00431025, 0xac820010, 0x8f830018, 0x3c026000, 0xac600014, 0x8f840018,
779 0x8c434448, 0xac830018, 0x96020008, 0x3c030800, 0x946458ce, 0x8f850018,
780 0x00021400, 0x00441025, 0x24040001, 0x0e0014cc, 0xaca2001c, 0x8fbf0014,
781 0x8fb00010, 0x03e00008, 0x27bd0018, 0x3c020800, 0x8c430020, 0x27bdffe8,
782 0xafb00010, 0x27500100, 0x10600020, 0xafbf0014, 0x0e00148e, 0x00000000,
783 0x8f820018, 0xac400000, 0x8f830018, 0xac600004, 0x8f820018, 0xac400008,
784 0x8f830018, 0xac60000c, 0x9602000c, 0x9603000e, 0x8f840018, 0x00021400,
785 0x00431025, 0xac820010, 0x8f830018, 0x3c026000, 0xac600014, 0x8f840018,
786 0x8c434448, 0xac830018, 0x96020008, 0x3c030800, 0x946458ce, 0x8f850018,
787 0x00021400, 0x00441025, 0x24040001, 0x0e0014cc, 0xaca2001c, 0x8fbf0014,
788 0x8fb00010, 0x03e00008, 0x27bd0018, 0x27bdffe8, 0xafb00010, 0x27500100,
789 0xafbf0014, 0x9602000c, 0x10400024, 0x00802821, 0x3c020800, 0x8c430020,
790 0x1060003a, 0x8fbf0014, 0x0e00148e, 0x00000000, 0x8f840018, 0x8e030000,
791 0xac830000, 0x9602000c, 0x8f840018, 0x00021400, 0xac820004, 0x8f830018,
792 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018, 0xac600010, 0x8f820018,
793 0xac400014, 0x8f850018, 0x3c026000, 0x8c434448, 0x24040001, 0x3c020800,
794 0xaca30018, 0x944358ce, 0x8f850018, 0x3c02400b, 0x00621825, 0x0e0014cc,
795 0xaca3001c, 0x0a0011ff, 0x8fbf0014, 0x93620005, 0x30420010, 0x14400015,
796 0x3c029000, 0x34420001, 0x00a21025, 0xaf420020, 0x3c038000, 0x8f420020,
797 0x00431024, 0x1440fffd, 0x00000000, 0x3c038000, 0x93620005, 0x34630001,
798 0x00a02021, 0x00a31825, 0x24055852, 0x34420010, 0xa3620005, 0x0e000766,
799 0xaf430020, 0x0a0011ff, 0x8fbf0014, 0x0000000d, 0x8fbf0014, 0x8fb00010,
800 0x03e00008, 0x27bd0018, 0x3c020800, 0x8c430020, 0x27bdffe8, 0xafb00010,
801 0x27500100, 0x10600022, 0xafbf0014, 0x0e00148e, 0x00000000, 0x8f840018,
802 0x8e020004, 0xac820000, 0x9603000c, 0x9762002c, 0x8f840018, 0x00031c00,
803 0x00431025, 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c,
804 0x8f830018, 0xac600010, 0x8f820018, 0xac400014, 0x8f850018, 0x3c026000,
805 0x8c434448, 0x24040001, 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018,
806 0x3c02400e, 0x00621825, 0x0e0014cc, 0xaca3001c, 0x0e00122e, 0x8e040000,
807 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x3c038000, 0x8f420278,
808 0x00431024, 0x1440fffd, 0x24020002, 0x3c031000, 0xaf440240, 0xa3420244,
809 0x03e00008, 0xaf430278, 0x3c020800, 0x8c430020, 0x27bdffe0, 0xafb10014,
810 0x00808821, 0xafb20018, 0x00c09021, 0xafb00010, 0x30b0ffff, 0x1060001c,
811 0xafbf001c, 0x0e00148e, 0x00000000, 0x8f820018, 0xac510000, 0x8f840018,
812 0x00101400, 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c,
813 0x8f830018, 0xac600010, 0x8f820018, 0xac520014, 0x8f840018, 0x3c026000,
814 0x8c434448, 0x3c020800, 0xac830018, 0x944358ce, 0x8f840018, 0x3c024019,
815 0x00621825, 0xac83001c, 0x0e0014cc, 0x24040001, 0x8fbf001c, 0x8fb20018,
816 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 0x27bdffe8, 0x27450100,
817 0xafbf0010, 0x94a3000c, 0x240200c1, 0x14620031, 0x00803021, 0x3c029000,
818 0x34420001, 0x00c21025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024,
819 0x1440fffd, 0x3c028000, 0x34420001, 0x3c049000, 0x34840001, 0x3c058000,
820 0x24030012, 0x00c21025, 0x00c42025, 0xa363003f, 0xaf420020, 0xaf440020,
821 0x8f420020, 0x00451024, 0x1440fffd, 0x00000000, 0x9362007d, 0x3c038000,
822 0x34420020, 0xa362007d, 0x8f640074, 0x34630001, 0x00c31825, 0xaf430020,
823 0x04810006, 0x3c038000, 0x00c02021, 0x0e000470, 0x24050906, 0x0a0012a1,
824 0x8fbf0010, 0x8f4201f8, 0x00431024, 0x1440fffd, 0x24020002, 0x3c031000,
825 0xaf4601c0, 0xa34201c4, 0xaf4301f8, 0x0a0012a1, 0x8fbf0010, 0x00c02021,
826 0x94a5000c, 0x24060001, 0x0e000fb1, 0x2407090e, 0x8fbf0010, 0x03e00008,
827 0x27bd0018, 0x3c020800, 0x8c430020, 0x27bdffe0, 0xafb00010, 0x00808021,
828 0xafb20018, 0x00a09021, 0xafb10014, 0x30d100ff, 0x1060001c, 0xafbf001c,
829 0x0e00148e, 0x00000000, 0x8f820018, 0xac500000, 0x8f840018, 0x24020001,
830 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018,
831 0xac600010, 0x8f820018, 0xac520014, 0x8f840018, 0x3c026000, 0x8c434448,
832 0x3c020800, 0xac830018, 0x944358ce, 0x8f840018, 0x3c024010, 0x00621825,
833 0xac83001c, 0x0e0014cc, 0x02202021, 0x8fbf001c, 0x8fb20018, 0x8fb10014,
834 0x8fb00010, 0x03e00008, 0x27bd0020, 0x27bdffe8, 0xafbf0014, 0xafb00010,
835 0x93620005, 0x30420001, 0x10400036, 0x00808021, 0x3c029000, 0x34420001,
836 0x02021025, 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd,
837 0x00000000, 0x93620023, 0x34420004, 0xa3620023, 0x93630005, 0x3c048000,
838 0x3c020800, 0x306300fe, 0xa3630005, 0x8c430020, 0x34840001, 0x02042025,
839 0xaf440020, 0x10600020, 0x8fbf0014, 0x0e00148e, 0x00000000, 0x8f820018,
840 0xac500000, 0x93630082, 0x9362003f, 0x8f840018, 0x00031a00, 0x00431025,
841 0xac820004, 0x8f830018, 0xac600008, 0x8f820018, 0xac40000c, 0x8f830018,
842 0xac600010, 0x8f820018, 0xac400014, 0x8f840018, 0x3c026000, 0x8c434448,
843 0x3c020800, 0xac830018, 0x944358ce, 0x8f840018, 0x3c02400a, 0x00621825,
844 0xac83001c, 0x0e0014cc, 0x24040001, 0x8fbf0014, 0x8fb00010, 0x03e00008,
845 0x27bd0018, 0x3c020800, 0x8c430020, 0x27bdffe0, 0xafb10014, 0x00808821,
846 0xafb20018, 0x00a09021, 0xafb00010, 0x30d000ff, 0x1060002f, 0xafbf001c,
847 0x0e00148e, 0x00000000, 0x8f820018, 0xac510000, 0x8f830018, 0xac700004,
848 0x8f820018, 0xac520008, 0x8f830018, 0xac60000c, 0x8f820018, 0xac400010,
849 0x9763006a, 0x00032880, 0x50a00001, 0x24050001, 0x97630068, 0x93640081,
850 0x3c020800, 0x8c46004c, 0x00652821, 0x00852804, 0x00c5102b, 0x54400001,
851 0x00a03021, 0x3c020800, 0x8c440050, 0x00c4182b, 0x54600001, 0x00c02021,
852 0x8f830018, 0x2402fffe, 0x00822824, 0x3c026000, 0xac650014, 0x8f840018,
853 0x8c434448, 0x3c020800, 0xac830018, 0x944358ce, 0x8f840018, 0x3c024011,
854 0x00621825, 0xac83001c, 0x0e0014cc, 0x24040001, 0x8fbf001c, 0x8fb20018,
855 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 0x27bdffe8, 0xafbf0014,
856 0xafb00010, 0x8f440100, 0x27500100, 0x8f650050, 0x0e0010fc, 0x9206001b,
857 0x3c020800, 0x8c430020, 0x1060001d, 0x8e100018, 0x0e00148e, 0x00000000,
858 0x8f840018, 0x8f420100, 0xac820000, 0x8f830018, 0xac700004, 0x8f840018,
859 0x8f620050, 0xac820008, 0x8f830018, 0xac60000c, 0x8f820018, 0xac400010,
860 0x8f830018, 0x3c026000, 0xac600014, 0x8f850018, 0x8c434448, 0x24040001,
861 0x3c020800, 0xaca30018, 0x944358ce, 0x8f850018, 0x3c02401c, 0x00621825,
862 0x0e0014cc, 0xaca3001c, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018,
863 0x8f430238, 0x3c020800, 0x04610013, 0x8c44009c, 0x2406fffe, 0x3c050800,
864 0x3c038000, 0x2484ffff, 0x14800009, 0x00000000, 0x97420078, 0x8ca3007c,
865 0x24420001, 0x00461024, 0x24630001, 0xa7620010, 0x03e00008, 0xaca3007c,
866 0x8f420238, 0x00431024, 0x1440fff3, 0x2484ffff, 0x8f420140, 0x3c031000,
867 0xaf420200, 0x03e00008, 0xaf430238, 0x27bdffe8, 0x3c029000, 0xafbf0010,
868 0x8f450140, 0x34420001, 0x3c038000, 0x00a21025, 0xaf420020, 0x8f420020,
869 0x00431024, 0x1440fffd, 0x00000000, 0x9362007d, 0x3c038000, 0x34420001,
870 0xa362007d, 0x8f640074, 0x34630001, 0x00a31825, 0xaf430020, 0x04810006,
871 0x3c038000, 0x00a02021, 0x0e000470, 0x24050ac7, 0x0a0013b9, 0x8fbf0010,
872 0x8f4201f8, 0x00431024, 0x1440fffd, 0x24020002, 0x3c031000, 0xaf4501c0,
873 0xa34201c4, 0xaf4301f8, 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x0000000d,
874 0x03e00008, 0x00000000, 0x0000000d, 0x03e00008, 0x00000000, 0x24020001,
875 0x03e00008, 0xa7620010, 0x9362003f, 0x304400ff, 0x3883000e, 0x2c630001,
876 0x38820010, 0x2c420001, 0x00621825, 0x14600003, 0x24020012, 0x14820003,
877 0x00000000, 0x03e00008, 0x00001021, 0x9363007e, 0x9362007a, 0x14620006,
878 0x00000000, 0x9363007e, 0x24020001, 0x24630001, 0x03e00008, 0xa363007e,
879 0x9362007e, 0x8f630178, 0x304200ff, 0x14430006, 0x00000000, 0x9363000b,
880 0x24020001, 0x24630001, 0x03e00008, 0xa363000b, 0x03e00008, 0x00001021,
881 0x9362000b, 0x10400023, 0x00001021, 0xa360000b, 0x9362003f, 0x304400ff,
882 0x3883000e, 0x2c630001, 0x38820010, 0x2c420001, 0x00621825, 0x14600017,
883 0x00001821, 0x24020012, 0x10820014, 0x00000000, 0x9363007e, 0x9362007a,
884 0x14620007, 0x00000000, 0x9362007e, 0x24030001, 0x24420001, 0xa362007e,
885 0x03e00008, 0x00601021, 0x9362007e, 0x8f630178, 0x304200ff, 0x14430005,
886 0x00001821, 0x9362000b, 0x24030001, 0x24420001, 0xa362000b, 0x03e00008,
887 0x00601021, 0x03e00008, 0x00000000, 0x24040001, 0xaf64000c, 0x8f6300dc,
888 0x8f6200cc, 0x50620001, 0xa7640010, 0xa7640012, 0xa7640014, 0x03e00008,
889 0xa7640016, 0x3c020800, 0x8c430020, 0x27bdffe8, 0x1060001b, 0xafbf0010,
890 0x0e00148e, 0x00000000, 0x8f820018, 0xac400000, 0x8f830018, 0xac600004,
891 0x8f820018, 0xac400008, 0x8f830018, 0xac60000c, 0x8f820018, 0xac400010,
892 0x8f830018, 0x3c026000, 0xac600014, 0x8f840018, 0x8c434448, 0x3c020800,
893 0xac830018, 0x944358ce, 0x8f840018, 0x3c024020, 0x00621825, 0xac83001c,
894 0x0e0014cc, 0x24040001, 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x3c020800,
895 0x8c430020, 0x27bdffe0, 0xafb00010, 0x00a08021, 0xafb10014, 0x00c08821,
896 0xafb20018, 0x00e09021, 0x1060001e, 0xafbf001c, 0x0e00148e, 0x00000000,
897 0x8f840018, 0x8f420100, 0xac820000, 0x8f830018, 0xac700004, 0x8f820018,
898 0xac510008, 0x8f830018, 0xac72000c, 0x8f840018, 0x8fa20030, 0xac820010,
899 0x8f830018, 0x8fa20034, 0xac620014, 0x8f840018, 0x3c026000, 0x8c434448,
900 0x3c020800, 0xac830018, 0x944358ce, 0x8f840018, 0x3c0240c9, 0x00621825,
901 0xac83001c, 0x0e0014cc, 0x24040001, 0x8fbf001c, 0x8fb20018, 0x8fb10014,
902 0x8fb00010, 0x03e00008, 0x27bd0020, 0x3c020800, 0x8c430020, 0x27bdffe8,
903 0xafb00010, 0x27500100, 0x1060001d, 0xafbf0014, 0x0e00148e, 0x00000000,
904 0x8f830018, 0x8e020004, 0xac620000, 0x8f840018, 0x8e020018, 0xac820004,
905 0x8f850018, 0x8e020000, 0xaca20008, 0x8f830018, 0xac60000c, 0x8f820018,
906 0xac400010, 0x8f830018, 0xac600014, 0x8f820018, 0xac400018, 0x96030008,
907 0x3c020800, 0x944458ce, 0x8f850018, 0x00031c00, 0x00641825, 0x24040001,
908 0x0e0014cc, 0xaca3001c, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018,
909 0x3c060800, 0x24c558c0, 0x3c02000a, 0x03421821, 0x94640006, 0x94a2000a,
910 0x00441023, 0x00021400, 0x00021c03, 0x04610006, 0xa4a40006, 0x0000000d,
911 0x00000000, 0x2400005a, 0x0a0014a3, 0x24020001, 0x8f820014, 0x0062102b,
912 0x14400002, 0x00001021, 0x24020001, 0x304200ff, 0x1040001c, 0x274a0400,
913 0x3c07000a, 0x3c020800, 0x244558c0, 0x94a9000a, 0x8f880014, 0x03471021,
914 0x94430006, 0x00402021, 0xa4a30006, 0x94820006, 0xa4a20006, 0x01221023,
915 0x00021400, 0x00021403, 0x04410006, 0x0048102b, 0x0000000d, 0x00000000,
916 0x2400005a, 0x0a0014be, 0x24020001, 0x14400002, 0x00001021, 0x24020001,
917 0x304200ff, 0x1440ffec, 0x03471021, 0x24c458c0, 0x8c820010, 0xaf420038,
918 0x8c830014, 0x3c020005, 0xaf43003c, 0xaf420030, 0xaf800010, 0xaf8a0018,
919 0x03e00008, 0x00000000, 0x27bdffe0, 0x8f820010, 0x8f850018, 0x3c070800,
920 0x24e858c0, 0xafbf001c, 0xafb20018, 0xafb10014, 0xafb00010, 0x9503000a,
921 0x8d060014, 0x00009021, 0x309000ff, 0x00e08821, 0x24420001, 0x24a50020,
922 0x24630001, 0xaf820010, 0xaf850018, 0xa503000a, 0x24c30020, 0x3c028000,
923 0x04c10007, 0xad030014, 0x00621024, 0x14400005, 0x262258c0, 0x8d020010,
924 0x24420001, 0xad020010, 0x262258c0, 0x9444000a, 0x94450018, 0x0010102b,
925 0x00a41826, 0x2c630001, 0x00621825, 0x1060001c, 0x3c030006, 0x8f820010,
926 0x24120001, 0x00021140, 0x00431025, 0xaf420030, 0x00000000, 0x00000000,
927 0x00000000, 0x27450400, 0x8f420000, 0x30420010, 0x1040fffd, 0x262258c0,
928 0x9444000a, 0x94430018, 0xaf800010, 0xaf850018, 0x14830012, 0x262758c0,
929 0x0e00155a, 0x00000000, 0x1600000e, 0x262758c0, 0x0e00148e, 0x00000000,
930 0x0a001517, 0x262758c0, 0x00041c00, 0x00031c03, 0x00051400, 0x00021403,
931 0x00621823, 0x18600002, 0x3c026000, 0xac400808, 0x262758c0, 0x94e2000e,
932 0x94e3000c, 0x24420001, 0xa4e2000e, 0x3042ffff, 0x50430001, 0xa4e0000e,
933 0x12000005, 0x3c02000a, 0x94e2000a, 0xa74200a2, 0x0a001554, 0x02401021,
934 0x03421821, 0x94640006, 0x94e2000a, 0x00441023, 0x00021400, 0x00021c03,
935 0x04610006, 0xa4e40006, 0x0000000d, 0x00000000, 0x2400005a, 0x0a001536,
936 0x24020001, 0x8f820014, 0x0062102b, 0x14400002, 0x00001021, 0x24020001,
937 0x304200ff, 0x1040001b, 0x3c020800, 0x3c06000a, 0x244558c0, 0x94a8000a,
938 0x8f870014, 0x03461021, 0x94430006, 0x00402021, 0xa4a30006, 0x94820006,
939 0xa4a20006, 0x01021023, 0x00021400, 0x00021403, 0x04410006, 0x0047102b,
940 0x0000000d, 0x00000000, 0x2400005a, 0x0a001550, 0x24020001, 0x14400002,
941 0x00001021, 0x24020001, 0x304200ff, 0x1440ffec, 0x03461021, 0x02401021,
942 0x8fbf001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020,
943 0x3c020800, 0x244558c0, 0x94a3001a, 0x8ca40024, 0x00403021, 0x000318c0,
944 0x00832021, 0xaf44003c, 0x8ca20020, 0xaf420038, 0x3c020050, 0x34420008,
945 0xaf420030, 0x00000000, 0x00000000, 0x00000000, 0x8f420000, 0x30420020,
946 0x1040fffd, 0x00000000, 0x8f430400, 0x24c658c0, 0xacc30010, 0x8f420404,
947 0x3c030020, 0xacc20014, 0xaf430030, 0x94c40018, 0x94c3001c, 0x94c2001a,
948 0x94c5001e, 0x00832021, 0x24420001, 0xa4c2001a, 0x3042ffff, 0x14450002,
949 0xa4c40018, 0xa4c0001a, 0x03e00008, 0x00000000, 0x8f820010, 0x3c030006,
950 0x00021140, 0x00431025, 0xaf420030, 0x00000000, 0x00000000, 0x00000000,
951 0x27430400, 0x8f420000, 0x30420010, 0x1040fffd, 0x00000000, 0xaf800010,
952 0xaf830018, 0x03e00008, 0x00000000, 0x27bdffe8, 0xafb00010, 0x3c100800,
953 0x261058c0, 0x3c05000a, 0x02002021, 0x03452821, 0xafbf0014, 0x0e0015b0,
954 0x2406000a, 0x96020002, 0x9603001e, 0x3042000f, 0x24420003, 0x00431804,
955 0x24027fff, 0x0043102b, 0xaf830014, 0x10400004, 0x00000000, 0x0000000d,
956 0x00000000, 0x24000043, 0x0e00155a, 0x00000000, 0x8fbf0014, 0x8fb00010,
957 0x03e00008, 0x27bd0018, 0x10c00007, 0x00000000, 0x8ca20000, 0x24c6ffff,
958 0x24a50004, 0xac820000, 0x14c0fffb, 0x24840004, 0x03e00008, 0x00000000,
959 0x0a0015c1, 0x00a01021, 0xac860000, 0x00000000, 0x00000000, 0x24840004,
960 0x00a01021, 0x1440fffa, 0x24a5ffff, 0x03e00008, 0x00000000, 0x3c036000,
961 0x8c642b7c, 0x3c036010, 0x8c6553fc, 0x00041582, 0x00042302, 0x308403ff,
962 0x00052d82, 0x00441026, 0x0002102b, 0x0005282b, 0x00451025, 0x1440000d,
963 0x3c020050, 0x34420004, 0xaf400038, 0xaf40003c, 0xaf420030, 0x00000000,
964 0x00000000, 0x8f420000, 0x30420020, 0x1040fffd, 0x3c020020, 0xaf420030,
965 0x0000000d, 0x03e00008, 0x00000000, 0x3c020050, 0x34420004, 0xaf440038,
966 0xaf45003c, 0xaf420030, 0x00000000, 0x00000000, 0x8f420000, 0x30420020,
967 0x1040fffd, 0x3c020020, 0xaf420030, 0x03e00008, 0x00000000, 0x00000000};
968 666
969static u32 bnx2_COM_b06FwData[(0x0/4) + 1] = { 0x0 }; 667static u32 bnx2_COM_b06FwData[(0x0/4) + 1] = { 0x0 };
970static u32 bnx2_COM_b06FwRodata[(0x58/4) + 1] = { 668static u32 bnx2_COM_b06FwRodata[(0x58/4) + 1] = {
@@ -989,952 +687,368 @@ static u32 bnx2_RXP_b06FwBssAddr = 0x08005900;
989static int bnx2_RXP_b06FwBssLen = 0x13a4; 687static int bnx2_RXP_b06FwBssLen = 0x13a4;
990static u32 bnx2_RXP_b06FwSbssAddr = 0x080058e0; 688static u32 bnx2_RXP_b06FwSbssAddr = 0x080058e0;
991static int bnx2_RXP_b06FwSbssLen = 0x1c; 689static int bnx2_RXP_b06FwSbssLen = 0x1c;
992static u32 bnx2_RXP_b06FwText[(0x588c/4) + 1] = { 690static u8 bnx2_RXP_b06FwText[] = {
993 0x0a000c61, 0x00000000, 0x00000000, 0x0000000d, 0x72787020, 0x322e362e, 691 0x1f, 0x8b, 0x08, 0x08, 0x07, 0x87, 0x41, 0x44, 0x00, 0x03, 0x74, 0x65,
994 0x31000000, 0x02060103, 0x00000000, 0x0000000d, 0x00000000, 0x00000000, 692 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xed, 0x5c, 0x5d, 0x6c,
995 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 693 0x1c, 0xd7, 0x75, 0x3e, 0xf3, 0x43, 0x71, 0x49, 0x91, 0xd4, 0x70, 0xb9,
996 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 694 0x62, 0x57, 0x12, 0x65, 0xed, 0x8a, 0x43, 0x71, 0x6d, 0x31, 0xce, 0x50,
997 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 695 0x58, 0xdb, 0x82, 0xb1, 0x48, 0xc7, 0xb3, 0xa4, 0xc8, 0x24, 0x02, 0x42,
998 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 696 0x1b, 0x42, 0xab, 0xa4, 0xa9, 0xc1, 0x90, 0x72, 0x91, 0x22, 0x2c, 0xa0,
999 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 697 0x1a, 0x79, 0xf0, 0x43, 0x10, 0x2f, 0x56, 0x3f, 0xa6, 0xd1, 0x8d, 0x96,
1000 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 698 0xb6, 0x1c, 0x53, 0x08, 0x82, 0x82, 0xe5, 0x52, 0x52, 0x0b, 0x2c, 0xb4,
1001 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 699 0x96, 0xed, 0x36, 0x7e, 0xa8, 0x23, 0x9a, 0x92, 0x8d, 0xa6, 0x68, 0x81,
1002 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 700 0x22, 0xad, 0xd1, 0xf4, 0x4d, 0x95, 0x9a, 0x4a, 0x75, 0x5f, 0xd4, 0xa2,
1003 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 701 0x48, 0xda, 0x46, 0xcd, 0xf4, 0xfb, 0xee, 0xcc, 0x88, 0xd4, 0x9a, 0xb2,
1004 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 702 0x2c, 0x3b, 0x0d, 0x62, 0x74, 0x0e, 0x30, 0xd8, 0xb9, 0x7f, 0xe7, 0xef,
1005 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 703 0x9e, 0x73, 0xee, 0x39, 0x77, 0x28, 0x7d, 0xa5, 0x43, 0xda, 0x25, 0x84,
1006 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 704 0x4e, 0x3c, 0x99, 0xc3, 0xcf, 0x3c, 0xfd, 0xe0, 0xc3, 0x0f, 0xee, 0xc1,
1007 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 705 0xeb, 0xb0, 0xa1, 0x6d, 0xd0, 0xa3, 0xfe, 0x18, 0x62, 0x88, 0x21, 0x86,
1008 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 706 0x18, 0x62, 0x88, 0x21, 0x86, 0x18, 0x62, 0x88, 0x21, 0x86, 0x18, 0x62,
1009 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 707 0x88, 0x21, 0x86, 0x18, 0x62, 0x88, 0x21, 0x86, 0x18, 0x62, 0x88, 0x21,
1010 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 708 0x86, 0x18, 0x62, 0x88, 0x21, 0x86, 0x18, 0x62, 0x88, 0x21, 0x86, 0x18,
1011 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 709 0x62, 0x88, 0x21, 0x86, 0x18, 0x62, 0x88, 0x21, 0x86, 0x18, 0x62, 0x88,
1012 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 710 0x21, 0x86, 0x18, 0x62, 0x88, 0x21, 0x86, 0xff, 0xef, 0x60, 0x88, 0x58,
1013 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 711 0xfc, 0xed, 0x0c, 0x1f, 0x49, 0xe8, 0x85, 0xcb, 0x07, 0x3d, 0x5b, 0x12,
1014 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 712 0x46, 0x61, 0x69, 0x66, 0xda, 0x16, 0x71, 0xeb, 0xbb, 0x33, 0x45, 0xf9,
1015 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 713 0x1f, 0xbf, 0x94, 0x32, 0x85, 0xfd, 0xdb, 0x0b, 0x37, 0x9f, 0x7d, 0xf3,
1016 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 714 0x91, 0xec, 0x8d, 0x05, 0x43, 0x12, 0x56, 0xe1, 0xe8, 0xb0, 0xb5, 0x4b,
1017 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 715 0x12, 0x7d, 0x58, 0xf3, 0xdd, 0xc1, 0xcf, 0x59, 0xd2, 0x15, 0xe1, 0xba,
1018 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 716 0xee, 0xbf, 0x39, 0x68, 0xc9, 0x2b, 0x8d, 0x94, 0x5c, 0x68, 0x6c, 0xdf,
1019 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 717 0x24, 0x5d, 0xd9, 0x52, 0x09, 0xfd, 0x6e, 0x8a, 0xe3, 0x96, 0x94, 0xab,
1020 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 718 0x2d, 0xe2, 0x2a, 0xba, 0x7d, 0x5a, 0x71, 0xfe, 0x3e, 0xcd, 0x9b, 0x7f,
1021 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 719 0x9e, 0xff, 0x1e, 0x24, 0xa5, 0xcb, 0x7d, 0x68, 0xf7, 0xa1, 0xcd, 0xf7,
1022 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 720 0x81, 0xf4, 0x94, 0x98, 0x72, 0xa4, 0x91, 0x90, 0xa3, 0xd5, 0x8c, 0xe8,
1023 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 721 0x05, 0x71, 0xbd, 0xbc, 0x9d, 0x2e, 0xa3, 0x6f, 0xea, 0x00, 0xdb, 0x29,
1024 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 722 0xe0, 0xf9, 0x0e, 0xd7, 0x59, 0x5e, 0x5e, 0x4a, 0xb7, 0xc6, 0x14, 0x0d,
1025 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 723 0x8e, 0xb1, 0x0f, 0xbf, 0x58, 0x5f, 0xae, 0x76, 0x00, 0x6f, 0xd6, 0x71,
1026 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 724 0x41, 0xdc, 0x73, 0x2c, 0xd0, 0xf6, 0xfd, 0xdf, 0x75, 0x32, 0xb2, 0xe2,
1027 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 725 0x74, 0x81, 0xa7, 0x16, 0x69, 0xb5, 0xc5, 0xd2, 0x0b, 0xb6, 0xb5, 0x22,
1028 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 726 0x6d, 0x1c, 0xeb, 0x34, 0x0a, 0xbe, 0x3f, 0x9d, 0x97, 0xae, 0xa0, 0x6f,
1029 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 727 0xb7, 0xe2, 0x63, 0x72, 0x42, 0xc3, 0xbc, 0x57, 0x49, 0x0f, 0x3a, 0xe2,
1030 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 728 0x3b, 0x7f, 0xf3, 0x52, 0xac, 0x6c, 0x97, 0xc9, 0x54, 0xf6, 0xa0, 0x1b,
1031 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 729 0xd0, 0x74, 0x3d, 0x67, 0x2b, 0x70, 0x6a, 0xe0, 0x4f, 0xdb, 0x81, 0xf5,
1032 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 730 0xee, 0x0a, 0x68, 0x1a, 0x85, 0xcd, 0x62, 0x6c, 0x66, 0x9f, 0xe8, 0x3b,
1033 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 731 0x87, 0x93, 0xe1, 0x78, 0x97, 0x36, 0x32, 0x6f, 0x88, 0x6e, 0xff, 0x81,
1034 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 732 0xe6, 0xd5, 0x7a, 0xe5, 0xd8, 0xbc, 0x8e, 0x77, 0x5d, 0xae, 0xe6, 0x4b,
1035 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 733 0x9a, 0xdb, 0xa8, 0x68, 0xde, 0xd9, 0x59, 0xad, 0x78, 0xd6, 0x94, 0xa3,
1036 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 734 0xb6, 0x7f, 0xe1, 0xb4, 0x73, 0x42, 0x1b, 0x39, 0x7b, 0x46, 0x1b, 0x3d,
1037 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 735 0xfb, 0x86, 0x36, 0xde, 0xd8, 0xb2, 0x49, 0xda, 0xb3, 0xd0, 0x1e, 0x71,
1038 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 736 0x90, 0xbf, 0x4f, 0x87, 0xba, 0xec, 0xa2, 0xde, 0x4a, 0xe4, 0x7d, 0x9f,
1039 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 737 0xf3, 0x86, 0xe6, 0x55, 0x6d, 0x8b, 0xfb, 0xe6, 0xa6, 0x22, 0x1a, 0xed,
1040 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 738 0x72, 0x74, 0xde, 0x94, 0x63, 0xd5, 0x94, 0x3c, 0x57, 0x2d, 0x29, 0x5a,
1041 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 739 0x86, 0x5d, 0xd2, 0xbc, 0x06, 0xc7, 0x2b, 0xa0, 0x75, 0x42, 0xdb, 0x07,
1042 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 740 0x9a, 0xde, 0x59, 0x29, 0x5d, 0x71, 0xe6, 0x40, 0xaf, 0x03, 0x78, 0xff,
1043 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 741 0x58, 0x1b, 0x6d, 0xf4, 0x6a, 0xde, 0xc9, 0x9b, 0xe2, 0x39, 0x59, 0xeb,
1044 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 742 0x4b, 0x62, 0xba, 0xb0, 0x01, 0xc8, 0x0c, 0xfd, 0x38, 0xd0, 0x49, 0xca,
1045 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 743 0xf7, 0xf5, 0x82, 0xff, 0x2c, 0x74, 0x6f, 0x5d, 0xa1, 0xfc, 0x8d, 0x5e,
1046 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 744 0x29, 0xcf, 0x53, 0xd7, 0xa6, 0x36, 0x52, 0xf5, 0x2f, 0x78, 0x8e, 0xf4,
1047 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 745 0x19, 0xe2, 0xfb, 0x47, 0x9d, 0x81, 0xf4, 0x21, 0x39, 0x03, 0xdc, 0x75,
1048 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 746 0xad, 0xd8, 0xa0, 0xae, 0xc1, 0xdf, 0x2d, 0x39, 0x02, 0xbd, 0x15, 0x9d,
1049 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 747 0x5e, 0x99, 0xb4, 0xb2, 0x2e, 0xf6, 0x68, 0x53, 0x20, 0x57, 0x32, 0xb4,
1050 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 748 0x17, 0xd2, 0xe7, 0xde, 0x67, 0xd3, 0x9e, 0xa1, 0xcb, 0x53, 0x2f, 0x3d,
1051 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 749 0xdf, 0xb3, 0x38, 0xb4, 0x91, 0x32, 0x43, 0xff, 0xf2, 0x45, 0xcf, 0xf6,
1052 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 750 0xb6, 0xb4, 0x48, 0x29, 0x6d, 0x48, 0x16, 0xfb, 0xb4, 0x43, 0x4e, 0x3b,
1053 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 751 0x22, 0x87, 0x2a, 0xd0, 0x8d, 0x6d, 0x5a, 0x8b, 0x62, 0x67, 0xca, 0x32,
1054 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 752 0x50, 0x32, 0x75, 0x74, 0x26, 0x49, 0x97, 0x3a, 0xd2, 0xe5, 0x7a, 0x9e,
1055 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 753 0x7a, 0xa2, 0x3d, 0x7f, 0x28, 0x5d, 0x69, 0xab, 0xba, 0x5a, 0xd5, 0xd3,
1056 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 754 0xf8, 0x2f, 0x5d, 0x4f, 0xd4, 0xc9, 0x72, 0x28, 0xb7, 0x03, 0xdc, 0x8f,
1057 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 755 0x40, 0x5f, 0xe2, 0xea, 0xc3, 0x0f, 0xb1, 0x6f, 0x93, 0x51, 0xb0, 0xd3,
1058 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 756 0x17, 0x61, 0x14, 0x7a, 0x61, 0x37, 0x64, 0x19, 0xa6, 0xee, 0xe0, 0xc3,
1059 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 757 0x1f, 0x49, 0x5e, 0xf9, 0xd5, 0x90, 0x97, 0xfc, 0xdb, 0x32, 0x55, 0x49,
1060 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 758 0x80, 0x06, 0x65, 0xd4, 0xe5, 0xbd, 0x7c, 0x64, 0x1b, 0x7b, 0x20, 0x5f,
1061 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 759 0x5e, 0xa6, 0xbe, 0x45, 0x7f, 0xa2, 0xfd, 0xf3, 0x9d, 0xb2, 0xfe, 0xcc,
1062 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 760 0xbf, 0xee, 0x7c, 0x92, 0xf6, 0x96, 0x7c, 0x27, 0xe4, 0x78, 0x35, 0xc9,
1063 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 761 0x3d, 0xd4, 0x56, 0x54, 0x6c, 0x8a, 0x64, 0x14, 0xdd, 0x28, 0x74, 0x48,
1064 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 762 0x51, 0xed, 0xf7, 0x5e, 0xd0, 0x43, 0x2c, 0xa8, 0xf2, 0xbd, 0xa0, 0x64,
1065 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 763 0x9b, 0xb6, 0xed, 0xcc, 0x11, 0xc9, 0xc2, 0xbe, 0x45, 0x8e, 0xcc, 0x99,
1066 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 764 0x32, 0x6d, 0xff, 0x63, 0xa7, 0xb4, 0x2f, 0xdf, 0x6f, 0xa8, 0xb8, 0xae,
1067 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 765 0xf7, 0x6e, 0x90, 0x4d, 0xe0, 0x77, 0xf9, 0x7e, 0x5d, 0xe4, 0xa6, 0x59,
1068 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 766 0xc8, 0x5a, 0x23, 0x08, 0xf6, 0x46, 0x81, 0xb1, 0x4c, 0x43, 0x2c, 0x93,
1069 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 767 0x44, 0x8b, 0x4d, 0x7d, 0xf9, 0xfe, 0xf8, 0xf0, 0xdd, 0xf5, 0x75, 0x64,
1070 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 768 0x9e, 0xb4, 0xa9, 0x2f, 0xc6, 0xa8, 0x12, 0xf4, 0xc1, 0xf8, 0x74, 0xbb,
1071 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 769 0xae, 0x8a, 0xa1, 0xae, 0x46, 0xfe, 0xef, 0xed, 0xc2, 0xf5, 0xaa, 0xa2,
1072 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 770 0x79, 0xce, 0xbb, 0xa1, 0x2f, 0xd8, 0x32, 0x02, 0x7f, 0x37, 0xec, 0x4f,
1073 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 771 0xcb, 0x91, 0x54, 0x76, 0xc2, 0x95, 0xc0, 0xe6, 0xaf, 0xad, 0xb1, 0xf9,
1074 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 772 0xd1, 0xbb, 0xc8, 0x75, 0x3c, 0x94, 0xcb, 0x0d, 0xe5, 0x1a, 0x85, 0x5c,
1075 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 773 0x63, 0x90, 0x6b, 0xe5, 0x23, 0xc8, 0xb5, 0xf2, 0x91, 0xe5, 0xd2, 0xa4,
1076 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 774 0xec, 0x3c, 0x08, 0x5a, 0xa6, 0xfc, 0xab, 0x13, 0xd8, 0xf2, 0xbf, 0x38,
1077 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 775 0x9f, 0x14, 0x19, 0x7c, 0x7f, 0x70, 0xd8, 0x16, 0xef, 0x5b, 0xe0, 0xd5,
1078 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 776 0x71, 0x40, 0x8b, 0xef, 0xef, 0x97, 0xe1, 0x6e, 0xfe, 0x38, 0x8b, 0x7d,
1079 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 777 0x5d, 0xcf, 0x1f, 0x29, 0x87, 0x3e, 0x7c, 0xef, 0xfe, 0xa8, 0x6b, 0x1f,
1080 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 778 0x55, 0x0e, 0xc6, 0x9c, 0x4f, 0x35, 0x9d, 0xab, 0x1f, 0x56, 0x86, 0xf5,
1081 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 779 0x63, 0xca, 0x2f, 0x4f, 0x86, 0xc7, 0x64, 0x72, 0x33, 0xed, 0xa9, 0xa4,
1082 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 780 0x8d, 0x0c, 0x92, 0xef, 0xb5, 0xfc, 0x4a, 0x26, 0xe0, 0x0d, 0x39, 0xd1,
1083 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 781 0xd2, 0x46, 0x39, 0xb2, 0x60, 0x49, 0x69, 0xe9, 0x4e, 0x71, 0x57, 0x03,
1084 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 782 0x6f, 0xb4, 0x47, 0xf6, 0x7d, 0xd2, 0x7c, 0x2a, 0xc8, 0x2b, 0x2e, 0x54,
1085 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 783 0x91, 0x83, 0x56, 0x13, 0x72, 0xd9, 0x48, 0xcb, 0x9b, 0x83, 0x87, 0xe5,
1086 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 784 0xf3, 0xd5, 0x24, 0xe8, 0x31, 0x9f, 0x2c, 0xe7, 0x10, 0x17, 0xb5, 0xb2,
1087 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 785 0x63, 0x08, 0x79, 0xaf, 0xd9, 0x9c, 0x13, 0xc4, 0x96, 0x72, 0x10, 0x83,
1088 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 786 0x5d, 0x6f, 0x50, 0xe5, 0x14, 0x90, 0x4f, 0x64, 0x0c, 0xb1, 0xb7, 0x66,
1089 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 787 0xb3, 0xcd, 0xfe, 0xa0, 0xef, 0xb3, 0x95, 0x5e, 0xad, 0xc8, 0xbc, 0x64,
1090 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 788 0xf0, 0xa6, 0x4c, 0x3b, 0x41, 0xdf, 0xe7, 0x2a, 0xa3, 0x9b, 0x98, 0x1f,
1091 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 789 0x1a, 0x05, 0xc9, 0x94, 0x9d, 0xf7, 0x7c, 0xd7, 0xba, 0x7d, 0xcd, 0xfa,
1092 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 790 0x78, 0xb2, 0x13, 0x81, 0xce, 0x45, 0xfb, 0xaa, 0xad, 0xf7, 0xb6, 0x4a,
1093 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 791 0x09, 0x27, 0x5d, 0xd6, 0x1a, 0x47, 0xe7, 0xbe, 0x4a, 0x79, 0x5b, 0xab,
1094 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 792 0xdc, 0x34, 0x80, 0x3f, 0x6d, 0x68, 0x62, 0x1e, 0xaa, 0x94, 0xbb, 0xd9,
1095 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 793 0xa6, 0xbe, 0x74, 0x4d, 0x12, 0xa3, 0x15, 0x5f, 0xae, 0x3a, 0x41, 0xee,
1096 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 794 0x63, 0x68, 0x7a, 0x6f, 0x5b, 0xb8, 0x56, 0xd7, 0x76, 0x39, 0x97, 0x44,
1097 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 795 0x3a, 0x0e, 0x55, 0xc4, 0x2a, 0x56, 0x76, 0x39, 0x6f, 0x4b, 0xb9, 0xa7,
1098 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 796 0x6d, 0x75, 0x5d, 0x8a, 0xeb, 0x76, 0x0e, 0xaf, 0x9d, 0xbb, 0xcb, 0xb9,
1099 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 797 0x28, 0xe5, 0x2d, 0x6d, 0xab, 0xb4, 0xd2, 0x58, 0xdb, 0x17, 0xac, 0xe5,
1100 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 798 0xf8, 0x66, 0x71, 0xbb, 0x39, 0x47, 0xef, 0x6d, 0xbf, 0x45, 0x43, 0x32,
1101 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 799 0xc5, 0x4a, 0xb9, 0xa7, 0x7d, 0x15, 0xaf, 0x4d, 0xbc, 0xde, 0x1a, 0xbc,
1102 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 800 0xc4, 0xd9, 0xbe, 0x8a, 0x33, 0x07, 0x9c, 0x43, 0xab, 0x38, 0x39, 0x7e,
1103 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 801 0x58, 0x8a, 0x38, 0xd3, 0x5a, 0x0a, 0x32, 0xbc, 0x54, 0xc9, 0x48, 0x79,
1104 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 802 0x28, 0x01, 0xdd, 0xf7, 0x1f, 0xfc, 0x9a, 0xaa, 0x43, 0xcc, 0x61, 0x0f,
1105 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 803 0xba, 0x32, 0x55, 0x5e, 0x87, 0xd8, 0x08, 0xdb, 0xf8, 0x5a, 0x5d, 0x86,
1106 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 804 0x17, 0xeb, 0xa6, 0x1c, 0x6f, 0x70, 0xbf, 0x98, 0xe3, 0x05, 0x75, 0xc6,
1107 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 805 0x85, 0x46, 0x4e, 0xdb, 0x87, 0xbd, 0x66, 0x9d, 0xb0, 0xaf, 0x61, 0x6a,
1108 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 806 0xa3, 0x3c, 0x1f, 0x80, 0x97, 0x76, 0x7e, 0xac, 0x41, 0xdb, 0x79, 0x03,
1109 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 807 0xb6, 0x41, 0xce, 0xa3, 0x9c, 0xbd, 0x95, 0xb9, 0x53, 0x66, 0xd1, 0x51,
1110 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 808 0x75, 0x88, 0x56, 0xcb, 0x77, 0x20, 0x07, 0x4d, 0xa0, 0xd6, 0x80, 0xcd,
1111 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 809 0xdb, 0x78, 0x6f, 0x70, 0xde, 0x32, 0xe6, 0x6d, 0xe0, 0x3c, 0xec, 0xcd,
1112 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 810 0x25, 0xe5, 0x0f, 0xa6, 0xcd, 0xf1, 0x77, 0xb1, 0xc7, 0x68, 0xd7, 0x59,
1113 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 811 0x57, 0x58, 0x02, 0x5f, 0xc1, 0x3e, 0xa2, 0x6e, 0x48, 0xed, 0x60, 0x7e,
1114 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 812 0x8f, 0xb9, 0x19, 0xcc, 0xcd, 0x66, 0x18, 0xcf, 0x3d, 0xfb, 0x99, 0x0e,
1115 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 813 0xe9, 0x42, 0xbb, 0xce, 0x35, 0xd9, 0x0c, 0x72, 0x5b, 0xdf, 0xcb, 0xb7,
1116 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 814 0xc9, 0x4a, 0xca, 0xbf, 0x60, 0xd8, 0xd1, 0xdc, 0x08, 0x6f, 0xf3, 0x5c,
1117 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 815 0xe6, 0xc5, 0xc4, 0xbd, 0x21, 0xcc, 0x83, 0xc7, 0xc5, 0x6d, 0xfc, 0x49,
1118 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 816 0xb7, 0x74, 0xb9, 0xf8, 0x8d, 0xe6, 0x4c, 0x6f, 0x0e, 0x6a, 0x2e, 0xbe,
1119 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 817 0xb7, 0x50, 0x3e, 0x17, 0xe7, 0xa1, 0x56, 0xac, 0x66, 0x26, 0x59, 0x1f,
1120 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 818 0x15, 0xeb, 0x6c, 0xef, 0x85, 0x3f, 0x04, 0x75, 0xd7, 0x85, 0x5b, 0xbe,
1121 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 819 0x70, 0x19, 0x7a, 0x4b, 0x43, 0x6f, 0x29, 0x39, 0xdf, 0x60, 0x9d, 0xe6,
1122 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 820 0x42, 0x5f, 0x19, 0xf1, 0x1a, 0xe3, 0x58, 0x2b, 0x87, 0x81, 0x03, 0x3a,
1123 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 821 0x17, 0x47, 0x2f, 0x64, 0x65, 0xca, 0xda, 0x1d, 0xf1, 0x00, 0x5c, 0x88,
1124 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 822 0x1f, 0x85, 0x36, 0xf4, 0xf1, 0x1d, 0x9a, 0x53, 0xff, 0x86, 0x7f, 0x94,
1125 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 823 0xed, 0x09, 0xbd, 0x30, 0xd6, 0xd4, 0xbf, 0x6e, 0xfc, 0xa1, 0x1c, 0x68,
1126 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 824 0x33, 0x06, 0x31, 0xfe, 0xe8, 0xa8, 0xf3, 0x18, 0x8b, 0x48, 0xd7, 0x92,
1127 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 825 0x23, 0x4b, 0x23, 0xdc, 0x37, 0x8b, 0xf1, 0xa7, 0x5c, 0xe7, 0x9e, 0x29,
1128 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 826 0x5c, 0xc0, 0x19, 0xad, 0xf1, 0xfd, 0x11, 0x87, 0x6b, 0x7c, 0x99, 0x70,
1129 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 827 0x3a, 0xc4, 0x48, 0x96, 0xb4, 0xc7, 0x07, 0x11, 0x7b, 0x1e, 0xe0, 0x3e,
1130 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 828 0x32, 0x06, 0x6d, 0x17, 0xb0, 0xea, 0xb4, 0x3c, 0x3c, 0xc8, 0x75, 0xa0,
1131 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 829 0xdd, 0x2a, 0x7a, 0x92, 0x34, 0xf3, 0x21, 0x4f, 0x43, 0xdd, 0x81, 0xbe,
1132 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 830 0x06, 0xac, 0x40, 0x7f, 0x9f, 0xe9, 0x5e, 0xd5, 0x1f, 0xd7, 0x35, 0xf3,
1133 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 831 0xcb, 0x18, 0x96, 0x90, 0x81, 0x33, 0x1b, 0x65, 0xe7, 0xa2, 0x25, 0xf6,
1134 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 832 0x99, 0x55, 0xfe, 0x76, 0x9e, 0x5b, 0xcb, 0x5f, 0xf4, 0x7f, 0x15, 0x5c,
1135 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 833 0xd0, 0xc5, 0x8e, 0xfa, 0x1e, 0x4b, 0x05, 0xb8, 0xa3, 0xf6, 0x7b, 0xe1,
1136 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 834 0x5e, 0xf1, 0xfd, 0x99, 0x70, 0x4f, 0xb0, 0x07, 0x88, 0x95, 0xe7, 0x6f,
1137 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 835 0xc5, 0xa9, 0x0c, 0xf6, 0x06, 0xb6, 0xa7, 0xe2, 0x11, 0xe3, 0x18, 0xed,
1138 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 836 0xbb, 0x63, 0xd2, 0x2c, 0xb0, 0x8e, 0xe6, 0x3e, 0xc9, 0x44, 0xb9, 0x22,
1139 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 837 0xa5, 0xad, 0x85, 0x67, 0x7d, 0xd8, 0xcf, 0xa4, 0xa5, 0x6c, 0xaf, 0x63,
1140 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 838 0xaf, 0x97, 0x37, 0xa0, 0x1b, 0x8c, 0xc1, 0x26, 0xf5, 0x42, 0x42, 0x8a,
1141 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 839 0x8d, 0x44, 0xc2, 0x3c, 0x31, 0xf0, 0x23, 0xcf, 0x48, 0x24, 0xf4, 0x13,
1142 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 840 0x81, 0x9d, 0x4d, 0xd6, 0x6f, 0x20, 0x56, 0x6a, 0x72, 0x74, 0xe8, 0x86,
1143 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 841 0xcf, 0x1a, 0xd8, 0xdb, 0x0b, 0x9b, 0x1b, 0x82, 0xcf, 0x80, 0x8f, 0x72,
1144 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 842 0xa3, 0xa3, 0x37, 0xe0, 0xed, 0x2b, 0x11, 0x8f, 0xa6, 0x8e, 0xdc, 0xd3,
1145 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 843 0xcb, 0xfb, 0xbe, 0x51, 0xd8, 0x90, 0x98, 0xce, 0x8f, 0x6f, 0xd1, 0xcf,
1146 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 844 0xed, 0xdf, 0x62, 0x9c, 0x2b, 0x6d, 0x01, 0x3e, 0xdd, 0xcb, 0xe3, 0xf7,
1147 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 845 0x9c, 0xc8, 0x44, 0x15, 0x3a, 0xdf, 0x03, 0x3d, 0x59, 0xf0, 0xc5, 0x3d,
1148 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 846 0xa6, 0xca, 0xd1, 0xf5, 0x3d, 0x2f, 0x6e, 0x0a, 0x70, 0xf0, 0xfd, 0x27,
1149 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 847 0x7e, 0x70, 0x86, 0x5e, 0x0e, 0xfb, 0x7e, 0x3f, 0xdc, 0x87, 0x5f, 0x45,
1150 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 848 0xb9, 0x78, 0x5e, 0x44, 0xb2, 0xad, 0x3d, 0x37, 0xb2, 0xe3, 0x25, 0x9c,
1151 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 849 0x33, 0xa7, 0x1d, 0xdf, 0x7f, 0x07, 0xcf, 0x35, 0xa7, 0xd9, 0x46, 0xde,
1152 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 850 0x7f, 0xf6, 0x31, 0x07, 0xf8, 0x2c, 0xce, 0xbd, 0xd1, 0xa6, 0xb3, 0xff,
1153 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 851 0x5e, 0xcf, 0xbd, 0x7b, 0x3f, 0xfb, 0xc9, 0xf3, 0x1d, 0x7d, 0xef, 0x03,
1154 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 852 0xce, 0xfe, 0x0f, 0x5c, 0x77, 0x0f, 0x3e, 0x1b, 0xd8, 0x6d, 0xb1, 0xd1,
1155 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 853 0x1c, 0x5f, 0xee, 0xd5, 0x7f, 0x7f, 0xad, 0xfb, 0x76, 0xff, 0xb5, 0xbb,
1156 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 854 0x6f, 0xf7, 0xdf, 0xcd, 0xdd, 0xbf, 0x18, 0xff, 0xcd, 0x01, 0x0f, 0x7d,
1157 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 855 0x70, 0xad, 0xff, 0xae, 0xe7, 0x93, 0xd4, 0xf7, 0xf3, 0x3d, 0xe5, 0xa1,
1158 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 856 0xce, 0x30, 0x1f, 0x52, 0xe7, 0xf5, 0x17, 0xa7, 0x6d, 0xef, 0x7e, 0x53,
1159 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 857 0x4a, 0xb9, 0x16, 0xc9, 0xe6, 0x6a, 0xb2, 0x43, 0x8e, 0x3b, 0x22, 0x4b,
1160 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 858 0xaa, 0x16, 0x31, 0x51, 0x8b, 0x0f, 0xa0, 0x3e, 0x0b, 0xf4, 0xba, 0xa4,
1161 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 859 0xf4, 0xf2, 0x02, 0x78, 0x89, 0xf0, 0x74, 0xdd, 0x05, 0x0f, 0x71, 0x10,
1162 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 860 0x17, 0xf1, 0x0c, 0xe2, 0x7c, 0xb7, 0xd7, 0xc1, 0x85, 0x73, 0xea, 0x25,
1163 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 861 0xd4, 0x64, 0xb6, 0xde, 0xa3, 0x07, 0x67, 0xb2, 0x5b, 0x96, 0xdd, 0xe9,
1164 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 862 0xeb, 0xf2, 0x05, 0x9e, 0x59, 0x0a, 0xae, 0xce, 0x21, 0x56, 0x0f, 0x8d,
1165 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 863 0x85, 0x75, 0xd2, 0xdc, 0x41, 0xcf, 0x8e, 0xee, 0x49, 0x78, 0x47, 0x92,
1166 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 864 0x90, 0x92, 0x9a, 0xb5, 0x04, 0x1d, 0x68, 0x72, 0x0d, 0x67, 0xd0, 0xd5,
1167 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 865 0xb9, 0x76, 0xe0, 0x45, 0xee, 0x77, 0x20, 0xbb, 0x57, 0xb4, 0x7e, 0xab,
1168 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 866 0x55, 0x6b, 0x87, 0x2f, 0x65, 0xc4, 0x55, 0x6d, 0x9e, 0xd3, 0xa7, 0x66,
1169 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 867 0x16, 0x2b, 0xc8, 0x03, 0x6d, 0x9c, 0xaf, 0x79, 0xbc, 0xd7, 0x49, 0x43,
1170 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 868 0x93, 0x2b, 0x73, 0xba, 0xfc, 0xd3, 0x9c, 0x21, 0xff, 0x8c, 0x3a, 0xf4,
1171 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 869 0x9a, 0x7d, 0x6a, 0xe6, 0xb4, 0x2d, 0xf7, 0x81, 0xd5, 0xf0, 0x0e, 0x4f,
1172 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 870 0x76, 0x9a, 0x42, 0x5b, 0x1d, 0x48, 0xff, 0x8e, 0x20, 0xff, 0xc1, 0x9a,
1173 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 871 0x2b, 0x73, 0xa4, 0xb5, 0x76, 0x8d, 0xf4, 0x22, 0x1f, 0x83, 0x5d, 0x0f,
1174 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 872 0x30, 0x27, 0xe2, 0x7c, 0xd4, 0xab, 0x03, 0xd6, 0x3e, 0xc5, 0x5b, 0x42,
1175 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 873 0x16, 0xeb, 0x9c, 0x6f, 0x82, 0xb7, 0x2e, 0x9c, 0x31, 0x59, 0x6b, 0x52,
1176 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 874 0xfe, 0xb0, 0x5b, 0xe5, 0xaa, 0x1a, 0xfb, 0x0d, 0xb5, 0xc7, 0xef, 0xef,
1177 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 875 0xe7, 0xde, 0x1b, 0x32, 0x95, 0x62, 0x9b, 0x63, 0x59, 0xd4, 0x9c, 0xc4,
1178 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 876 0x97, 0xdd, 0xeb, 0x0a, 0x79, 0x0e, 0xde, 0xaf, 0x08, 0x65, 0xdb, 0x6d,
1179 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 877 0x5d, 0x97, 0xd7, 0x7d, 0xf7, 0x00, 0xe5, 0x89, 0x72, 0x8b, 0x39, 0x9f,
1180 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 878 0xb1, 0xd8, 0x28, 0xcc, 0xc0, 0x8e, 0xbf, 0x2a, 0xdf, 0x6f, 0x1c, 0x92,
1181 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 879 0xef, 0x35, 0x26, 0xe5, 0xcf, 0x1a, 0x5f, 0x96, 0x3f, 0x6d, 0x1c, 0x94,
1182 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 880 0xd7, 0x1b, 0x07, 0xe4, 0xb5, 0xc6, 0x84, 0xbc, 0xda, 0xd8, 0x0f, 0x1b,
1183 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 881 0x1f, 0x87, 0x8d, 0x9f, 0x9a, 0x99, 0xac, 0xf7, 0xcb, 0xd4, 0x49, 0xc4,
1184 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 882 0x20, 0xe7, 0x1b, 0xba, 0xba, 0xe3, 0xb3, 0xe9, 0xe7, 0x2d, 0x32, 0xad,
1185 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 883 0xee, 0xaf, 0x34, 0xe4, 0x89, 0x2d, 0xbc, 0x2b, 0x7c, 0xc5, 0x33, 0x2e,
1186 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 884 0x87, 0xf1, 0xe8, 0xe1, 0x94, 0xb4, 0x03, 0xbf, 0xca, 0x4b, 0x4d, 0x9e,
1187 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 885 0xdb, 0x62, 0x86, 0xf7, 0x9c, 0x87, 0x24, 0xc9, 0xfb, 0xb0, 0x9c, 0x67,
1188 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 886 0xa0, 0xde, 0x5e, 0xd7, 0x27, 0x73, 0xb4, 0x65, 0xe8, 0xc6, 0x95, 0x43,
1189 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 887 0xb0, 0x53, 0xc3, 0x7e, 0xcb, 0xa5, 0x1e, 0x16, 0x97, 0x28, 0xf7, 0x46,
1190 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 888 0x59, 0x5c, 0xa0, 0x6f, 0xff, 0x1b, 0x64, 0x6c, 0x97, 0xda, 0x82, 0x89,
1191 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 889 0xb9, 0x6e, 0x98, 0xab, 0x6c, 0xa7, 0x3d, 0x00, 0x1f, 0xf1, 0x7e, 0x10,
1192 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 890 0x4e, 0xab, 0x09, 0x27, 0xf1, 0x24, 0x54, 0x0c, 0x08, 0x70, 0x5b, 0x52,
1193 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 891 0x5b, 0x4a, 0xca, 0xc2, 0x42, 0x0f, 0x9e, 0x94, 0x2c, 0xd4, 0x6d, 0x3c,
1194 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 892 0x39, 0x3c, 0x43, 0x78, 0xd2, 0xb0, 0x53, 0xca, 0xc8, 0xd8, 0x12, 0xc9,
1195 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 893 0x88, 0x78, 0x5c, 0xed, 0x0d, 0x6b, 0x2a, 0xf2, 0xa3, 0x85, 0xfc, 0x74,
1196 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 894 0x87, 0x7d, 0x1d, 0x52, 0xab, 0x38, 0x32, 0x55, 0xfd, 0x94, 0x3e, 0xa5,
1197 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 895 0x74, 0x07, 0xfc, 0x95, 0x21, 0xb4, 0xef, 0x0f, 0xdb, 0x8f, 0xca, 0xf4,
1198 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 896 0xbc, 0xc8, 0xca, 0xcb, 0x03, 0x7a, 0x51, 0xb5, 0xf7, 0xa2, 0xad, 0xa3,
1199 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 897 0x9d, 0x0d, 0xdb, 0xcc, 0x8f, 0x0e, 0xe0, 0x71, 0xd5, 0xf3, 0xf5, 0xea,
1200 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 898 0xb8, 0x3c, 0x55, 0xed, 0x77, 0x5e, 0x87, 0xcd, 0xbd, 0x65, 0x46, 0xf7,
1201 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 899 0xd2, 0x04, 0x24, 0x79, 0xf6, 0x56, 0x75, 0xf7, 0xf1, 0x04, 0xe2, 0xad,
1202 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 900 0x9b, 0x34, 0xe5, 0x6f, 0x4f, 0x64, 0xad, 0xa7, 0xf5, 0x5c, 0x52, 0xda,
1203 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 901 0x7d, 0xff, 0x71, 0x3b, 0x3b, 0x3b, 0xa9, 0x77, 0xca, 0xdf, 0xbf, 0x98,
1204 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 902 0x91, 0x85, 0xb3, 0x5b, 0x65, 0xa1, 0x06, 0x99, 0x1a, 0xbf, 0x8e, 0x7d,
1205 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 903 0x35, 0xe5, 0xea, 0x9e, 0x47, 0xb1, 0x27, 0x8c, 0x5d, 0x49, 0xe4, 0x6c,
1206 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 904 0x1b, 0xc4, 0xec, 0x25, 0x5d, 0x49, 0x98, 0x85, 0x9c, 0x1c, 0x81, 0xdf,
1207 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 905 0x4f, 0xdb, 0xb9, 0x1e, 0x69, 0xc7, 0x7b, 0x7d, 0x04, 0x7c, 0x5b, 0x32,
1208 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 906 0xd5, 0x6b, 0xc9, 0x99, 0xc1, 0x68, 0xff, 0xb6, 0x62, 0x6e, 0x46, 0x16,
1209 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 907 0xcf, 0x66, 0xf0, 0x9b, 0x83, 0xfd, 0xec, 0x94, 0x57, 0x6a, 0xfd, 0xb2,
1210 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 908 0x54, 0xdb, 0x2a, 0x8b, 0xb5, 0xe6, 0x7d, 0xe8, 0xec, 0x09, 0xe2, 0x1d,
1211 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 909 0xf1, 0xf4, 0x5b, 0x53, 0xfa, 0x56, 0x71, 0xcd, 0x7e, 0xeb, 0x29, 0xfd,
1212 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 910 0x1f, 0xe4, 0x31, 0x33, 0xa0, 0xa9, 0x17, 0x7e, 0xa4, 0xee, 0x84, 0x26,
1213 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 911 0x79, 0xf6, 0x2a, 0xbc, 0x4f, 0x26, 0x49, 0xfb, 0xf5, 0xc6, 0x07, 0xd1,
1214 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 912 0x59, 0xcb, 0xcf, 0x9d, 0x68, 0x52, 0x06, 0xe2, 0xec, 0xbf, 0x71, 0x52,
1215 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 913 0xef, 0x95, 0xe5, 0x6d, 0x0f, 0x58, 0x4f, 0xea, 0xad, 0x88, 0x01, 0x3f,
1216 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 914 0x97, 0x9f, 0xee, 0xd9, 0x24, 0x3f, 0xfc, 0xcd, 0xec, 0xa9, 0x6f, 0x22,
1217 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 915 0xd9, 0xbf, 0xb2, 0xa7, 0x83, 0x71, 0x01, 0xef, 0xec, 0xcf, 0xde, 0x70,
1218 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 916 0x75, 0xea, 0xe1, 0x2f, 0xa0, 0x87, 0xec, 0x9c, 0xba, 0x9b, 0x56, 0x3c,
1219 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 917 0x90, 0x3e, 0xf5, 0x52, 0x06, 0x6f, 0x18, 0xab, 0xf7, 0x03, 0x57, 0x59,
1220 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 918 0xe9, 0xf9, 0x09, 0x27, 0x7b, 0x03, 0xe9, 0xb0, 0xbf, 0x68, 0xf7, 0xa7,
1221 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 919 0x77, 0xea, 0x3b, 0x64, 0x32, 0xfd, 0x80, 0xf5, 0xb4, 0x6c, 0x21, 0xce,
1222 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 920 0xd9, 0x05, 0xc1, 0xda, 0x79, 0xe2, 0xfb, 0x2b, 0xe0, 0x0b, 0x70, 0x28,
1223 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 921 0xff, 0x51, 0x38, 0x77, 0x59, 0x5f, 0xd7, 0x79, 0xc6, 0x63, 0x0c, 0x71,
1224 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 922 0xe1, 0xe2, 0x10, 0x65, 0x40, 0x82, 0x95, 0xca, 0xa6, 0x5d, 0xfd, 0xc3,
1225 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 923 0xc8, 0x47, 0xfc, 0xfd, 0x56, 0x51, 0x27, 0x0f, 0xe7, 0xc0, 0xcb, 0x4f,
1226 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 924 0xc0, 0x7f, 0x3f, 0x70, 0xa2, 0xf6, 0x48, 0x47, 0x74, 0xff, 0x4e, 0xd1,
1227 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 925 0x7d, 0xad, 0x21, 0xe6, 0x2a, 0x5d, 0xf4, 0xd5, 0x75, 0xc8, 0xdd, 0x07,
1228 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 926 0x7b, 0xb5, 0xf0, 0xcb, 0xbd, 0xe9, 0x0c, 0xf7, 0x98, 0xeb, 0x22, 0xba,
1229 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 927 0x11, 0xbf, 0x5c, 0x73, 0x27, 0x1e, 0xee, 0x75, 0x3e, 0xea, 0xd4, 0x03,
1230 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 928 0x09, 0x79, 0xf7, 0x44, 0xb4, 0x37, 0x07, 0x64, 0xba, 0x0a, 0xdd, 0xed,
1231 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 929 0xea, 0x0f, 0xfc, 0x27, 0x1d, 0xf1, 0x40, 0xde, 0xff, 0x06, 0xbc, 0x07,
1232 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 930 0xb8, 0x5b, 0x0b, 0xcd, 0xba, 0xc3, 0x58, 0x3d, 0xa0, 0x31, 0xb6, 0x0e,
1233 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 931 0x4f, 0x57, 0xf6, 0x44, 0xbe, 0x98, 0x84, 0x5f, 0xed, 0xb6, 0x9e, 0x10,
1234 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 932 0xd6, 0x63, 0xc4, 0x9b, 0x94, 0x1f, 0xbe, 0x0c, 0x1e, 0x92, 0xf4, 0x93,
1235 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 933 0x7f, 0x5f, 0xe3, 0x27, 0x1c, 0xdb, 0x2a, 0x35, 0xd4, 0xd4, 0x5e, 0xde,
1236 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 934 0x94, 0x69, 0x25, 0x03, 0xda, 0x35, 0xfa, 0x77, 0x29, 0xf4, 0xef, 0x47,
1237 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 935 0x80, 0xa3, 0x5d, 0x8c, 0x47, 0x1f, 0xc7, 0x59, 0x9d, 0xcd, 0x2c, 0xeb,
1238 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 936 0xcc, 0x03, 0x76, 0x4b, 0x51, 0xdd, 0x4f, 0xdf, 0x8b, 0xee, 0xa2, 0xd8,
1239 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 937 0x94, 0x96, 0x8b, 0x95, 0x28, 0x2e, 0xa5, 0x71, 0x9e, 0xb4, 0xcb, 0xa5,
1240 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 938 0xb9, 0x28, 0xe6, 0xb5, 0xcb, 0x12, 0xf2, 0x9a, 0x95, 0x97, 0x2c, 0x8c,
1241 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 939 0x25, 0xe5, 0xe2, 0x5c, 0x12, 0x31, 0xab, 0x47, 0x56, 0xe6, 0x7a, 0x30,
1242 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 940 0x96, 0xc2, 0xba, 0x14, 0xe6, 0xdb, 0xb2, 0x52, 0xb1, 0x81, 0x27, 0x87,
1243 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 941 0x76, 0x0e, 0xed, 0x21, 0xb9, 0xa4, 0xbe, 0x17, 0x30, 0x2f, 0x18, 0x42,
1244 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 942 0xdc, 0x62, 0x5e, 0x30, 0x82, 0x18, 0x32, 0x81, 0x27, 0x8a, 0x5d, 0xa7,
1245 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 943 0x66, 0xa6, 0x2a, 0xbc, 0x73, 0x84, 0x0e, 0xac, 0x53, 0x33, 0xd3, 0xb6,
1246 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 944 0x89, 0xba, 0xed, 0x1b, 0xda, 0x54, 0x83, 0x72, 0x41, 0xb7, 0x43, 0x1d,
1247 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 945 0xa2, 0x3f, 0x4a, 0x9b, 0xe4, 0x79, 0x67, 0x20, 0xc6, 0x77, 0x01, 0x9f,
1248 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 946 0x23, 0xfa, 0x6f, 0xd0, 0x17, 0xa0, 0xc3, 0x27, 0xba, 0xe4, 0xd2, 0xcb,
1249 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 947 0x8c, 0x35, 0xae, 0xbc, 0x7a, 0x96, 0x3a, 0x2c, 0xf6, 0xac, 0xea, 0x90,
1250 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 948 0x63, 0x0f, 0xe1, 0x8c, 0xd8, 0x0f, 0x7b, 0x32, 0x33, 0x87, 0x90, 0xcb,
1251 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 949 0x7c, 0x1b, 0xf6, 0x59, 0x66, 0xcd, 0x9d, 0x0e, 0x6a, 0x84, 0x20, 0x06,
1252 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 950 0xa0, 0xdd, 0x47, 0x5d, 0xb1, 0xdd, 0x07, 0xbb, 0xe3, 0x58, 0x9f, 0x1a,
1253 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 951 0x5b, 0x04, 0x8e, 0x60, 0x8c, 0xed, 0xcd, 0xb2, 0xa8, 0xc6, 0x0e, 0xaa,
1254 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 952 0xb1, 0xb2, 0xb2, 0x0f, 0x8e, 0x1d, 0x52, 0xb1, 0xe9, 0x7c, 0x23, 0xea,
1255 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 953 0xdf, 0x88, 0x58, 0xc2, 0x7e, 0xf6, 0xe5, 0x61, 0xeb, 0x7b, 0x71, 0xae,
1256 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 954 0x15, 0x64, 0xa9, 0x81, 0x3a, 0x30, 0xff, 0x7b, 0x98, 0xcb, 0x3d, 0xc8,
1257 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 955 0x9e, 0x2a, 0xe9, 0xe4, 0xf1, 0x20, 0xce, 0x83, 0xfd, 0x21, 0xad, 0xb6,
1258 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 956 0x90, 0xaf, 0x03, 0x61, 0xbb, 0x25, 0xa4, 0x4d, 0x3c, 0x36, 0x70, 0x1c,
1259 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 957 0xc3, 0x5a, 0x17, 0x38, 0x18, 0x63, 0x11, 0x23, 0x52, 0x29, 0xe8, 0x82,
1260 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 958 0x34, 0xdb, 0xa4, 0xac, 0xde, 0xf7, 0xc3, 0x76, 0xb9, 0x16, 0x3a, 0xb4,
1261 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 959 0xa2, 0x75, 0xa5, 0x70, 0xcf, 0x53, 0xea, 0x9c, 0xd1, 0x93, 0x9b, 0xc3,
1262 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 960 0x9c, 0x10, 0x7a, 0x45, 0x9c, 0xd5, 0x93, 0x8c, 0x37, 0xef, 0x84, 0x76,
1263 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 961 0xda, 0x8b, 0xbe, 0x87, 0x44, 0xef, 0x65, 0xdf, 0x51, 0xe0, 0x61, 0xed,
1264 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 962 0x3c, 0x0c, 0x99, 0xd9, 0xe6, 0xfa, 0x6c, 0xd3, 0xfa, 0xc4, 0x3a, 0xeb,
1265 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 963 0x3b, 0x9a, 0xfa, 0x32, 0x52, 0x9b, 0xef, 0x52, 0xf1, 0xf2, 0x7c, 0x18,
1266 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 964 0x2f, 0x17, 0x6b, 0x94, 0x05, 0x7e, 0x96, 0x7f, 0x5b, 0xe9, 0xa2, 0x76,
1267 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 965 0x36, 0xb0, 0xf5, 0xa5, 0x93, 0x3c, 0x17, 0x57, 0xe7, 0xd5, 0xd4, 0xbc,
1268 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 966 0xdf, 0x06, 0xff, 0xba, 0x1c, 0x55, 0x32, 0x70, 0x3e, 0xe6, 0xd5, 0x02,
1269 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 967 0xbf, 0x31, 0x6c, 0xce, 0xa1, 0x8f, 0x44, 0x6b, 0x38, 0xff, 0xe7, 0xa8,
1270 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 968 0x55, 0xbe, 0xac, 0xd6, 0xac, 0xfa, 0x0c, 0xf9, 0x71, 0x42, 0x9e, 0x7b,
1271 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 969 0xc0, 0x5f, 0x67, 0x28, 0x43, 0x7b, 0x28, 0x03, 0xf1, 0xfd, 0x27, 0x70,
1272 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 970 0xb7, 0x61, 0x1e, 0x79, 0xdd, 0x86, 0x3e, 0xbe, 0xff, 0x17, 0xfa, 0x76,
1273 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 971 0x23, 0xff, 0x23, 0x6f, 0x89, 0x26, 0xde, 0xfe, 0x03, 0x63, 0x3d, 0x4a,
1274 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 972 0xb7, 0x35, 0xd4, 0x26, 0x53, 0xbc, 0xef, 0x48, 0xe1, 0x1c, 0x38, 0xb9,
1275 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 973 0x4d, 0xd1, 0xad, 0x9d, 0xbd, 0x86, 0xf1, 0x5e, 0xac, 0x89, 0xda, 0xcd,
1276 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 974 0xb2, 0xe9, 0x58, 0xfb, 0x53, 0x25, 0xcf, 0x62, 0xed, 0x4e, 0xf2, 0x6f,
1277 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 975 0x5b, 0x23, 0x3b, 0xe5, 0x26, 0x4f, 0xe4, 0xa7, 0x1f, 0x4f, 0x2b, 0x72,
1278 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 976 0x21, 0xd8, 0x6d, 0xd2, 0x90, 0xd1, 0x7c, 0x9a, 0xdf, 0xf9, 0x12, 0xbc,
1279 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 977 0x17, 0x1d, 0x19, 0xe4, 0x9e, 0xa1, 0xdd, 0x60, 0x4e, 0x47, 0x7f, 0x4b,
1280 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 978 0xc8, 0x31, 0xd4, 0x24, 0xe5, 0x85, 0x8c, 0x56, 0x3c, 0x99, 0x45, 0x16,
1281 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 979 0xad, 0xbe, 0xd5, 0xc9, 0x8b, 0x4b, 0xb6, 0x7c, 0x1b, 0x7e, 0x7a, 0xb2,
1282 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 980 0x9e, 0x4d, 0x7f, 0x13, 0xf9, 0xc1, 0x91, 0x25, 0xe6, 0x13, 0x3d, 0x29,
1283 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 981 0x65, 0x9b, 0xf3, 0x9a, 0x6c, 0x60, 0x4c, 0x9b, 0x47, 0x7e, 0x6a, 0xdd,
1284 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 982 0x2d, 0x47, 0x82, 0x9f, 0x57, 0xd7, 0xc6, 0x0c, 0xca, 0xb1, 0x36, 0x66,
1285 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 983 0x10, 0x0f, 0x63, 0xc6, 0x4e, 0xec, 0x13, 0x63, 0x06, 0xf6, 0xff, 0x24,
1286 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 984 0x63, 0x86, 0x8d, 0x75, 0x8c, 0x19, 0x79, 0x59, 0xac, 0x32, 0x66, 0xec,
1287 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 985 0x45, 0x9b, 0x31, 0xa3, 0x80, 0x76, 0x10, 0x2f, 0x16, 0x55, 0xbc, 0xc8,
1288 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 986 0x5a, 0xcb, 0xc2, 0x38, 0x81, 0x3c, 0xb1, 0x8a, 0x3c, 0xb1, 0x8a, 0x3c,
1289 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 987 0xb1, 0x8a, 0x3c, 0xb1, 0x8a, 0x3c, 0x11, 0xb6, 0xfe, 0x5a, 0x15, 0x79,
1290 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 988 0x22, 0xfc, 0xe7, 0x3c, 0x72, 0x92, 0xa0, 0xa6, 0x38, 0x8c, 0x9a, 0xc2,
1291 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 989 0xd5, 0xc6, 0xaa, 0xe3, 0xda, 0xbe, 0x2a, 0x6a, 0x43, 0xf5, 0x9d, 0x58,
1292 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 990 0x1f, 0xda, 0x80, 0xba, 0xa8, 0xe6, 0x6c, 0x01, 0x5f, 0xd7, 0xe0, 0x1b,
1293 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 991 0xd4, 0xd3, 0x56, 0x99, 0xca, 0xed, 0x80, 0x7c, 0xd8, 0x7f, 0xfb, 0xfb,
1294 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 992 0xe8, 0x43, 0x3e, 0x9f, 0x63, 0x0d, 0xc2, 0x78, 0xb5, 0x0f, 0x6d, 0x1d,
1295 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 993 0x6d, 0xec, 0xe9, 0x04, 0x7c, 0xc4, 0x7e, 0x90, 0xf9, 0x62, 0x7a, 0x41,
1296 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 994 0x9e, 0xdc, 0x1c, 0xd8, 0xf4, 0x6f, 0x31, 0x27, 0x5e, 0xd3, 0xde, 0x88,
1297 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 995 0x39, 0xf0, 0x17, 0xd8, 0x97, 0x5a, 0x03, 0x5c, 0xba, 0xfd, 0xe7, 0xc4,
1298 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 996 0xd1, 0xb7, 0xe1, 0xd6, 0x1c, 0xda, 0xd5, 0xf7, 0x9a, 0xfa, 0xb2, 0x98,
1299 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 997 0xcf, 0xef, 0xe2, 0x3b, 0xf0, 0xfb, 0x16, 0x7e, 0x61, 0x77, 0xf6, 0x05,
1300 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 998 0xcc, 0xe9, 0xc3, 0xef, 0x77, 0x9a, 0xe6, 0x42, 0x0a, 0xfb, 0x2f, 0xd1,
1301 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 999 0x77, 0x31, 0xa4, 0xc1, 0x6f, 0x89, 0x5f, 0x6a, 0xe2, 0xe3, 0x07, 0xe8,
1302 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1000 0xfb, 0x6b, 0xf4, 0xf9, 0xfe, 0xdb, 0x4e, 0xd4, 0x27, 0xa5, 0x96, 0x70,
1303 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1001 0xef, 0x46, 0xd5, 0xde, 0x69, 0xca, 0xe6, 0x8f, 0x2c, 0xe9, 0xaa, 0x0e,
1304 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1002 0x7a, 0xae, 0x8e, 0xea, 0x08, 0x71, 0xbe, 0xbc, 0x10, 0xd4, 0xad, 0xc7,
1305 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1003 0x51, 0x73, 0x16, 0xab, 0xb4, 0x91, 0x1c, 0xfa, 0x6d, 0x9c, 0x69, 0x32,
1306 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1004 0x69, 0xdc, 0xaa, 0x63, 0x13, 0x89, 0xc9, 0x7a, 0x9b, 0x48, 0x37, 0x69,
1307 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1005 0x32, 0x4f, 0x22, 0x8e, 0xd9, 0x99, 0xe2, 0xc2, 0xec, 0x8c, 0x07, 0x9c,
1308 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1006 0x63, 0x75, 0xae, 0xe5, 0x3c, 0x93, 0xf7, 0x63, 0x4d, 0x74, 0x69, 0x13,
1309 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1007 0x60, 0x06, 0xf4, 0x9e, 0xab, 0x93, 0x7e, 0x40, 0xb3, 0xac, 0x68, 0xda,
1310 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1008 0xe8, 0x8f, 0xea, 0xc7, 0x1c, 0x6a, 0x5d, 0x99, 0x64, 0xed, 0x5c, 0x0c,
1311 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1009 0x69, 0xba, 0x75, 0x49, 0x24, 0x0a, 0xcd, 0xf8, 0x82, 0x8c, 0xf3, 0xb9,
1312 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1010 0xfa, 0xec, 0x8c, 0xfe, 0x42, 0x36, 0xc7, 0x3b, 0x11, 0xd7, 0x9a, 0x9d,
1313 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1011 0x69, 0x1d, 0x48, 0xc8, 0x8f, 0x91, 0xbb, 0x1d, 0x53, 0x34, 0x66, 0x67,
1314 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1012 0x8c, 0x17, 0x02, 0x5b, 0x0c, 0xe8, 0xe0, 0x3c, 0xc9, 0xb7, 0x43, 0x4e,
1315 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1013 0xd2, 0x62, 0x4d, 0x1d, 0x8c, 0x4f, 0xaa, 0x7a, 0xd1, 0x94, 0x2b, 0x15,
1316 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1014 0x45, 0x3b, 0xac, 0xdb, 0xc9, 0xc3, 0xec, 0x8c, 0xfc, 0xd1, 0x2d, 0x1e,
1317 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1015 0xd6, 0x91, 0x87, 0x78, 0x49, 0x27, 0xd0, 0x5b, 0xc0, 0x7f, 0x12, 0xf5,
1318 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1016 0x7b, 0x54, 0xab, 0xfb, 0xfe, 0x8a, 0x93, 0x43, 0x5c, 0xe0, 0x3e, 0xb6,
1319 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1017 0xa8, 0x3c, 0xd7, 0x73, 0x32, 0xbc, 0xef, 0x9b, 0xe3, 0xdf, 0x39, 0x78,
1320 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1018 0xf9, 0x01, 0xd4, 0x4d, 0xbc, 0x1b, 0xa4, 0x7f, 0xe1, 0xf7, 0x36, 0xff,
1321 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1019 0xe2, 0x7c, 0xf6, 0x93, 0xe7, 0x81, 0xf4, 0x55, 0xf0, 0xe7, 0xe5, 0xd1,
1322 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1020 0x87, 0x58, 0x51, 0x6c, 0x44, 0xb8, 0x78, 0xc7, 0xce, 0x39, 0x2a, 0xff,
1323 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1021 0x6e, 0xf2, 0xd1, 0x96, 0xf0, 0xdc, 0xa5, 0x8e, 0xc8, 0x27, 0xf9, 0xe9,
1324 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1022 0x84, 0x4d, 0x90, 0x17, 0xce, 0x8f, 0xee, 0x25, 0xd8, 0xfe, 0xb8, 0x36,
1325 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1023 0x12, 0xdd, 0xa9, 0x7d, 0x9c, 0x3d, 0x8f, 0x74, 0x76, 0x37, 0x7e, 0x88,
1326 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1024 0x83, 0xb4, 0x23, 0xbe, 0x22, 0x9e, 0x88, 0x8f, 0xfc, 0x44, 0xbc, 0x28,
1327 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1025 0x1b, 0x5d, 0x97, 0x9f, 0x60, 0x5d, 0xc0, 0x4f, 0x69, 0x21, 0x0d, 0x9d,
1328 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1026 0x90, 0xa7, 0x11, 0x6d, 0xa4, 0xba, 0xde, 0x1d, 0xc7, 0x0f, 0x5c, 0xc6,
1329 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1027 0xd5, 0xb1, 0x06, 0xef, 0xa1, 0x48, 0x97, 0x7f, 0x3b, 0xb2, 0xa4, 0x8d,
1330 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1028 0x34, 0xf8, 0x9d, 0xa9, 0xae, 0xb9, 0x8d, 0x88, 0xde, 0x5a, 0x9d, 0x46,
1331 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1029 0xbf, 0xbc, 0x2b, 0xff, 0x0c, 0xf6, 0xa9, 0x3b, 0xf8, 0xbb, 0x14, 0x55,
1332 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1030 0x47, 0xb1, 0x6f, 0xb9, 0xd5, 0x73, 0xa2, 0xbf, 0xd3, 0xd9, 0x1f, 0xe6,
1333 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1031 0x43, 0x51, 0x6d, 0x1c, 0xd5, 0x59, 0xea, 0x9e, 0x7d, 0xaf, 0xe7, 0x68,
1334 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1032 0xc8, 0x4f, 0x99, 0x33, 0x05, 0x3a, 0x08, 0xf1, 0xde, 0x91, 0xcf, 0x91,
1335 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1033 0x26, 0x3e, 0x47, 0xc1, 0xe7, 0x3e, 0xf0, 0x39, 0x76, 0x8b, 0xcf, 0x5b,
1336 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1034 0xb6, 0x97, 0x29, 0xc3, 0xf6, 0x46, 0xd6, 0xb5, 0xbd, 0x55, 0x3a, 0xab,
1337 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1035 0x73, 0x83, 0xfb, 0x9a, 0x91, 0x86, 0x2f, 0xc7, 0x9d, 0x8f, 0x53, 0x37,
1338 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1036 0xb7, 0xcb, 0x99, 0x85, 0xbb, 0xd5, 0xb7, 0x11, 0xaf, 0x2a, 0x77, 0x94,
1339 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1037 0x4b, 0xf5, 0x80, 0x9f, 0x1f, 0x2f, 0xb1, 0x3d, 0x12, 0xea, 0x8a, 0x3a,
1340 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1038 0xcb, 0x3a, 0x25, 0xb9, 0x1b, 0x2f, 0xbf, 0xf8, 0x9c, 0x76, 0xa5, 0x12,
1341 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1039 0x9d, 0x4f, 0x5a, 0x78, 0xc6, 0xae, 0xe5, 0x29, 0xfa, 0x6e, 0x32, 0x66,
1342 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1040 0x45, 0xf7, 0x67, 0x22, 0xfc, 0xfe, 0xc0, 0xef, 0x75, 0x6b, 0xbf, 0x13,
1343 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1041 0xf0, 0x7c, 0x8a, 0x78, 0xd7, 0x53, 0x3c, 0x9f, 0xc6, 0x9c, 0x66, 0x19,
1344 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1042 0x5c, 0xd8, 0xa4, 0x9e, 0xe4, 0x98, 0xe7, 0xd0, 0x2f, 0x4c, 0xd0, 0x0c,
1345 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1043 0xee, 0xdd, 0x6a, 0x4b, 0xbe, 0x5c, 0x74, 0x36, 0x06, 0xe7, 0x28, 0x64,
1346 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1044 0xba, 0x6c, 0xf1, 0xfe, 0x0a, 0x31, 0x8c, 0x67, 0x83, 0xb2, 0xb5, 0x16,
1347 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1045 0xf5, 0x5c, 0x39, 0xd0, 0x0e, 0x1d, 0xb3, 0xdd, 0xd6, 0xcb, 0xfb, 0x0a,
1348 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1046 0xca, 0xbc, 0xa0, 0xf6, 0x21, 0xd2, 0x71, 0xf4, 0x7d, 0xae, 0x55, 0x96,
1349 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1047 0xc3, 0xbb, 0xad, 0xc5, 0x8a, 0xef, 0xbf, 0x83, 0x3c, 0xfc, 0x34, 0x74,
1350 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1048 0x5f, 0xae, 0xff, 0xcc, 0x5f, 0x4e, 0xf1, 0x6f, 0xa5, 0x22, 0x9b, 0xd8,
1351 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1049 0xd1, 0xcb, 0x7b, 0x20, 0xf8, 0x96, 0x1c, 0xaf, 0x87, 0x65, 0xbf, 0x70,
1352 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1050 0x9c, 0x7d, 0xff, 0x0d, 0xbe, 0x7d, 0xff, 0xf4, 0xaa, 0x9d, 0x02, 0xfe,
1353 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1051 0x17, 0x33, 0xe1, 0x9b, 0xdd, 0x90, 0x58, 0x00, 0x00, 0x00 };
1354 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1355 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1356 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1357 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1358 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1359 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1360 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1361 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1362 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1363 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1364 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1365 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1366 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1367 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1368 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1369 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1370 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1371 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1372 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1373 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1374 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1375 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1376 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1377 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1378 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1379 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1380 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1381 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1382 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1383 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1384 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1385 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1386 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1387 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1388 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1389 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1390 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1391 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1392 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1393 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1394 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1395 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1396 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1397 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1398 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1399 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1400 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1401 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1402 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1403 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1404 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1405 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1406 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1407 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1408 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1409 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1410 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1411 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1412 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1413 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1414 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1415 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1416 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1417 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1418 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1419 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1420 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1421 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1422 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1423 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1424 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1425 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1426 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1427 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1428 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1429 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1430 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1431 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1432 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1433 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1434 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1435 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1436 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1437 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1438 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1439 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1440 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1441 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1442 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1443 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1444 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1445 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1446 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1447 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1448 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1449 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1450 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1451 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1452 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1453 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1454 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1455 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1456 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1457 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1458 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1459 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1460 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1461 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1462 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1463 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1464 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1465 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1466 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1467 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1468 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1469 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1470 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1471 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1472 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1473 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1474 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1475 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1476 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1477 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1478 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1479 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1480 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1481 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1482 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1483 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1484 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1485 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1486 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1487 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1488 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1489 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1490 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1491 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1492 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1493 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1494 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1495 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1496 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1497 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1498 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1499 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1500 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1501 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1502 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1503 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1504 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1505 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1506 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1507 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1508 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1509 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1510 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1511 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1512 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1513 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1514 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1515 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1516 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1517 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1518 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1519 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1520 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1521 0x00000000, 0x00000000, 0x10000003, 0x00000000, 0x0000000d, 0x0000000d,
1522 0x3c020800, 0x244258e0, 0x3c030800, 0x24636ca4, 0xac400000, 0x0043202b,
1523 0x1480fffd, 0x24420004, 0x3c1d0800, 0x37bd7ffc, 0x03a0f021, 0x3c100800,
1524 0x26103184, 0x3c1c0800, 0x279c58e0, 0x0e00104a, 0x00000000, 0x0000000d,
1525 0x27bdffe8, 0xafb00010, 0xafbf0014, 0x0e000f1d, 0x00808021, 0x1440000d,
1526 0x00000000, 0x8f820010, 0x10400005, 0x00000000, 0x9743011c, 0x9742011e,
1527 0x0a000c89, 0x00021400, 0x9743011e, 0x9742011c, 0x00021400, 0x00621825,
1528 0xaf830004, 0x8f840008, 0x3c020020, 0x34424000, 0x00821824, 0x54620004,
1529 0x3c020020, 0x8f820014, 0x0a000c9a, 0x34421000, 0x34428000, 0x00821824,
1530 0x14620004, 0x00000000, 0x8f820014, 0x34428000, 0xaf820014, 0x8f820008,
1531 0x9743010c, 0x00403021, 0x30421000, 0x10400010, 0x3069ffff, 0x30c20020,
1532 0x1440000e, 0x24070005, 0x3c021000, 0x00c21024, 0x10400009, 0x3c030dff,
1533 0x3463ffff, 0x3c020e00, 0x00c21024, 0x0062182b, 0x50600004, 0x24070001,
1534 0x0a000cb2, 0x3c020800, 0x24070001, 0x3c020800, 0x8c430034, 0x1460001d,
1535 0x00405821, 0x8f820014, 0x30424000, 0x1440001a, 0x3c020001, 0x3c021f01,
1536 0x00c24024, 0x3c031000, 0x15030015, 0x3c020001, 0x31220200, 0x14400012,
1537 0x3c020001, 0x9744010e, 0x24020003, 0xa342018b, 0x97850016, 0x24020002,
1538 0x34e30002, 0xaf400180, 0xa742018c, 0xa7430188, 0x24840004, 0x30a5bfff,
1539 0xa744018e, 0xa74501a6, 0xaf4801b8, 0x0a000f19, 0x00001021, 0x3c020001,
1540 0x00c21024, 0x1040002f, 0x00000000, 0x9742010e, 0x3c038000, 0x3046ffff,
1541 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x9784000a,
1542 0x8f850004, 0x8f870014, 0x24020080, 0x24030002, 0xaf420180, 0x24020003,
1543 0xa743018c, 0xa746018e, 0xa7420188, 0x30e28000, 0xa7440190, 0x1040000c,
1544 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000,
1545 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00e21024, 0xaf820014,
1546 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff,
1547 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x0a000f19,
1548 0x00001021, 0x8f820014, 0x30434000, 0x10600016, 0x00404021, 0x3c020f00,
1549 0x00c21024, 0x14400012, 0x00000000, 0x93420116, 0x34424000, 0x03421821,
1550 0x94650002, 0x2ca21389, 0x1040000b, 0x3c020800, 0x24425900, 0x00051942,
1551 0x00031880, 0x00621821, 0x30a5001f, 0x8c640000, 0x24020001, 0x00a21004,
1552 0x00822024, 0x02048025, 0x12000030, 0x3c021000, 0x9742010e, 0x34e80002,
1553 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd,
1554 0x24020003, 0xa342018b, 0x9784000a, 0x8f850004, 0x8f870014, 0x24020180,
1555 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0xa7480188, 0x30e28000,
1556 0xa7440190, 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021,
1557 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff,
1558 0x00e21024, 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff,
1559 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000,
1560 0xaf4201b8, 0x0a000f19, 0x00001021, 0x00c21024, 0x104000c0, 0x3c020800,
1561 0x8c430030, 0x10600037, 0x31024000, 0x10400035, 0x3c030f00, 0x00c31824,
1562 0x3c020100, 0x0043102b, 0x14400031, 0x3c030800, 0x9742010e, 0x34e80002,
1563 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd,
1564 0x24020003, 0xa342018b, 0x9784000a, 0x8f850004, 0x8f870014, 0x24020080,
1565 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0xa7480188, 0x30e28000,
1566 0xa7440190, 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021,
1567 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff,
1568 0x00e21024, 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff,
1569 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000,
1570 0xaf4201b8, 0x0a000f19, 0x00001021, 0x3c030800, 0x8c620024, 0x30420008,
1571 0x10400035, 0x34ea0002, 0x3c020f00, 0x00c21024, 0x14400032, 0x8d620034,
1572 0x31220200, 0x1040002f, 0x8d620034, 0x9742010e, 0x30e8fffb, 0x3c038000,
1573 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003,
1574 0xa342018b, 0x9784000a, 0x8f850004, 0x8f870014, 0x24020180, 0x24030002,
1575 0xaf420180, 0xa743018c, 0xa746018e, 0xa7480188, 0x30e28000, 0xa7440190,
1576 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004,
1577 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00e21024,
1578 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00,
1579 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8,
1580 0x8d620034, 0x8f860008, 0x10400012, 0x30c20100, 0x10400010, 0x3c020f00,
1581 0x00c21024, 0x3c030200, 0x1043000c, 0x3c020800, 0x8c430038, 0x8f840004,
1582 0x3c020800, 0x2442003c, 0x2463ffff, 0x00832024, 0x00822021, 0x90830000,
1583 0x24630004, 0x0a000de1, 0x000329c0, 0x00000000, 0x00061602, 0x3042000f,
1584 0x000229c0, 0x3c04fc00, 0x00441021, 0x3c030300, 0x0062182b, 0x50600001,
1585 0x24050800, 0x9742010e, 0x3148ffff, 0x3c038000, 0x24420004, 0x3046ffff,
1586 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x9783000a,
1587 0x8f840004, 0x8f870014, 0x24020002, 0xaf450180, 0xa742018c, 0xa746018e,
1588 0xa7480188, 0x30e28000, 0xa7430190, 0x1040000c, 0xaf4401a8, 0x93420116,
1589 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004,
1590 0x3c02ffff, 0x34427fff, 0x00e21024, 0xaf820014, 0x97820016, 0x9743010c,
1591 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6,
1592 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x0a000f19, 0x00001021, 0x8f424000,
1593 0x30420100, 0x104000d5, 0x3c020800, 0x8c440024, 0x24030001, 0x1483002f,
1594 0x00405021, 0x9742010e, 0x34e70002, 0x3c038000, 0x24420004, 0x3045ffff,
1595 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x9783000a,
1596 0x8f840004, 0x8f860014, 0x24020002, 0xaf400180, 0xa742018c, 0xa745018e,
1597 0xa7470188, 0x30c28000, 0xa7430190, 0x1040000c, 0xaf4401a8, 0x93420116,
1598 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004,
1599 0x3c02ffff, 0x34427fff, 0x00c21024, 0xaf820014, 0x97820016, 0x9743010c,
1600 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6,
1601 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x0a000f19, 0x00001021, 0x30820001,
1602 0x1040002e, 0x30eb0004, 0x9742010e, 0x30e9fffb, 0x3c038000, 0x24420004,
1603 0x3045ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b,
1604 0x9783000a, 0x8f840004, 0x8f860014, 0x24020002, 0xaf400180, 0xa742018c,
1605 0xa745018e, 0xa7470188, 0x30c28000, 0xa7430190, 0x1040000c, 0xaf4401a8,
1606 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff,
1607 0x14600004, 0x3c02ffff, 0x34427fff, 0x00c21024, 0xaf820014, 0x97820016,
1608 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825,
1609 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x3127ffff, 0x8d420024,
1610 0x30420004, 0x10400030, 0x8d420024, 0x9742010e, 0x30e9fffb, 0x3c038000,
1611 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003,
1612 0xa342018b, 0x9784000a, 0x8f850004, 0x8f880014, 0x24020100, 0x24030002,
1613 0xaf420180, 0xa743018c, 0xa746018e, 0xa7470188, 0x31028000, 0xa7440190,
1614 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004,
1615 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x01021024,
1616 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00,
1617 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8,
1618 0x3127ffff, 0x8d420024, 0x30420008, 0x1040002d, 0x00000000, 0x9742010e,
1619 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd,
1620 0x24020003, 0xa342018b, 0x9784000a, 0x8f850004, 0x8f880014, 0x24020180,
1621 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0xa7470188, 0x31028000,
1622 0xa7440190, 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021,
1623 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff,
1624 0x01021024, 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff,
1625 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000,
1626 0xaf4201b8, 0x15600041, 0x00001021, 0x27440180, 0x3c038000, 0x8f4201b8,
1627 0x00431024, 0x1440fffd, 0x24022000, 0x24030002, 0xa4820008, 0xa083000b,
1628 0xa4800010, 0x3c021000, 0xaf4201b8, 0x0a000f19, 0x00001021, 0x3c030800,
1629 0x8c620024, 0x30420001, 0x1040002e, 0x00001021, 0x9742010e, 0x34e70002,
1630 0x3c038000, 0x24420004, 0x3045ffff, 0x8f4201b8, 0x00431024, 0x1440fffd,
1631 0x24020003, 0xa342018b, 0x9783000a, 0x8f840004, 0x8f860014, 0x24020002,
1632 0xaf400180, 0xa742018c, 0xa745018e, 0xa7470188, 0x30c28000, 0xa7430190,
1633 0x1040000c, 0xaf4401a8, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004,
1634 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00c21024,
1635 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00,
1636 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8,
1637 0x00001021, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x8f4b0070,
1638 0x93420112, 0x8f840008, 0x00022882, 0x30820100, 0x14400003, 0x24a30003,
1639 0x03e00008, 0x00001021, 0x30824000, 0x10400010, 0x27424000, 0x00031880,
1640 0x00431021, 0x8c470000, 0x24a30004, 0x00031880, 0x27424000, 0x00431021,
1641 0x8c490000, 0x93430116, 0x27424000, 0x306300fc, 0x00431021, 0x8c4a0000,
1642 0x0a000f45, 0x3c030800, 0x30822000, 0x1040ffea, 0x00031880, 0x27424000,
1643 0x00431021, 0x8c470000, 0x24a30004, 0x00031880, 0x27424000, 0x00431021,
1644 0x8c490000, 0x00005021, 0x3c030800, 0x24680100, 0x00071602, 0x00021080,
1645 0x00481021, 0x8c460000, 0x00071b82, 0x306303fc, 0x01031821, 0x8c640400,
1646 0x00071182, 0x304203fc, 0x01021021, 0x8c450800, 0x30e300ff, 0x00031880,
1647 0x01031821, 0x00091602, 0x00021080, 0x01021021, 0x00c43026, 0x8c640c00,
1648 0x8c431000, 0x00c53026, 0x00091382, 0x304203fc, 0x01021021, 0x8c451400,
1649 0x312200ff, 0x00021080, 0x01021021, 0x00c43026, 0x00c33026, 0x00091982,
1650 0x306303fc, 0x01031821, 0x8c641800, 0x8c431c00, 0x00c53026, 0x00c43026,
1651 0x11400015, 0x00c33026, 0x000a1602, 0x00021080, 0x01021021, 0x8c432000,
1652 0x000a1382, 0x304203fc, 0x01021021, 0x8c452400, 0x314200ff, 0x00021080,
1653 0x01021021, 0x00c33026, 0x000a1982, 0x306303fc, 0x01031821, 0x8c642800,
1654 0x8c432c00, 0x00c53026, 0x00c43026, 0x00c33026, 0x8f430070, 0x3c050800,
1655 0x8ca43100, 0x2c820020, 0x10400008, 0x006b5823, 0x3c020800, 0x24423104,
1656 0x00041880, 0x00621821, 0x24820001, 0xac6b0000, 0xaca23100, 0xaf860004,
1657 0x03e00008, 0x24020001, 0x27bdffe8, 0xafbf0010, 0x8f460128, 0x8f840010,
1658 0xaf460020, 0x8f450104, 0x8f420100, 0x24030800, 0xaf850008, 0xaf820014,
1659 0xaf4301b8, 0x1080000a, 0x3c020800, 0x8c430034, 0x10600007, 0x30a22000,
1660 0x10400005, 0x34a30100, 0x8f82000c, 0xaf830008, 0x24420001, 0xaf82000c,
1661 0x3c020800, 0x8c4300c0, 0x10600006, 0x3c030800, 0x8c6200c4, 0x24040001,
1662 0x24420001, 0x0a000fd5, 0xac6200c4, 0x8f820008, 0x3c030010, 0x00431024,
1663 0x14400009, 0x3c02001f, 0x3c030800, 0x8c620020, 0x00002021, 0x24420001,
1664 0x0e000c78, 0xac620020, 0x0a000fd5, 0x00402021, 0x3442ff00, 0x14c20009,
1665 0x2403bfff, 0x3c030800, 0x8c620020, 0x24040001, 0x24420001, 0x0e000c78,
1666 0xac620020, 0x0a000fd5, 0x00402021, 0x8f820014, 0x00431024, 0x14400006,
1667 0x00000000, 0xaf400048, 0x0e0011a9, 0xaf400040, 0x0a000fd5, 0x00402021,
1668 0x0e001563, 0x00000000, 0x00402021, 0x10800005, 0x3c024000, 0x8f430124,
1669 0x3c026020, 0xac430014, 0x3c024000, 0xaf420138, 0x00000000, 0x8fbf0010,
1670 0x03e00008, 0x27bd0018, 0x27bdffe0, 0xafbf0018, 0xafb10014, 0xafb00010,
1671 0x8f420140, 0xaf420020, 0x8f430148, 0x3c027000, 0x00621824, 0x3c023000,
1672 0x10620021, 0x0043102b, 0x14400006, 0x3c024000, 0x3c022000, 0x10620009,
1673 0x3c024000, 0x0a001040, 0x00000000, 0x10620045, 0x3c025000, 0x10620047,
1674 0x3c024000, 0x0a001040, 0x00000000, 0x27440180, 0x3c038000, 0x8f4201b8,
1675 0x00431024, 0x1440fffd, 0x00000000, 0x8f420148, 0x24030002, 0xa083000b,
1676 0x00021402, 0xa4820008, 0x8f430148, 0xa4830010, 0x8f420144, 0x3c031000,
1677 0xac820024, 0xaf4301b8, 0x0a001040, 0x3c024000, 0x8f420148, 0x24030002,
1678 0x3044ffff, 0x00021402, 0x305000ff, 0x1203000c, 0x27510180, 0x2a020003,
1679 0x10400005, 0x24020003, 0x0600001d, 0x36053000, 0x0a001027, 0x3c038000,
1680 0x12020007, 0x00000000, 0x0a001034, 0x00000000, 0x0e00112c, 0x00000000,
1681 0x0a001025, 0x00402021, 0x0e00113e, 0x00000000, 0x00402021, 0x36053000,
1682 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002, 0xa6250008,
1683 0xa222000b, 0xa6240010, 0x8f420144, 0x3c031000, 0xae220024, 0xaf4301b8,
1684 0x0a001040, 0x3c024000, 0x0000000d, 0x00000000, 0x240002bf, 0x0a001040,
1685 0x3c024000, 0x0e001441, 0x00000000, 0x0a001040, 0x3c024000, 0x0e0015ea,
1686 0x00000000, 0x3c024000, 0xaf420178, 0x00000000, 0x8fbf0018, 0x8fb10014,
1687 0x8fb00010, 0x03e00008, 0x27bd0020, 0x24020800, 0x03e00008, 0xaf4201b8,
1688 0x27bdffe8, 0x3c04600c, 0xafbf0014, 0xafb00010, 0x8c825000, 0x3c1a8000,
1689 0x2403ff7f, 0x3c106000, 0x00431024, 0x3442380c, 0x24030003, 0xac825000,
1690 0x3c020008, 0xaf430008, 0x8e040808, 0x0342d825, 0x8e020808, 0x3c030800,
1691 0xac600020, 0x3084fff0, 0x2c840001, 0x3042fff0, 0x38420010, 0x2c420001,
1692 0xaf840010, 0xaf820000, 0x0e00160c, 0x00000000, 0x0e001561, 0x00000000,
1693 0x3c020400, 0x3442000c, 0x3c03ffff, 0x34630806, 0xae021948, 0xae03194c,
1694 0x8e021980, 0x34420200, 0xae021980, 0x8f500000, 0x32020003, 0x1040fffd,
1695 0x32020001, 0x10400004, 0x32020002, 0x0e000f92, 0x00000000, 0x32020002,
1696 0x1040fff6, 0x00000000, 0x0e000fe0, 0x00000000, 0x0a001071, 0x00000000,
1697 0x27bdffe8, 0x3c04600c, 0xafbf0014, 0xafb00010, 0x8c825000, 0x3c1a8000,
1698 0x2403ff7f, 0x3c106000, 0x00431024, 0x3442380c, 0x24030003, 0xac825000,
1699 0x3c020008, 0xaf430008, 0x8e040808, 0x0342d825, 0x8e020808, 0x3c030800,
1700 0xac600020, 0x3084fff0, 0x2c840001, 0x3042fff0, 0x38420010, 0x2c420001,
1701 0xaf840010, 0xaf820000, 0x0e00160c, 0x00000000, 0x0e001561, 0x00000000,
1702 0x3c020400, 0x3442000c, 0x3c03ffff, 0x34630806, 0xae021948, 0xae03194c,
1703 0x8e021980, 0x8fbf0014, 0x34420200, 0xae021980, 0x8fb00010, 0x03e00008,
1704 0x27bd0018, 0x00804821, 0x30a5ffff, 0x30c6ffff, 0x30e7ffff, 0x3c038000,
1705 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x9783000a,
1706 0x8f840004, 0x8f880014, 0xaf490180, 0xa745018c, 0xa746018e, 0xa7470188,
1707 0x31028000, 0xa7430190, 0x1040000c, 0xaf4401a8, 0x93420116, 0x304200fc,
1708 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff,
1709 0x34427fff, 0x01021024, 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104,
1710 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac,
1711 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00000000, 0x27440180, 0x3c038000,
1712 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24022000, 0x24030002, 0xa4820008,
1713 0xa083000b, 0xa4800010, 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00000000,
1714 0x27440180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000,
1715 0x8f420148, 0x24030002, 0xa083000b, 0x00021402, 0xa4820008, 0x8f430148,
1716 0xa4830010, 0x8f420144, 0x3c031000, 0xac820024, 0x03e00008, 0xaf4301b8,
1717 0x27bdffe0, 0xafbf0018, 0xafb10014, 0xafb00010, 0x8f420148, 0x24030002,
1718 0x3044ffff, 0x00021402, 0x305000ff, 0x1203000c, 0x27510180, 0x2a020003,
1719 0x10400005, 0x24020003, 0x0600001d, 0x36053000, 0x0a001117, 0x3c038000,
1720 0x12020007, 0x00000000, 0x0a001124, 0x00000000, 0x0e00112c, 0x00000000,
1721 0x0a001115, 0x00402021, 0x0e00113e, 0x00000000, 0x00402021, 0x36053000,
1722 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002, 0xa6250008,
1723 0xa222000b, 0xa6240010, 0x8f420144, 0x3c031000, 0xae220024, 0xaf4301b8,
1724 0x0a001128, 0x8fbf0018, 0x0000000d, 0x00000000, 0x240002bf, 0x8fbf0018,
1725 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 0x3084ffff, 0x2c821389,
1726 0x1040000d, 0x00001021, 0x3c030800, 0x24635900, 0x00042942, 0x00052880,
1727 0x00a32821, 0x3086001f, 0x8ca40000, 0x24030001, 0x00c31804, 0x00832025,
1728 0x03e00008, 0xaca40000, 0x03e00008, 0x24020091, 0x3084ffff, 0x2c821389,
1729 0x1040000e, 0x00001021, 0x3c030800, 0x24635900, 0x00042942, 0x00052880,
1730 0x00a32821, 0x3086001f, 0x24030001, 0x8ca40000, 0x00c31804, 0x00031827,
1731 0x00832024, 0x03e00008, 0xaca40000, 0x03e00008, 0x24020091, 0x9482000c,
1732 0x24870014, 0x00021302, 0x00021080, 0x00824021, 0x00e8182b, 0x1060004f,
1733 0x00000000, 0x90e30000, 0x2c620009, 0x10400047, 0x3c020800, 0x24425890,
1734 0x00031880, 0x00621821, 0x8c640000, 0x00800008, 0x00000000, 0x0a0011a4,
1735 0x24e70001, 0x90e30001, 0x2402000a, 0x54620024, 0x01003821, 0x01071023,
1736 0x2c42000a, 0x54400020, 0x01003821, 0x3c050800, 0x8ca26c98, 0x24e70002,
1737 0x34420100, 0xaca26c98, 0x90e30000, 0x90e20001, 0x90e40002, 0x90e60003,
1738 0x24e70004, 0x24a56c98, 0x00031e00, 0x00021400, 0x00621825, 0x00042200,
1739 0x00641825, 0x00661825, 0xaca30004, 0x90e20000, 0x90e30001, 0x90e40002,
1740 0x90e60003, 0x24e70004, 0x00021600, 0x00031c00, 0x00431025, 0x00042200,
1741 0x00441025, 0x00461025, 0x0a0011a4, 0xaca20008, 0x90e30001, 0x24020004,
1742 0x1062000e, 0x00601021, 0x0a00119e, 0x01001021, 0x90e30001, 0x24020003,
1743 0x10620008, 0x00601021, 0x0a00119e, 0x01001021, 0x90e30001, 0x24020002,
1744 0x14620003, 0x01001021, 0x00601021, 0x00e21021, 0x0a0011a4, 0x00403821,
1745 0x90e20001, 0x0a0011a4, 0x00e23821, 0x01003821, 0x00e8102b, 0x5440ffb4,
1746 0x90e30000, 0x03e00008, 0x24020001, 0x27bdff90, 0x3c030800, 0xafbf006c,
1747 0xafbe0068, 0xafb70064, 0xafb60060, 0xafb5005c, 0xafb40058, 0xafb30054,
1748 0xafb20050, 0xafb1004c, 0xafb00048, 0xac606c98, 0x93620023, 0x30420010,
1749 0x1440027c, 0x24020001, 0x93420116, 0x93630005, 0x34424000, 0x30630001,
1750 0x14600005, 0x0342b021, 0x0e0015e0, 0x00000000, 0x0a001436, 0x8fbf006c,
1751 0x93420112, 0x8f430104, 0x3c040020, 0x34424000, 0x00641824, 0x10600012,
1752 0x03422821, 0x27450180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd,
1753 0x00000000, 0x8f420128, 0xaca20000, 0x8f640040, 0x24030008, 0x240240c1,
1754 0xa4a20008, 0x24020002, 0xa0a2000b, 0x3c021000, 0x0a0011f1, 0xa0a3000a,
1755 0x8f420104, 0x3c030040, 0x00431024, 0x1040001d, 0x3c038000, 0x27450180,
1756 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000,
1757 0x8f640040, 0x24030010, 0x240240c1, 0xa4a20008, 0x24020002, 0xa0a3000a,
1758 0x24030008, 0xa0a2000b, 0x3c021000, 0xa4a30010, 0xa0a00012, 0xa0a00013,
1759 0xaca00014, 0xaca00024, 0xaca00028, 0xaca0002c, 0xaca40018, 0x0e0015e0,
1760 0xaf4201b8, 0x0a001436, 0x8fbf006c, 0x8f820000, 0x10400016, 0x00000000,
1761 0x8f420104, 0x3c030001, 0x00431024, 0x10400011, 0x00000000, 0x8ca3000c,
1762 0x8f620030, 0x1462022d, 0x24020001, 0x8ca30010, 0x8f62002c, 0x14620229,
1763 0x24020001, 0x9763003a, 0x96c20000, 0x14430225, 0x24020001, 0x97630038,
1764 0x96c20002, 0x14430221, 0x24020001, 0xaf400048, 0xaf400054, 0xaf400040,
1765 0x8f740040, 0x8f650048, 0x00b43023, 0x04c10004, 0x00000000, 0x0000000d,
1766 0x00000000, 0x240001af, 0x9742011a, 0x3052ffff, 0x12400004, 0x8ed30004,
1767 0x02721021, 0x0a001228, 0x2451ffff, 0x02608821, 0x92d7000d, 0xa7a00020,
1768 0xa3a0001a, 0xafa00028, 0x9362003f, 0x32e30004, 0x1060003a, 0x305000ff,
1769 0x24040012, 0x16040006, 0x24020001, 0x3c040800, 0x8c830028, 0x24630001,
1770 0x0a001328, 0xac830028, 0x8f620044, 0x16620010, 0x27a60010, 0x27450180,
1771 0x3c038000, 0x2402001a, 0xa7a20020, 0x24020020, 0xafb40028, 0xa3b00022,
1772 0xa3a40023, 0xa3a2001a, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000,
1773 0x0a00130d, 0x00000000, 0x8f620044, 0x02621023, 0x0440001a, 0x02651023,
1774 0x044100d9, 0x24020001, 0x3c020800, 0x8c4300d8, 0x10600004, 0x24020001,
1775 0xa7a20020, 0x0a00125e, 0xafb40028, 0x2402001a, 0xa7a20020, 0x24020020,
1776 0xafb40028, 0xa3b00022, 0xa3a40023, 0xa3a2001a, 0x27a60010, 0x27450180,
1777 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x0a00130d,
1778 0x00000000, 0x0a001328, 0x24020001, 0x0293f023, 0x1bc00016, 0x025e102a,
1779 0x54400007, 0x32f700fe, 0x57d2000f, 0x027e9821, 0x32e20001, 0x5440000c,
1780 0x027e9821, 0x32f700fe, 0x0240f021, 0x3c040800, 0x8c8300c8, 0x00009021,
1781 0x24020001, 0xa7a20020, 0xafb40028, 0x24630001, 0x0a001282, 0xac8300c8,
1782 0x025e1023, 0x0a001282, 0x3052ffff, 0x0000f021, 0x24a2ffff, 0x02221823,
1783 0x1860001f, 0x0072102a, 0x54400019, 0x00a08821, 0x97a20020, 0x3c040800,
1784 0x8c8300cc, 0xafb40028, 0x34420001, 0x24630001, 0xa7a20020, 0x02741026,
1785 0x2c420001, 0xac8300cc, 0x2cc30001, 0x00431024, 0x1440000a, 0x02401821,
1786 0x27a60010, 0x27450180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd,
1787 0x00000000, 0x0a00130d, 0x00000000, 0x00a08821, 0x02431023, 0x3052ffff,
1788 0x0a0012ae, 0x32f700f6, 0x02741023, 0x18400008, 0x97a20020, 0x3c040800,
1789 0x8c8300d4, 0xafb30028, 0x34420400, 0x24630001, 0xa7a20020, 0xac8300d4,
1790 0x32e20002, 0x1040001c, 0x32e20010, 0x8f620044, 0x1662000d, 0x27a60010,
1791 0x97a20020, 0x27450180, 0x3c038000, 0xafb40028, 0x34420001, 0xa7a20020,
1792 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x0a00130d, 0x00000000,
1793 0x97a20020, 0x27450180, 0x3c038000, 0xafb40028, 0x34420001, 0xa7a20020,
1794 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x0a00130d, 0x00000000,
1795 0x54400003, 0x8ed50008, 0x0a001328, 0x24020001, 0x8f630054, 0x26a2ffff,
1796 0x00431023, 0x18400011, 0x27a60010, 0x97a20020, 0x3c040800, 0x8c8300d0,
1797 0x27450180, 0x3c078000, 0xafb40028, 0x34420001, 0x24630001, 0xa7a20020,
1798 0xac8300d0, 0x8f4201b8, 0x00471024, 0x1440fffd, 0x00000000, 0x0a00130d,
1799 0x00000000, 0x32e20020, 0x10400011, 0x00000000, 0x96c20012, 0x0052102b,
1800 0x10400008, 0x97a20020, 0x96d20012, 0x12400003, 0x02721021, 0x0a0012f2,
1801 0x2451ffff, 0x02608821, 0x97a20020, 0x93a3001a, 0x34420008, 0x34630004,
1802 0xa7a20020, 0xa3a3001a, 0x8f420104, 0x3c030080, 0x00431024, 0x10400037,
1803 0x3a03000a, 0x0e001151, 0x02c02021, 0x24030002, 0x1443002b, 0x3c030800,
1804 0x27a60010, 0x97a20020, 0x27450180, 0x3c038000, 0xafb40028, 0x34420001,
1805 0xa7a20020, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128,
1806 0xaca20000, 0x8cc30018, 0x240240c1, 0xa4a20008, 0xaca30018, 0x90c4000a,
1807 0x24020002, 0xa0a2000b, 0xa0a4000a, 0x94c20010, 0xa4a20010, 0x90c30012,
1808 0xa0a30012, 0x90c20013, 0xa0a20013, 0x8cc30014, 0xaca30014, 0x8cc20024,
1809 0xaca20024, 0x8cc30028, 0xaca30028, 0x8cc4002c, 0x24020001, 0x3c031000,
1810 0xaca4002c, 0xaf4301b8, 0xaf400044, 0xaf400050, 0x0a001436, 0x8fbf006c,
1811 0x8c626c98, 0x30420100, 0x10400003, 0x24636c98, 0x8c620004, 0xaf62017c,
1812 0x3a03000a, 0x2c630001, 0x3a02000c, 0x2c420001, 0x00621825, 0x14600003,
1813 0x2402000e, 0x56020030, 0x00009021, 0x52400008, 0x96c4000e, 0x12400004,
1814 0xa7b20040, 0x02721021, 0x0a001343, 0x2451ffff, 0x02608821, 0x96c4000e,
1815 0x93630035, 0x8f62004c, 0x00642004, 0x00952021, 0x00821023, 0x18400015,
1816 0x00000000, 0x8f620018, 0x02621023, 0x1c400015, 0x97a20020, 0x8f620018,
1817 0x1662001c, 0x00000000, 0x8f62001c, 0x02a21023, 0x1c40000e, 0x97a20020,
1818 0x8f62001c, 0x16a20015, 0x00000000, 0x8f620058, 0x00821023, 0x18400011,
1819 0x97a20020, 0x0a001364, 0xafb10028, 0x8f620058, 0x00821023, 0x0441000b,
1820 0x97a20020, 0xafb10028, 0xafb30034, 0xafb50038, 0xafa4003c, 0x34420020,
1821 0x0a00136d, 0xa7a20020, 0x02809821, 0x02608821, 0x8f640058, 0x8f62004c,
1822 0x02a21023, 0x18400009, 0x00000000, 0x8f620054, 0x02a21023, 0x1c400005,
1823 0x97a20020, 0xafb10028, 0xafb50024, 0x0a001385, 0x34420040, 0x9742011a,
1824 0x1440000c, 0x24020014, 0x8f620058, 0x14820009, 0x24020014, 0x8f63004c,
1825 0x8f620054, 0x10620004, 0x97a20020, 0xafb10028, 0x34420080, 0xa7a20020,
1826 0x24020014, 0x1202000a, 0x2a020015, 0x10400005, 0x2402000c, 0x12020006,
1827 0x32e20001, 0x0a0013c6, 0x00000000, 0x24020016, 0x16020035, 0x32e20001,
1828 0x8f620084, 0x24420001, 0x16a20031, 0x32e20001, 0x24020014, 0x12020021,
1829 0x2a020015, 0x10400005, 0x2402000c, 0x12020008, 0x32e20001, 0x0a0013c6,
1830 0x00000000, 0x24020016, 0x1202000c, 0x32e20001, 0x0a0013c6, 0x00000000,
1831 0x97a30020, 0x2402000e, 0xafb10028, 0xa3b00022, 0xa3a20023, 0xafb50024,
1832 0x34630054, 0x0a0013c5, 0xa7a30020, 0x97a20020, 0x93a4001a, 0x24030010,
1833 0xafb10028, 0xa3b00022, 0xa3a30023, 0xafb50024, 0x3442005d, 0x34840002,
1834 0xa7a20020, 0x0a0013c5, 0xa3a4001a, 0x97a20020, 0x24030012, 0xa3a30023,
1835 0x93a3001a, 0xafb10028, 0xa3b00022, 0xafb50024, 0x3042fffe, 0x3442005c,
1836 0x34630002, 0xa7a20020, 0xa3a3001a, 0x32e20001, 0x10400030, 0x2402000c,
1837 0x12020013, 0x2a02000d, 0x10400005, 0x2402000a, 0x12020008, 0x97a20020,
1838 0x0a0013f8, 0x32e20009, 0x2402000e, 0x1202001b, 0x32e20009, 0x0a0013f9,
1839 0x0002102b, 0x93a4001a, 0x24030008, 0xafb10028, 0xa3b00022, 0xa3a30023,
1840 0x0a0013f4, 0x34420013, 0x97a30020, 0x30620004, 0x14400005, 0x93a2001a,
1841 0x3463001b, 0xa7a30020, 0x0a0013e7, 0x24030016, 0x3463001b, 0xa7a30020,
1842 0x24030010, 0xafb10028, 0xa3b00022, 0xa3a30023, 0x34420002, 0x0a0013f7,
1843 0xa3a2001a, 0x97a20020, 0x93a4001a, 0x24030010, 0xafb10028, 0xa3b00022,
1844 0xa3a30023, 0x3442001b, 0x34840002, 0xa7a20020, 0xa3a4001a, 0x32e20009,
1845 0x0002102b, 0x00021023, 0x30420007, 0x12400015, 0x34450003, 0x8f820018,
1846 0x24030800, 0x27440180, 0x24420001, 0xaf820018, 0x24020004, 0xaf4301b8,
1847 0xa4850008, 0xa082000b, 0x93430120, 0x00003021, 0x3c021000, 0xa492000e,
1848 0xac950024, 0xac930028, 0x007e1821, 0xa483000c, 0xaf4201b8, 0x0a001413,
1849 0x97a20020, 0x24060001, 0x97a20020, 0x10400020, 0x27450180, 0x3c038000,
1850 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000,
1851 0x8fa30028, 0x240240c1, 0xa4a20008, 0xaca30018, 0x93a4001a, 0x24020002,
1852 0xa0a2000b, 0xa0a4000a, 0x97a20020, 0xa4a20010, 0x93a30022, 0xa0a30012,
1853 0x93a20023, 0xa0a20013, 0x8fa30024, 0xaca30014, 0x8fa20034, 0xaca20024,
1854 0x8fa30038, 0xaca30028, 0x8fa2003c, 0x3c031000, 0xaca2002c, 0xaf4301b8,
1855 0x00c01021, 0x8fbf006c, 0x8fbe0068, 0x8fb70064, 0x8fb60060, 0x8fb5005c,
1856 0x8fb40058, 0x8fb30054, 0x8fb20050, 0x8fb1004c, 0x8fb00048, 0x03e00008,
1857 0x27bd0070, 0x8f470140, 0x8f460148, 0x3c028000, 0x00c24024, 0x00062c02,
1858 0x30a300ff, 0x24020019, 0x106200e7, 0x27440180, 0x2862001a, 0x1040001f,
1859 0x24020008, 0x106200be, 0x28620009, 0x1040000d, 0x24020001, 0x10620046,
1860 0x28620002, 0x50400005, 0x24020006, 0x1060002e, 0x00a01821, 0x0a00155e,
1861 0x00000000, 0x1062005b, 0x00a01821, 0x0a00155e, 0x00000000, 0x2402000b,
1862 0x10620084, 0x2862000c, 0x10400005, 0x24020009, 0x106200bc, 0x00061c02,
1863 0x0a00155e, 0x00000000, 0x2402000e, 0x106200b7, 0x00061c02, 0x0a00155e,
1864 0x00000000, 0x28620021, 0x10400009, 0x2862001f, 0x104000c1, 0x2402001b,
1865 0x106200bf, 0x2402001c, 0x1062009a, 0x00061c02, 0x0a00155e, 0x00000000,
1866 0x240200c2, 0x106200ca, 0x286200c3, 0x10400005, 0x24020080, 0x1062005a,
1867 0x00a01821, 0x0a00155e, 0x00000000, 0x240200c9, 0x106200cd, 0x30c5ffff,
1868 0x0a00155e, 0x00000000, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd,
1869 0x24020001, 0xa4830008, 0x24030002, 0xac870000, 0xac800004, 0xa082000a,
1870 0xa083000b, 0xa4860010, 0x8f430144, 0x3c021000, 0xac800028, 0xac830024,
1871 0x3c036000, 0xaf4201b8, 0x03e00008, 0xac600808, 0x11000009, 0x00a01821,
1872 0x3c020800, 0x24030002, 0xa0436c88, 0x24426c88, 0xac470008, 0x8f430144,
1873 0x03e00008, 0xac430004, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd,
1874 0x24020002, 0xac800000, 0xac870004, 0xa4830008, 0xa082000a, 0xa082000b,
1875 0xa4860010, 0xac800024, 0x8f420144, 0x3c031000, 0xac820028, 0x3c026000,
1876 0xaf4301b8, 0x03e00008, 0xac400808, 0x3c080800, 0x3c058000, 0x8f4201b8,
1877 0x00451024, 0x1440fffd, 0x00000000, 0xac870000, 0x91026c88, 0x00002821,
1878 0x10400002, 0x25076c88, 0x8ce50008, 0xac850004, 0xa4830008, 0x91036c88,
1879 0x24020002, 0xa082000b, 0xa4860010, 0x34630001, 0xa083000a, 0x8f420144,
1880 0xac820024, 0x91036c88, 0x10600002, 0x00001021, 0x8ce20004, 0xac820028,
1881 0x3c021000, 0xaf4201b8, 0x3c026000, 0xa1006c88, 0x03e00008, 0xac400808,
1882 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020002, 0xa082000b,
1883 0xa4830008, 0xa4860010, 0x8f420144, 0x3c031000, 0xa4820012, 0x03e00008,
1884 0xaf4301b8, 0x30c2ffff, 0x14400028, 0x00061c02, 0x93620005, 0x30420004,
1885 0x14400020, 0x3c029000, 0x34420001, 0x00e21025, 0xaf420020, 0x3c038000,
1886 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 0x93620005, 0x3c038000,
1887 0x34630001, 0x00e31825, 0x34420004, 0xa3620005, 0xaf430020, 0x93620005,
1888 0x30420004, 0x14400003, 0x3c038000, 0x0000000d, 0x3c038000, 0x8f4201b8,
1889 0x00431024, 0x1440fffd, 0x24020005, 0x3c031000, 0xac870000, 0xa082000b,
1890 0xaf4301b8, 0x0a00150d, 0x00061c02, 0x0000000d, 0x03e00008, 0x00000000,
1891 0x00061c02, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020001,
1892 0xa4830008, 0x24030002, 0xac870000, 0xac800004, 0xa082000a, 0xa083000b,
1893 0xa4860010, 0x8f430144, 0x3c021000, 0xac800028, 0xac830024, 0x03e00008,
1894 0xaf4201b8, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020002,
1895 0xac800000, 0xac870004, 0xa4830008, 0xa082000a, 0xa082000b, 0xa4860010,
1896 0xac800024, 0x8f420144, 0x3c031000, 0xac820028, 0x03e00008, 0xaf4301b8,
1897 0x00061c02, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020001,
1898 0xa4830008, 0x24030002, 0xa082000a, 0x3c021000, 0xac870000, 0xac800004,
1899 0xa083000b, 0xa4860010, 0xac800024, 0xac800028, 0x03e00008, 0xaf4201b8,
1900 0x00a01821, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020002,
1901 0xac870000, 0xac800004, 0xa4830008, 0xa080000a, 0x0a001518, 0xa082000b,
1902 0x8f440144, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002,
1903 0x240340c9, 0xaf470180, 0xa342018b, 0x3c021000, 0xa7430188, 0xaf4401a4,
1904 0xaf4501a8, 0xaf4001ac, 0x03e00008, 0xaf4201b8, 0x0000000d, 0x03e00008,
1905 0x00000000, 0x03e00008, 0x00000000, 0x8f420100, 0x3042003e, 0x14400011,
1906 0x24020001, 0xaf400048, 0x8f420100, 0x304207c0, 0x10400005, 0x00000000,
1907 0xaf40004c, 0xaf400050, 0x03e00008, 0x24020001, 0xaf400054, 0xaf400040,
1908 0x8f420100, 0x30423800, 0x54400001, 0xaf400044, 0x24020001, 0x03e00008,
1909 0x00000000, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002,
1910 0x240340c9, 0xaf440180, 0xa342018b, 0x3c021000, 0xa7430188, 0xaf4501a4,
1911 0xaf4601a8, 0xaf4701ac, 0x03e00008, 0xaf4201b8, 0x3c029000, 0x34420001,
1912 0x00822025, 0xaf440020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd,
1913 0x00000000, 0x03e00008, 0x00000000, 0x3c028000, 0x34420001, 0x00822025,
1914 0x03e00008, 0xaf440020, 0x308600ff, 0x27450180, 0x3c038000, 0x8f4201b8,
1915 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000, 0x8f640040,
1916 0x24030008, 0x240240c1, 0xa4a20008, 0x24020002, 0xa0a2000b, 0x3c021000,
1917 0xa0a6000a, 0xa4a30010, 0xa0a00012, 0xa0a00013, 0xaca00014, 0xaca00024,
1918 0xaca00028, 0xaca0002c, 0xaca40018, 0x03e00008, 0xaf4201b8, 0x24020001,
1919 0xacc40000, 0x03e00008, 0xa4e50000, 0x24020001, 0xaf400044, 0x03e00008,
1920 0xaf400050, 0x00803021, 0x27450180, 0x3c038000, 0x8f4201b8, 0x00431024,
1921 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000, 0x8cc30018, 0x240240c1,
1922 0xa4a20008, 0xaca30018, 0x90c4000a, 0x24020002, 0xa0a2000b, 0xa0a4000a,
1923 0x94c20010, 0xa4a20010, 0x90c30012, 0xa0a30012, 0x90c20013, 0xa0a20013,
1924 0x8cc30014, 0xaca30014, 0x8cc20024, 0xaca20024, 0x8cc30028, 0xaca30028,
1925 0x8cc2002c, 0x3c031000, 0xaca2002c, 0x24020001, 0xaf4301b8, 0xaf400044,
1926 0x03e00008, 0xaf400050, 0x27bdffe8, 0xafbf0010, 0x0e001047, 0x00000000,
1927 0x00002021, 0x0e000c78, 0xaf400180, 0x8fbf0010, 0x03e00008, 0x27bd0018,
1928 0x8f460148, 0x27450180, 0x3c038000, 0x00061402, 0x304700ff, 0x8f4201b8,
1929 0x00431024, 0x1440fffd, 0x00000000, 0x8f440140, 0x00061202, 0x304200ff,
1930 0x00061c02, 0xaca20004, 0x24020002, 0xa4a30008, 0x30c300ff, 0xa0a2000b,
1931 0xaca30024, 0x10e0000a, 0xaca40000, 0x28e20004, 0x14400005, 0x24020001,
1932 0x24020005, 0x54e20005, 0xa0a0000a, 0x24020001, 0x0a001609, 0xa0a2000a,
1933 0xa0a0000a, 0x3c021000, 0x03e00008, 0xaf4201b8, 0x03e00008, 0x00001021,
1934 0x10c00007, 0x00000000, 0x8ca20000, 0x24c6ffff, 0x24a50004, 0xac820000,
1935 0x14c0fffb, 0x24840004, 0x03e00008, 0x00000000, 0x0a00161f, 0x00a01021,
1936 0xac860000, 0x00000000, 0x00000000, 0x24840004, 0x00a01021, 0x1440fffa,
1937 0x24a5ffff, 0x03e00008, 0x00000000, 0x00000000 };
1938 1052
1939static u32 bnx2_RXP_b06FwData[(0x0/4) + 1] = { 0x0 }; 1053static u32 bnx2_RXP_b06FwData[(0x0/4) + 1] = { 0x0 };
1940static u32 bnx2_RXP_b06FwRodata[(0x28/4) + 1] = { 1054static u32 bnx2_RXP_b06FwRodata[(0x28/4) + 1] = {
@@ -1943,387 +1057,264 @@ static u32 bnx2_RXP_b06FwRodata[(0x28/4) + 1] = {
1943static u32 bnx2_RXP_b06FwBss[(0x13a4/4) + 1] = { 0x0 }; 1057static u32 bnx2_RXP_b06FwBss[(0x13a4/4) + 1] = { 0x0 };
1944static u32 bnx2_RXP_b06FwSbss[(0x1c/4) + 1] = { 0x0 }; 1058static u32 bnx2_RXP_b06FwSbss[(0x1c/4) + 1] = { 0x0 };
1945 1059
1946static u32 bnx2_rv2p_proc1[] = { 1060static u8 bnx2_rv2p_proc1[] = {
1947 0x00000008, 0xac000001, 0x0000000c, 0x2f800001, 0x00000010, 0x213f0004, 1061 0x1f, 0x8b, 0x08, 0x08, 0x5e, 0xd0, 0x41, 0x44, 0x00, 0x03, 0x74, 0x65,
1948 0x00000010, 0x20bf002c, 0x00000010, 0x203f0143, 0x00000018, 0x8000fffd, 1062 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xc5, 0x56, 0xcf, 0x6b,
1949 0x00000010, 0xb1b8b017, 0x0000000b, 0x2fdf0002, 0x00000000, 0x03d80000, 1063 0x13, 0x51, 0x10, 0x9e, 0xec, 0x6e, 0xb2, 0xdb, 0x74, 0xbb, 0x1b, 0x2b,
1950 0x00000000, 0x2c380000, 0x00000008, 0x2c800000, 0x00000008, 0x2d000000, 1064 0xda, 0xa0, 0xb1, 0x8d, 0x51, 0x6a, 0x7f, 0xa4, 0xb4, 0x11, 0x0f, 0x82,
1951 0x00000010, 0x91d40000, 0x00000008, 0x2d800108, 0x00000008, 0x02000002, 1065 0x42, 0x25, 0x3d, 0x04, 0x54, 0x44, 0x7a, 0x28, 0x22, 0x82, 0x36, 0x8a,
1952 0x00000010, 0x91de0000, 0x0000000f, 0x42e0001c, 0x00000010, 0x91840a08, 1066 0xfe, 0x1b, 0xa1, 0x3f, 0xd2, 0x4b, 0x10, 0x7a, 0xb0, 0x58, 0xf1, 0x50,
1953 0x00000008, 0x2c8000b0, 0x00000008, 0x2d000008, 0x00000008, 0x2d800150, 1067 0x10, 0x2a, 0x68, 0x0f, 0xc9, 0xa1, 0x20, 0x52, 0x11, 0xda, 0x8b, 0x07,
1954 0x00000000, 0x00000000, 0x00000010, 0x91de0000, 0x00000010, 0x2c620002, 1068 0x2f, 0x42, 0x0f, 0x7a, 0x69, 0xbd, 0xa8, 0xff, 0x82, 0x08, 0x4d, 0x7c,
1955 0x00000018, 0x80000012, 0x0000000b, 0x2fdf0002, 0x0000000c, 0x1f800002, 1069 0x6f, 0x66, 0x9e, 0xee, 0x6e, 0xb2, 0x4d, 0x15, 0xc1, 0x85, 0xf6, 0xe3,
1956 0x00000000, 0x2c070000, 0x00000018, 0x8000ffe6, 0x00000008, 0x02000002, 1070 0xbd, 0x9d, 0x79, 0x33, 0xf3, 0xcd, 0x37, 0xfb, 0x62, 0x01, 0x40, 0x04,
1957 0x0000000f, 0x42e0001c, 0x00000010, 0x91840a08, 0x00000008, 0x2c8000b0, 1071 0x60, 0xcd, 0x46, 0x2c, 0x8d, 0x26, 0x04, 0x1a, 0x30, 0x7e, 0x52, 0x62,
1958 0x00000008, 0x2d000008, 0x00000010, 0x91d40000, 0x00000008, 0x2d800108, 1072 0x16, 0xde, 0xa6, 0x25, 0x4e, 0x44, 0xc6, 0xd3, 0x49, 0x81, 0x7b, 0x0d,
1959 0x00000000, 0x00000000, 0x00000010, 0x91de0000, 0x00000018, 0x80000004, 1073 0x28, 0xc9, 0x75, 0x4f, 0xf5, 0x55, 0xad, 0x53, 0xa0, 0x06, 0xbb, 0xa3,
1960 0x0000000c, 0x1f800002, 0x00000000, 0x00000000, 0x00000018, 0x8000ffd9, 1074 0x80, 0xcf, 0x47, 0x9d, 0xf0, 0x7c, 0xd6, 0x42, 0x2c, 0x31, 0xc2, 0x48,
1961 0x0000000c, 0x29800002, 0x0000000c, 0x1f800002, 0x00000000, 0x2adf0000, 1075 0x02, 0x61, 0x7b, 0x51, 0xae, 0xad, 0x48, 0x69, 0xc4, 0x42, 0x3f, 0xd0,
1962 0x00000008, 0x2a000005, 0x00000018, 0x8000ffd4, 0x00000008, 0x02240030, 1076 0x68, 0x7f, 0x67, 0xd1, 0x15, 0xff, 0x53, 0xf0, 0x39, 0x2f, 0xd7, 0x56,
1963 0x00000018, 0x00040000, 0x00000018, 0x80000015, 0x00000018, 0x80000017, 1077 0x7c, 0x0e, 0xed, 0xaa, 0xec, 0x2f, 0xfe, 0xd0, 0xfe, 0xba, 0xf0, 0x03,
1964 0x00000018, 0x8000001b, 0x00000018, 0x8000004c, 0x00000018, 0x8000008c, 1078 0x7e, 0x94, 0x5f, 0x02, 0xcf, 0x29, 0x66, 0x65, 0x5e, 0xdd, 0x22, 0xa0,
1965 0x00000018, 0x8000000f, 0x00000018, 0x8000000e, 0x00000018, 0x8000000d, 1079 0xca, 0xc7, 0x46, 0x2c, 0xf5, 0x91, 0xb5, 0x89, 0xef, 0xbf, 0x8a, 0xbc,
1966 0x00000018, 0x8000000c, 0x00000018, 0x800000c2, 0x00000018, 0x8000000a, 1080 0x55, 0xdc, 0x76, 0xf1, 0x82, 0xf9, 0x06, 0xe3, 0x26, 0x91, 0x1f, 0x28,
1967 0x00000018, 0x80000009, 0x00000018, 0x80000008, 0x00000018, 0x800000fd, 1081 0xf9, 0xe3, 0x00, 0xc8, 0xfd, 0x4f, 0x8d, 0x5f, 0xfb, 0x83, 0xfe, 0xf7,
1968 0x00000018, 0x80000006, 0x00000018, 0x80000005, 0x00000018, 0x800000ff, 1082 0xbb, 0x43, 0xf2, 0xbc, 0x28, 0xc0, 0x90, 0xb4, 0xdb, 0xe6, 0x7c, 0xc6,
1969 0x00000018, 0x80000104, 0x00000018, 0x80000002, 0x00000018, 0x80000098, 1083 0xe0, 0xb4, 0x96, 0xc4, 0xf7, 0x06, 0xfa, 0x1f, 0x11, 0xe7, 0x4a, 0xec,
1970 0x00000018, 0x80000000, 0x0000000c, 0x1f800001, 0x00000000, 0x00000000, 1084 0x61, 0x3c, 0xce, 0x78, 0x95, 0xb1, 0xc2, 0xe8, 0x32, 0x3a, 0x8c, 0x5d,
1971 0x00000018, 0x8000ffba, 0x00000010, 0x91d40000, 0x0000000c, 0x29800001, 1085 0x8c, 0x36, 0xe3, 0x26, 0x63, 0x9c, 0xb1, 0x83, 0xd1, 0x62, 0xdc, 0x63,
1972 0x0000000c, 0x1f800001, 0x00000008, 0x2a000002, 0x00000018, 0x8000ffb5, 1086 0x8c, 0x31, 0x46, 0x19, 0x1b, 0x8c, 0x46, 0x84, 0x50, 0xe3, 0xf5, 0x63,
1973 0x00000010, 0xb1a0b012, 0x0000000b, 0x2fdf0002, 0x00000000, 0x2c200000, 1087 0x46, 0xe0, 0xba, 0x23, 0x81, 0xba, 0x5f, 0xb3, 0x2e, 0x24, 0x6f, 0xfc,
1974 0x00000008, 0x2c800000, 0x00000008, 0x2d000000, 0x00000010, 0x91d40000, 1088 0x7e, 0x50, 0xd9, 0x31, 0xef, 0x58, 0xf7, 0x3a, 0xdb, 0x75, 0x57, 0x57,
1975 0x00000008, 0x2d80011c, 0x00000000, 0x00000000, 0x00000010, 0x91de0000, 1089 0x02, 0xfa, 0x49, 0xef, 0xab, 0x9b, 0x54, 0x8b, 0x3e, 0xb8, 0x58, 0xcf,
1976 0x0000000f, 0x47600008, 0x0000000f, 0x060e0001, 0x00000010, 0x001f0000, 1090 0x9d, 0x82, 0x8b, 0x71, 0x9c, 0x18, 0xed, 0xab, 0xb4, 0x6e, 0xb8, 0x84,
1977 0x00000000, 0x0f580000, 0x00000000, 0x0a640000, 0x00000000, 0x0ae50000, 1091 0xf7, 0xe2, 0x84, 0x5f, 0x18, 0xef, 0x77, 0x12, 0x4e, 0x77, 0xc9, 0x7c,
1978 0x00000000, 0x0b660000, 0x00000000, 0x0d610000, 0x00000018, 0x80000013, 1092 0x0e, 0x8b, 0x80, 0xea, 0x1c, 0x95, 0x4f, 0xbb, 0x3c, 0xc2, 0xe2, 0xa9,
1979 0x0000000f, 0x47600008, 0x0000000b, 0x2fdf0002, 0x00000008, 0x2c800000, 1093 0xbc, 0xda, 0xc5, 0x25, 0x2c, 0x6a, 0xfe, 0xfa, 0x9f, 0x8c, 0x11, 0x1a,
1980 0x00000008, 0x2d000000, 0x00000010, 0x91d40000, 0x00000008, 0x2d80011c, 1094 0x39, 0x22, 0x75, 0xc9, 0x16, 0x3d, 0x83, 0x46, 0x63, 0xd9, 0x36, 0xe4,
1981 0x0000000f, 0x060e0001, 0x00000010, 0x001f0000, 0x00000000, 0x0f580000, 1095 0xfa, 0xdc, 0xf2, 0x7b, 0xd4, 0xfb, 0xd9, 0xa5, 0x1a, 0xe7, 0xe7, 0x2a,
1982 0x00000010, 0x91de0000, 0x00000000, 0x0a640000, 0x00000000, 0x0ae50000, 1096 0x9e, 0x69, 0x0e, 0x32, 0x40, 0xeb, 0x49, 0xe4, 0x1d, 0x04, 0x5a, 0xb8,
1983 0x00000000, 0x0b660000, 0x00000000, 0x0d610000, 0x00000000, 0x02620000, 1097 0x86, 0x8c, 0xbf, 0x5f, 0xa4, 0x43, 0x9d, 0xfb, 0x31, 0xcb, 0xfd, 0x38,
1984 0x0000000b, 0x2fdf0002, 0x00000000, 0x309a0000, 0x00000000, 0x31040000, 1098 0x11, 0xd2, 0x8f, 0xb0, 0xb9, 0x68, 0x9e, 0xc7, 0xdb, 0xe9, 0x20, 0x6f,
1985 0x00000000, 0x0c961800, 0x00000009, 0x0c99ffff, 0x00000004, 0xcc993400, 1099 0x61, 0xf3, 0xa3, 0xf8, 0xa6, 0xdd, 0x3f, 0xe5, 0xf1, 0x01, 0xf3, 0x58,
1986 0x00000010, 0xb1963202, 0x00000008, 0x0f800000, 0x0000000c, 0x29800001, 1100 0x24, 0x1e, 0x93, 0xdf, 0x5a, 0xf2, 0x94, 0xf6, 0xf0, 0x24, 0xeb, 0xec,
1987 0x00000010, 0x00220002, 0x0000000c, 0x29520001, 0x0000000c, 0x29520000, 1101 0x0d, 0xe9, 0x73, 0x58, 0x7d, 0xd9, 0xbf, 0xee, 0x73, 0x20, 0x3f, 0xb8,
1988 0x00000008, 0x22000001, 0x0000000c, 0x1f800001, 0x00000000, 0x2adf0000, 1102 0x8b, 0xdf, 0x9b, 0x04, 0x14, 0x0b, 0x2a, 0x5f, 0x3f, 0xcf, 0xc7, 0xa8,
1989 0x00000008, 0x2a000003, 0x00000018, 0x8000ff83, 0x00000010, 0xb1a0b01d, 1103 0xdf, 0x30, 0x97, 0x93, 0xfb, 0x62, 0xfe, 0x36, 0x35, 0x5c, 0x1b, 0xf9,
1990 0x0000000b, 0x2fdf0002, 0x00000000, 0x2c200000, 0x00000008, 0x2c8000b0, 1104 0x88, 0x04, 0xab, 0x98, 0x23, 0x7f, 0x47, 0xd3, 0x78, 0x7d, 0x50, 0x5d,
1991 0x00000008, 0x2d000008, 0x00000010, 0x91d40000, 0x00000008, 0x2d800150, 1105 0xa8, 0xbe, 0x4b, 0x8c, 0x41, 0x7e, 0x9a, 0xeb, 0xcc, 0x50, 0x3c, 0xd2,
1992 0x00000000, 0x00000000, 0x00000010, 0x205f0000, 0x00000008, 0x2c800000, 1106 0x81, 0xc1, 0x3a, 0xc8, 0xf3, 0xf7, 0x28, 0xc8, 0x87, 0x55, 0x5d, 0x59,
1993 0x00000008, 0x2d000000, 0x00000008, 0x2d800108, 0x00000000, 0x00000000, 1107 0xf4, 0xce, 0x75, 0x12, 0x8a, 0x39, 0xd2, 0x55, 0x73, 0x5f, 0x59, 0x6f,
1994 0x00000010, 0x91de0000, 0x0000000f, 0x47600008, 0x00000000, 0x060e0000, 1108 0x6b, 0xea, 0xbb, 0x84, 0xdb, 0xd5, 0x92, 0xee, 0xab, 0xf7, 0x12, 0x64,
1995 0x00000010, 0x001f0000, 0x00000000, 0x0f580000, 0x00000010, 0x91de0000, 1109 0xbd, 0x3c, 0x47, 0x5a, 0xe8, 0xa3, 0x5d, 0x1c, 0xdf, 0x79, 0x0e, 0x64,
1996 0x00000000, 0x0a640000, 0x00000000, 0x0ae50000, 0x00000000, 0x0b670000, 1110 0x5b, 0x7d, 0x6f, 0x4c, 0xae, 0xeb, 0x0c, 0xeb, 0xfb, 0x68, 0x93, 0xbe,
1997 0x00000000, 0x0d620000, 0x00000000, 0x0ce71800, 0x00000009, 0x0c99ffff, 1111 0xd5, 0x7d, 0xf5, 0xef, 0x74, 0xce, 0xf5, 0x9b, 0x68, 0x97, 0xda, 0x59,
1998 0x00000004, 0xcc993400, 0x00000010, 0xb1963220, 0x00000008, 0x0f800000, 1112 0xf7, 0xde, 0x4f, 0x71, 0xcf, 0xfd, 0x44, 0x6e, 0xa6, 0xca, 0xbb, 0xcf,
1999 0x00000018, 0x8000001e, 0x0000000f, 0x47600008, 0x0000000b, 0x2fdf0002, 1113 0x7b, 0xaf, 0x1c, 0x0a, 0xe9, 0x83, 0xf7, 0x3e, 0x0a, 0xd6, 0xeb, 0xd7,
2000 0x00000008, 0x2c8000b0, 0x00000008, 0x2d000008, 0x00000010, 0x91d40000, 1114 0x23, 0xf5, 0x35, 0xce, 0xf5, 0x9b, 0x0d, 0xee, 0xc3, 0x54, 0xff, 0x0c,
2001 0x00000008, 0x2d80012c, 0x0000000f, 0x060e0001, 0x00000010, 0x001f0000, 1115 0xe9, 0x3f, 0x53, 0x90, 0xfa, 0x71, 0xc1, 0x31, 0xe9, 0x7c, 0x42, 0x71,
2002 0x00000000, 0x0f580000, 0x00000010, 0x91de0000, 0x00000000, 0x0a640000, 1116 0x8e, 0x66, 0x62, 0xde, 0xf3, 0x1a, 0xad, 0xe7, 0x67, 0xd0, 0x2f, 0x3e,
2003 0x00000000, 0x0ae50000, 0x00000000, 0x0b670000, 0x00000000, 0x0d620000, 1117 0xa7, 0xf6, 0xf3, 0x48, 0xd8, 0xe4, 0x8b, 0x2d, 0xe2, 0xbd, 0xa6, 0xab,
2004 0x00000000, 0x02630000, 0x0000000f, 0x47620010, 0x00000000, 0x0ce71800, 1118 0xb9, 0x70, 0x91, 0xef, 0x01, 0x97, 0xec, 0xcc, 0x2b, 0x8a, 0x2f, 0xb9,
2005 0x0000000b, 0x2fdf0002, 0x00000000, 0x311a0000, 0x00000000, 0x31840000, 1119 0xaf, 0xc3, 0x12, 0xcd, 0xc5, 0xad, 0x47, 0x84, 0x37, 0xe1, 0x32, 0x9d,
2006 0x0000000b, 0xc20000ff, 0x00000002, 0x42040000, 0x00000001, 0x31620800, 1120 0xfb, 0xfb, 0xfb, 0x66, 0x21, 0x42, 0x97, 0x57, 0xc7, 0x51, 0xa1, 0x63,
2007 0x0000000f, 0x020e0010, 0x00000002, 0x31620800, 0x00000009, 0x0c99ffff, 1121 0x9c, 0x63, 0x25, 0x57, 0x78, 0xae, 0x11, 0x9f, 0xf3, 0xa4, 0x73, 0x8d,
2008 0x00000004, 0xcc993400, 0x00000010, 0xb1963202, 0x00000008, 0x0f800000, 1122 0xf3, 0xc3, 0xab, 0x45, 0x3e, 0xab, 0xba, 0xac, 0xf7, 0x9a, 0xd2, 0x1d,
2009 0x0000000c, 0x29800001, 0x0000000c, 0x1f800001, 0x0000000c, 0x61420006, 1123 0x0c, 0x9b, 0x38, 0x3f, 0xa9, 0xca, 0x02, 0x2e, 0x7b, 0x1d, 0x46, 0xbb,
2010 0x00000008, 0x22000008, 0x00000000, 0x2adf0000, 0x00000008, 0x2a000004, 1124 0x4c, 0x18, 0xc3, 0xfc, 0x75, 0x78, 0x58, 0x93, 0x7e, 0x05, 0xbe, 0xdf,
2011 0x00000018, 0x8000ff42, 0x00000008, 0x2c8000b0, 0x00000008, 0x2d000008, 1125 0x7e, 0xb0, 0x5e, 0x74, 0xa8, 0xf0, 0xef, 0x8b, 0x05, 0x7c, 0x3f, 0x01,
2012 0x00000010, 0x91a0b008, 0x00000010, 0x91d40000, 0x0000000c, 0x31620018, 1126 0xcd, 0xf7, 0x1b, 0xc5, 0x29, 0x0f, 0x11, 0xda, 0xa7, 0xb8, 0xaf, 0xc3,
2013 0x00000008, 0x2d800001, 0x00000000, 0x00000000, 0x00000010, 0x91de0000, 1127 0xd2, 0xce, 0x11, 0x7e, 0xdc, 0x3f, 0xec, 0xc3, 0x05, 0x8f, 0x3f, 0x42,
2014 0x00000008, 0xac000001, 0x00000018, 0x8000000e, 0x00000000, 0x0380b000, 1128 0xe5, 0xc3, 0x40, 0x98, 0xbf, 0xb4, 0xff, 0xde, 0xe2, 0x3e, 0xa5, 0xf7,
2015 0x0000000b, 0x2fdf0002, 0x00000000, 0x2c004000, 0x00000010, 0x91d40000, 1129 0x2f, 0xc9, 0x7e, 0xaa, 0xff, 0x19, 0xd7, 0x3f, 0xec, 0xd5, 0xbd, 0x8a,
2016 0x00000008, 0x2d800101, 0x00000000, 0x00000000, 0x00000010, 0x91de0000, 1130 0xf7, 0xae, 0xbe, 0xff, 0x7d, 0xdc, 0xc1, 0x76, 0x5b, 0xfb, 0xd8, 0xd1,
2017 0x0000000c, 0x31620018, 0x00000008, 0x2d800001, 0x00000000, 0x00000000, 1131 0xf1, 0xf9, 0x41, 0xef, 0xfd, 0xfd, 0xa6, 0x4e, 0x3c, 0x6d, 0xd4, 0xd5,
2018 0x00000010, 0x91de0000, 0x0000000b, 0x2fdf0002, 0x00000000, 0x2c000e00, 1132 0x5c, 0x6d, 0x84, 0xcc, 0xd5, 0xc5, 0xff, 0x3a, 0x57, 0x10, 0x98, 0xab,
2019 0x0000000c, 0x29800001, 0x0000000c, 0x1f800001, 0x00000008, 0x2a000007, 1133 0xd5, 0xfa, 0xc1, 0xe6, 0x0a, 0xb8, 0x7e, 0x08, 0x99, 0xab, 0x18, 0xf3,
2020 0x00000018, 0x8000ff27, 0x00000010, 0xb1a0b016, 0x0000000b, 0x2fdf0002, 1134 0xf0, 0x94, 0xcf, 0x33, 0x20, 0xaa, 0xc7, 0xb0, 0x7d, 0xc6, 0x2c, 0xeb,
2021 0x00000000, 0x03d80000, 0x00000000, 0x2c200000, 0x00000008, 0x2c8000b0, 1135 0x92, 0xf4, 0x68, 0x47, 0xcb, 0xa8, 0x3f, 0xc7, 0x2e, 0x93, 0x9d, 0x41,
2022 0x00000008, 0x2d000008, 0x00000010, 0x91d40000, 0x00000008, 0x2d800150, 1136 0xfb, 0x49, 0x85, 0x0b, 0xb3, 0xf4, 0x7b, 0x4a, 0x83, 0x9f, 0x94, 0x15,
2023 0x00000000, 0x00000000, 0x00000010, 0x205f0000, 0x00000008, 0x2c800000, 1137 0x12, 0x3d, 0x80, 0x0b, 0x00, 0x00, 0x00 };
2024 0x00000008, 0x2d000000, 0x00000008, 0x2d800108, 0x00000008, 0x07000001,
2025 0x00000010, 0xb5de1c00, 0x00000010, 0x2c620002, 0x00000018, 0x8000000a,
2026 0x0000000b, 0x2fdf0002, 0x00000000, 0x2c070000, 0x0000000c, 0x1f800001,
2027 0x00000010, 0x91de0000, 0x00000018, 0x8000ff11, 0x00000008, 0x2c8000b0,
2028 0x00000008, 0x2d000008, 0x00000010, 0x91d40000, 0x00000008, 0x2d800108,
2029 0x0000000c, 0x29800001, 0x0000000c, 0x1f800001, 0x00000010, 0x91de0000,
2030 0x00000000, 0x2adf0000, 0x00000008, 0x2a00000a, 0x00000018, 0x8000ff07,
2031 0x00000000, 0x82265600, 0x0000000f, 0x47220008, 0x00000009, 0x070e000f,
2032 0x00000008, 0x070e0008, 0x00000008, 0x02800001, 0x00000007, 0x02851c00,
2033 0x00000008, 0x82850001, 0x00000000, 0x02840a00, 0x00000007, 0x42851c00,
2034 0x00000003, 0xc3aa5200, 0x00000000, 0x03b10e00, 0x00000010, 0x001f0000,
2035 0x0000000f, 0x0f280007, 0x00000007, 0x4b071c00, 0x00000000, 0x00000000,
2036 0x0000000f, 0x0a960003, 0x00000000, 0x0a955c00, 0x00000000, 0x4a005a00,
2037 0x00000000, 0x0c960a00, 0x00000009, 0x0c99ffff, 0x00000008, 0x0d00ffff,
2038 0x00000010, 0xb1963202, 0x00000008, 0x0f800005, 0x00000010, 0x00220020,
2039 0x00000000, 0x02a70000, 0x00000010, 0xb1850002, 0x00000008, 0x82850200,
2040 0x00000000, 0x02000000, 0x00000000, 0x03a60000, 0x00000018, 0x8000004e,
2041 0x00000000, 0x072b0000, 0x00000001, 0x878c1c00, 0x00000000, 0x870e1e00,
2042 0x00000000, 0x860c1e00, 0x00000000, 0x03061e00, 0x00000010, 0xb18e0003,
2043 0x00000018, 0x80000047, 0x00000018, 0x8000fffa, 0x00000010, 0x918c0003,
2044 0x00000010, 0xb1870002, 0x00000018, 0x80000043, 0x00000010, 0x91d40000,
2045 0x0000000c, 0x29800001, 0x00000000, 0x2a860000, 0x00000000, 0x230c0000,
2046 0x00000000, 0x2b070000, 0x00000010, 0xb187000e, 0x00000008, 0x2a000008,
2047 0x00000018, 0x8000003b, 0x00000010, 0x91d40000, 0x00000000, 0x28d18c00,
2048 0x00000000, 0x2a860000, 0x00000000, 0x230c0000, 0x00000000, 0x2b070000,
2049 0x00000018, 0x8000fff8, 0x00000010, 0x91d40000, 0x0000000c, 0x29800001,
2050 0x00000000, 0x2aab0000, 0x00000000, 0xa3265600, 0x00000000, 0x2b000000,
2051 0x0000000c, 0x1f800001, 0x00000008, 0x2a000008, 0x00000018, 0x8000fec8,
2052 0x00000010, 0x91d40000, 0x0000000c, 0x29800001, 0x0000000c, 0x1f800001,
2053 0x00000008, 0x2a000009, 0x00000018, 0x8000fec3, 0x00000010, 0x91d40000,
2054 0x0000000c, 0x29800001, 0x0000000c, 0x1f800001, 0x00000000, 0x29420000,
2055 0x00000008, 0x2a000002, 0x00000018, 0x8000febd, 0x00000018, 0x8000febc,
2056 0x00000010, 0xb1bcb016, 0x0000000b, 0x2fdf0002, 0x00000000, 0x03d80000,
2057 0x00000000, 0x2c3c0000, 0x00000008, 0x2c8000b0, 0x00000008, 0x2d000008,
2058 0x00000010, 0x91d40000, 0x00000008, 0x2d800150, 0x00000000, 0x00000000,
2059 0x00000010, 0x205f0000, 0x00000008, 0x2c800000, 0x00000008, 0x2d000000,
2060 0x00000008, 0x2d800108, 0x00000008, 0x07000001, 0x00000010, 0xb5de1c00,
2061 0x00000010, 0x2c620002, 0x00000018, 0x8000000a, 0x0000000b, 0x2fdf0002,
2062 0x00000000, 0x2c070000, 0x0000000c, 0x1f800000, 0x00000010, 0x91de0000,
2063 0x00000018, 0x8000fea6, 0x00000008, 0x2c8000b0, 0x00000008, 0x2d000008,
2064 0x00000010, 0x91d40000, 0x00000008, 0x2d800108, 0x0000000c, 0x29800000,
2065 0x0000000c, 0x1f800000, 0x00000010, 0x91de0000, 0x00000000, 0x2adf0000,
2066 0x00000008, 0x2a000006, 0x00000018, 0x8000fe9c, 0x00000008, 0x03050004,
2067 0x00000006, 0x83040c00, 0x00000008, 0x02850200, 0x00000000, 0x86050c00,
2068 0x00000001, 0x860c0e00, 0x00000008, 0x02040004, 0x00000000, 0x02041800,
2069 0x00000000, 0x83871800, 0x00000018, 0x00020000 };
2070 1138
2071static u32 bnx2_rv2p_proc2[] = { 1139static u8 bnx2_rv2p_proc2[] = {
2072 0x00000000, 0x2a000000, 0x00000010, 0xb1d40000, 0x00000008, 0x02540003, 1140 0x1f, 0x8b, 0x08, 0x08, 0x7e, 0xd1, 0x41, 0x44, 0x00, 0x03, 0x74, 0x65,
2073 0x00000018, 0x00040000, 0x00000018, 0x8000000a, 0x00000018, 0x8000000a, 1141 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xcd, 0x58, 0x5b, 0x6c,
2074 0x00000018, 0x8000000e, 0x00000018, 0x80000056, 0x00000018, 0x800001b9, 1142 0x54, 0x55, 0x14, 0x3d, 0xf3, 0xe8, 0xcc, 0x9d, 0xe9, 0xed, 0x9d, 0xf2,
2075 0x00000018, 0x800001e1, 0x00000018, 0x8000019b, 0x00000018, 0x800001f9, 1143 0xb2, 0x03, 0xad, 0x08, 0xe5, 0xd1, 0x56, 0x29, 0xe8, 0x54, 0xab, 0x18,
2076 0x00000018, 0x8000019f, 0x00000018, 0x800001a6, 0x00000018, 0x80000000, 1144 0x15, 0x2c, 0x5a, 0x8c, 0x26, 0x68, 0xf0, 0xf9, 0x63, 0x14, 0x04, 0xda,
2077 0x0000000c, 0x29800001, 0x00000000, 0x2a000000, 0x0000000c, 0x29800000, 1145 0x9a, 0x56, 0x9b, 0x16, 0xfb, 0x81, 0xaf, 0x09, 0x14, 0x6a, 0x4c, 0x25,
2078 0x00000010, 0x20530000, 0x00000018, 0x8000ffee, 0x0000000c, 0x29800001, 1146 0xd6, 0x08, 0xc5, 0x47, 0xa0, 0x11, 0x1f, 0x84, 0xf0, 0xd3, 0x1f, 0x3b,
2079 0x00000010, 0x91de0000, 0x00000010, 0x001f0000, 0x00000000, 0x2f80aa00, 1147 0x8d, 0x7f, 0x0a, 0x24, 0x6a, 0x88, 0xc4, 0xa8, 0x9f, 0x24, 0x68, 0xa0,
2080 0x00000000, 0x2a000000, 0x00000000, 0x0d610000, 0x00000000, 0x03620000, 1148 0x21, 0x0a, 0x58, 0x8b, 0x63, 0x4c, 0xb4, 0xf5, 0xec, 0xbd, 0xf6, 0xb9,
2081 0x00000000, 0x2c400000, 0x00000000, 0x02638c00, 0x00000000, 0x26460000, 1149 0x73, 0xef, 0x6d, 0x8b, 0x1a, 0xf9, 0x70, 0x3e, 0xba, 0x7b, 0xce, 0xd9,
2082 0x00000010, 0x00420002, 0x00000008, 0x02040012, 0x00000010, 0xb9060836, 1150 0x67, 0x3f, 0xd6, 0xde, 0x67, 0x9f, 0x7d, 0xae, 0x52, 0xfc, 0xbb, 0xb6,
2083 0x00000000, 0x0f580000, 0x00000000, 0x0a640000, 0x00000000, 0x0ae50000, 1151 0x94, 0xc9, 0x37, 0x83, 0x96, 0xfe, 0x1b, 0x51, 0x0f, 0x85, 0xd3, 0x3c,
2084 0x00000000, 0x0b660000, 0x00000000, 0x0c000000, 0x00000000, 0x0b800000, 1152 0x8e, 0x2a, 0xa2, 0x49, 0xa5, 0xb2, 0x5e, 0xea, 0x08, 0x7d, 0x44, 0xe8,
2085 0x00000010, 0x00420009, 0x00000008, 0x0cc60012, 0x00000008, 0x0f800003, 1153 0x70, 0x08, 0xf4, 0xb4, 0xd0, 0x77, 0x84, 0xfe, 0x2e, 0xf4, 0x80, 0xd0,
2086 0x00000000, 0x00000000, 0x00000010, 0x009f0000, 0x00000008, 0x27110012, 1154 0x0f, 0x85, 0xea, 0x5f, 0xd6, 0xd6, 0x7f, 0xf4, 0xb0, 0x46, 0x89, 0x7e,
2087 0x00000000, 0x66900000, 0x00000008, 0xa31b0012, 0x00000018, 0x80000008, 1155 0x1b, 0xd3, 0x35, 0xb0, 0xe3, 0xc1, 0x05, 0xc4, 0x77, 0x61, 0xa2, 0xc0,
2088 0x00000000, 0x0cc60000, 0x00000008, 0x0f800003, 0x00000000, 0x00000000, 1156 0x87, 0xf9, 0x53, 0x7d, 0xa0, 0xd7, 0x60, 0xd7, 0xe1, 0xec, 0x0a, 0xb3,
2089 0x00000010, 0x009f0000, 0x00000000, 0x27110000, 0x00000000, 0x66900000, 1157 0x1f, 0x64, 0x43, 0x09, 0xe8, 0xc6, 0x08, 0xe8, 0xea, 0x65, 0x4c, 0x7a,
2090 0x00000000, 0x231b0000, 0x00000010, 0xb197320e, 0x00000000, 0x25960000, 1158 0x9f, 0x0a, 0x63, 0xdc, 0xb8, 0x94, 0xf6, 0x87, 0x55, 0x83, 0x22, 0x3f,
2091 0x00000000, 0x021b0000, 0x00000010, 0x001f0000, 0x00000008, 0x0f800003, 1159 0x67, 0xaa, 0x68, 0x98, 0xc6, 0xf5, 0x56, 0x6c, 0x18, 0xeb, 0x8f, 0xa5,
2092 0x0000000c, 0x29800000, 0x00000010, 0x20530000, 0x00000000, 0x22c50800, 1160 0x40, 0x37, 0x25, 0x41, 0xcf, 0x08, 0xdd, 0x52, 0x2c, 0x7a, 0x6c, 0x31,
2093 0x00000010, 0x009f0000, 0x00000000, 0x27002200, 0x00000000, 0x26802000, 1161 0xbf, 0x98, 0xf6, 0x25, 0x5c, 0x39, 0xc7, 0x6d, 0xe0, 0x96, 0x95, 0xfd,
2094 0x00000000, 0x231b0000, 0x0000000c, 0x69520001, 0x00000018, 0x8000fff3, 1162 0x4a, 0xc1, 0xce, 0x03, 0xb2, 0x3e, 0xa3, 0x0a, 0xb3, 0xaf, 0x6f, 0xc1,
2095 0x00000010, 0x01130002, 0x00000010, 0xb1980003, 0x00000010, 0x001f0000, 1163 0xb8, 0xfc, 0x20, 0xf9, 0xa7, 0xff, 0xcf, 0x62, 0x7e, 0xfa, 0xfd, 0xf8,
2096 0x00000008, 0x0f800004, 0x00000008, 0x22000003, 0x00000008, 0x2c80000c, 1164 0x15, 0xf6, 0x83, 0x96, 0x2f, 0xa2, 0x75, 0x27, 0xd3, 0x3f, 0x88, 0xf1,
2097 0x00000008, 0x2d00000c, 0x00000010, 0x009f0000, 0x00000000, 0x25960000, 1165 0xde, 0x25, 0x32, 0x1f, 0x36, 0xf8, 0x18, 0x79, 0x41, 0x5c, 0x99, 0x58,
2098 0x0000000c, 0x29800000, 0x00000000, 0x32140000, 0x00000000, 0x32950000, 1166 0xc7, 0x2a, 0x7d, 0xf2, 0x2b, 0x15, 0xe4, 0x2f, 0xc8, 0x2e, 0x35, 0xf2,
2099 0x00000000, 0x33160000, 0x00000000, 0x31e32e00, 0x00000008, 0x2d800010, 1167 0x81, 0xfb, 0xfa, 0x16, 0xb2, 0x73, 0x4c, 0xc7, 0x01, 0xb8, 0xcd, 0x0a,
2100 0x00000010, 0x20530000, 0x00000018, 0x8000ffac, 0x00000000, 0x23000000, 1168 0x95, 0xb2, 0xdc, 0x7d, 0x83, 0x5e, 0x3d, 0x51, 0xad, 0x07, 0xfa, 0x54,
2101 0x00000000, 0x25e60000, 0x00000008, 0x2200000b, 0x0000000c, 0x69520000, 1169 0xa5, 0xc5, 0x20, 0x65, 0x97, 0x81, 0xaa, 0x5a, 0xbf, 0x1f, 0x7b, 0x97,
2102 0x0000000c, 0x29800000, 0x00000010, 0x20530000, 0x00000018, 0x8000ffa5, 1170 0x18, 0x7b, 0x30, 0x9e, 0x9d, 0x01, 0xdd, 0x23, 0xf4, 0xaa, 0x3a, 0x26,
2103 0x0000000c, 0x29800001, 0x00000010, 0x91de0000, 0x00000000, 0x2fd50000, 1171 0xcb, 0x7f, 0xb8, 0xc1, 0x62, 0x0c, 0xb2, 0xb5, 0xde, 0x7c, 0x38, 0x32,
2104 0x00000010, 0x001f0000, 0x00000000, 0x02700000, 0x00000000, 0x0d620000, 1172 0x61, 0xf0, 0x52, 0x8b, 0x40, 0xce, 0x2e, 0x21, 0x3e, 0x1d, 0x9c, 0x4a,
2105 0x00000000, 0xbb630800, 0x00000000, 0x2a000000, 0x00000009, 0x076000ff, 1173 0xc8, 0x5d, 0xdf, 0x32, 0x55, 0x1e, 0x7d, 0x30, 0x45, 0x1e, 0x61, 0xff,
2106 0x0000000f, 0x2c0e0007, 0x00000008, 0x2c800000, 0x00000008, 0x2d000064, 1174 0xb7, 0x2b, 0x7c, 0xf9, 0xa4, 0xda, 0x25, 0x4f, 0x36, 0x22, 0x8f, 0xac,
2107 0x00000008, 0x2d80011c, 0x00000009, 0x06420002, 0x0000000c, 0x61420001, 1175 0xa7, 0x3e, 0x91, 0x85, 0x6b, 0x13, 0xfa, 0xcf, 0x84, 0x7a, 0x32, 0x4e,
2108 0x00000000, 0x0f400000, 0x00000000, 0x02d08c00, 0x00000000, 0x23000000, 1176 0x01, 0x8a, 0x2b, 0x87, 0xfd, 0x53, 0xe2, 0xe7, 0x26, 0xed, 0x27, 0xd1,
2109 0x00000004, 0x826da000, 0x00000000, 0x8304a000, 0x00000000, 0x22c50c00, 1177 0x8a, 0x50, 0xb6, 0x36, 0xc1, 0x38, 0x35, 0xc4, 0xa0, 0xaf, 0x61, 0x03,
2110 0x00000000, 0x03760000, 0x00000004, 0x83860a00, 0x00000000, 0x83870c00, 1178 0xb6, 0xaf, 0x46, 0x5c, 0x7b, 0x4f, 0x86, 0x8d, 0xfd, 0x51, 0xfa, 0x3b,
2111 0x00000010, 0x91de0000, 0x00000000, 0x037c0000, 0x00000000, 0x837b0c00, 1179 0xd0, 0xb6, 0x9d, 0x47, 0x03, 0xd1, 0x1d, 0x4c, 0xed, 0x63, 0x95, 0x58,
2112 0x00000001, 0x83060e00, 0x00000000, 0x83870c00, 0x00000000, 0x82850e00, 1180 0xee, 0x8a, 0xf0, 0x7a, 0x72, 0x97, 0xcc, 0xf7, 0xec, 0xf0, 0xdb, 0xfd,
2113 0x00000010, 0xb1860016, 0x0000000f, 0x47610018, 0x00000000, 0x068e0000, 1181 0x02, 0xf2, 0xdb, 0x7e, 0x7e, 0x47, 0x88, 0xa8, 0x13, 0x73, 0xf9, 0x98,
2114 0x0000000f, 0x47670010, 0x0000000f, 0x47e20010, 0x00000000, 0x870e1e00, 1182 0x3a, 0x3b, 0xb7, 0x13, 0xff, 0x55, 0x6a, 0xd7, 0x20, 0x29, 0x4e, 0xab,
2115 0x00000010, 0xb70e1a10, 0x00000010, 0x0ce7000e, 0x00000008, 0x22000009, 1183 0x0d, 0x6b, 0xb1, 0x6f, 0x77, 0x2c, 0xc5, 0xb8, 0x36, 0xad, 0x05, 0xfd,
2116 0x00000000, 0x286d0000, 0x0000000f, 0x65680010, 0x00000003, 0xf66c9400, 1184 0x1e, 0xf3, 0xf3, 0x9d, 0x1e, 0xe2, 0x2f, 0x9d, 0xe7, 0x0c, 0x71, 0x5e,
2117 0x00000010, 0xb972a003, 0x0000000c, 0x73e70019, 0x0000000c, 0x21420004, 1185 0xa9, 0x11, 0xce, 0xc7, 0x04, 0x65, 0x06, 0xff, 0xda, 0xaa, 0xc1, 0xdf,
2118 0x00000018, 0x8000023f, 0x00000000, 0x37ed0000, 0x0000000c, 0x73e7001a, 1186 0xbc, 0x99, 0x15, 0xbf, 0xd9, 0x9a, 0xe7, 0x3c, 0x18, 0xe8, 0x18, 0x26,
2119 0x00000010, 0x20530000, 0x00000008, 0x22000008, 0x0000000c, 0x61420004, 1187 0x3f, 0xe7, 0xaa, 0x91, 0x4e, 0xa2, 0x51, 0xd5, 0xb0, 0x90, 0xf0, 0x5e,
2120 0x00000000, 0x02f60000, 0x00000004, 0x82840a00, 0x00000010, 0xb1840a2b, 1188 0x15, 0x36, 0x71, 0x3a, 0x7f, 0x33, 0xcd, 0xcf, 0xd3, 0xeb, 0x26, 0x1e,
2121 0x00000010, 0x2d67000a, 0x00000010, 0xb96d0804, 0x00000004, 0xb6ed0a00, 1189 0x24, 0xd7, 0x92, 0x78, 0x45, 0x5d, 0x7c, 0xf2, 0x61, 0xf8, 0xdb, 0xcd,
2122 0x00000000, 0x37ed0000, 0x00000018, 0x80000029, 0x0000000c, 0x61420000, 1190 0x76, 0x5f, 0x97, 0xec, 0xe6, 0xfc, 0x4a, 0xaa, 0x26, 0x8e, 0x7f, 0xd4,
2123 0x00000000, 0x37040000, 0x00000000, 0x37850000, 0x0000000c, 0x33e7001a, 1191 0x6a, 0x1b, 0xc6, 0xfa, 0xf9, 0x8f, 0x8d, 0x5c, 0xd2, 0x53, 0x23, 0x75,
2124 0x00000018, 0x80000024, 0x00000010, 0xb96d0809, 0x00000004, 0xb6ed0a00, 1192 0x44, 0xb9, 0x72, 0xa2, 0x37, 0x83, 0xee, 0x34, 0x7a, 0xeb, 0x88, 0x6f,
2125 0x00000000, 0x036d0000, 0x00000004, 0xb76e0c00, 0x00000010, 0x91ee0c1f, 1193 0xb1, 0x42, 0xfe, 0x26, 0x26, 0xc9, 0x69, 0x03, 0xce, 0xf6, 0x33, 0xec,
2126 0x0000000c, 0x73e7001a, 0x00000004, 0xb6ef0c00, 0x00000000, 0x37ed0000, 1194 0xf7, 0x35, 0xf6, 0x85, 0x3e, 0x63, 0x2f, 0xe6, 0x2f, 0xfa, 0xf4, 0x95,
2127 0x00000018, 0x8000001b, 0x0000000c, 0x61420000, 0x00000010, 0xb7ee0a05, 1195 0x7b, 0xf4, 0x11, 0x7f, 0x51, 0xf2, 0x02, 0xef, 0x9b, 0x63, 0x3d, 0x3b,
2128 0x00000010, 0xb96f0815, 0x00000003, 0xb76e0800, 0x00000004, 0xb7ef0a00, 1196 0xcc, 0xb8, 0x58, 0xcf, 0x0c, 0x41, 0xfe, 0xc5, 0x21, 0xe2, 0x9f, 0x23,
2129 0x00000018, 0x80000015, 0x00000010, 0x0ce7000c, 0x00000008, 0x22000009, 1197 0x7a, 0xed, 0xff, 0x88, 0xe7, 0x9c, 0x30, 0xe4, 0x4c, 0x8f, 0x5f, 0xc1,
2130 0x00000000, 0x286d0000, 0x0000000f, 0x65680010, 0x00000003, 0xf66c9400, 1198 0x6f, 0xe3, 0x17, 0xcb, 0xb5, 0x47, 0x73, 0x69, 0xe6, 0x33, 0xf1, 0xe8,
2131 0x00000010, 0xb972a003, 0x0000000c, 0x73e70019, 0x0000000c, 0x21420004, 1199 0x0e, 0x73, 0x02, 0xa6, 0x1b, 0x16, 0xfa, 0x71, 0x33, 0xf6, 0x9c, 0xdf,
2132 0x00000018, 0x80000215, 0x00000010, 0x20530000, 0x00000008, 0x22000008, 1200 0xcc, 0x79, 0x3e, 0xd1, 0x26, 0x75, 0x40, 0x71, 0x9d, 0xb9, 0x5d, 0xe2,
2133 0x0000000c, 0x61420004, 0x00000000, 0x37040000, 0x00000000, 0x37850000, 1201 0xa1, 0xf3, 0x3a, 0x04, 0xff, 0x46, 0x73, 0x2c, 0x3f, 0xd9, 0xc5, 0x79,
2134 0x00000000, 0x036d0000, 0x00000003, 0xb8f10c00, 0x00000018, 0x80000004, 1202 0xb9, 0xd2, 0x8e, 0xe6, 0x38, 0x5e, 0xd6, 0xd9, 0x21, 0x6c, 0x2b, 0xd4,
2135 0x00000000, 0x02840000, 0x00000002, 0x21421800, 0x0000000c, 0x61420000, 1203 0x4f, 0xc8, 0x6b, 0xb6, 0x41, 0x9b, 0xa4, 0x8e, 0x9e, 0x15, 0xda, 0x6d,
2136 0x00000000, 0x286d0000, 0x0000000f, 0x65ed0010, 0x00000009, 0x266dffff, 1204 0x33, 0x3e, 0xba, 0x8e, 0x59, 0x2c, 0x3f, 0x9b, 0x32, 0xf7, 0x0c, 0xd6,
2137 0x00000000, 0x23000000, 0x00000010, 0xb1840a3d, 0x00000010, 0x01420002, 1205 0x9f, 0x16, 0x39, 0x3f, 0x0a, 0x55, 0x22, 0xa7, 0x55, 0xf6, 0x9f, 0xf3,
2138 0x00000004, 0xb8f10a00, 0x00000003, 0x83760a00, 0x00000010, 0xb8040c39, 1206 0xc9, 0x89, 0x04, 0xe4, 0x84, 0x94, 0xc1, 0xcd, 0x9c, 0xef, 0x5d, 0x52,
2139 0x00000010, 0xb7e6080a, 0x00000000, 0x0a640000, 0x00000000, 0x0ae50000, 1207 0xbf, 0xf7, 0xc5, 0xa6, 0xab, 0xb7, 0x7c, 0x0e, 0xdc, 0xba, 0x5a, 0x8e,
2140 0x00000009, 0x0c68ffff, 0x00000009, 0x0b67ffff, 0x00000000, 0x0be60000, 1208 0x3a, 0x53, 0x1f, 0x0d, 0xb3, 0xbf, 0x03, 0xdd, 0x3b, 0x80, 0x53, 0x8f,
2141 0x00000000, 0x0c840000, 0x00000010, 0xb197320c, 0x00000008, 0x0f800002, 1209 0xe0, 0x14, 0x07, 0x4e, 0xf3, 0x0a, 0xf5, 0x59, 0x14, 0xd4, 0x90, 0xfe,
2142 0x00000018, 0x8000000a, 0x00000000, 0x0a6a0000, 0x00000000, 0x0aeb0000, 1210 0x53, 0x21, 0xe3, 0xc7, 0xbe, 0x98, 0xaf, 0xfe, 0xf6, 0x9a, 0xfa, 0x5b,
2143 0x00000000, 0x0c000000, 0x00000009, 0x0b6cffff, 0x00000000, 0x0be90000, 1211 0xa8, 0xd3, 0xc4, 0xff, 0xb3, 0xa9, 0x6f, 0x5a, 0x9f, 0xd1, 0xff, 0x6f,
2144 0x00000000, 0x0c840000, 0x00000010, 0xb1973203, 0x00000008, 0x0f800002, 1212 0xf5, 0x72, 0x9c, 0x92, 0xdd, 0x7d, 0x26, 0xce, 0x98, 0x2e, 0xd4, 0xd9,
2145 0x00000018, 0x80000001, 0x00000010, 0x001f0000, 0x00000000, 0x0c860000, 1213 0x22, 0x22, 0xcb, 0x46, 0x3a, 0x99, 0x5e, 0xdf, 0xbc, 0x15, 0xf3, 0x65,
2146 0x00000000, 0x06980000, 0x00000008, 0x0f800003, 0x00000000, 0x00000000, 1214 0x7c, 0x4e, 0x6e, 0x09, 0x01, 0xaf, 0xa8, 0x3a, 0xde, 0x87, 0xba, 0xae,
2147 0x00000010, 0x009f0000, 0x00000010, 0xb1973210, 0x00000000, 0x231b0000, 1215 0xe2, 0x2c, 0xaf, 0xe2, 0x28, 0xc7, 0x3f, 0xaa, 0xe5, 0x12, 0xdf, 0x67,
2148 0x00000000, 0x02043600, 0x00000003, 0x8384a000, 0x0000000f, 0x65870010, 1216 0xa1, 0x42, 0x3e, 0x7a, 0xfd, 0xd9, 0xad, 0xf3, 0x84, 0xec, 0x88, 0xe9,
2149 0x00000009, 0x2607ffff, 0x00000000, 0x27111a00, 0x00000000, 0x66900000, 1217 0xbc, 0xa5, 0xb1, 0x3e, 0x47, 0xb6, 0xe4, 0xf9, 0x1a, 0xe6, 0xb3, 0xc7,
2150 0x0000000c, 0x29000000, 0x00000018, 0x800001de, 0x00000000, 0x06980000, 1218 0x22, 0x34, 0xff, 0x80, 0xd5, 0xd3, 0x87, 0xf9, 0x9f, 0x1a, 0x69, 0xbc,
2151 0x00000010, 0x20530000, 0x00000000, 0x22c58c00, 0x00000010, 0x001f0000, 1219 0xce, 0x7e, 0x0d, 0xe7, 0xcc, 0x7e, 0x0d, 0xf5, 0xcb, 0x2a, 0x3a, 0x88,
2152 0x00000008, 0x0f800003, 0x00000018, 0x8000fff0, 0x00000000, 0x02043600, 1220 0xba, 0xd6, 0x78, 0x10, 0xf2, 0x71, 0x4f, 0x7b, 0xfd, 0xf2, 0xe2, 0x47,
2153 0x00000000, 0x231b0000, 0x00000003, 0x8384a000, 0x0000000f, 0x65870010, 1221 0xe7, 0xe1, 0xb2, 0x38, 0xd9, 0xcf, 0x09, 0x4e, 0x97, 0x7c, 0xf1, 0x39,
2154 0x00000009, 0x2607ffff, 0x00000000, 0x27111a00, 0x00000000, 0x66900000, 1222 0x6c, 0xe2, 0xd3, 0x1b, 0x93, 0xf3, 0xd2, 0x7c, 0x29, 0xe8, 0x17, 0xf1,
2155 0x0000000c, 0x29000000, 0x00000010, 0x91840a02, 0x00000002, 0x21421800, 1223 0x9d, 0x71, 0xef, 0x9d, 0xae, 0x95, 0xa0, 0xdd, 0x2b, 0xe5, 0x9c, 0xd6,
2156 0x00000000, 0x32140000, 0x00000000, 0x32950000, 0x00000005, 0x73e72c00, 1224 0xf9, 0xf3, 0x6b, 0x3e, 0xea, 0xf2, 0xb8, 0x7b, 0x4f, 0x20, 0xbf, 0xac,
2157 0x00000005, 0x74683000, 0x00000000, 0x33170000, 0x00000018, 0x80000138, 1225 0x9d, 0xf0, 0x4b, 0xbd, 0x28, 0x79, 0x3c, 0x2e, 0xf4, 0x65, 0xc9, 0xdf,
2158 0x00000010, 0x91c60004, 0x00000008, 0x07000004, 0x00000010, 0xb1c41c02, 1226 0x6d, 0xd2, 0xb7, 0x98, 0xfe, 0xe2, 0x0f, 0xcc, 0x3b, 0xfd, 0x6e, 0x5f,
2159 0x00000010, 0x91840a04, 0x00000018, 0x800001c3, 0x00000010, 0x20530000, 1227 0x60, 0xea, 0x36, 0x8d, 0x43, 0xca, 0x89, 0x13, 0x83, 0x36, 0xeb, 0x33,
2160 0x00000000, 0x22c58c00, 0x00000010, 0xb1840a8e, 0x0000000c, 0x21420006, 1228 0x24, 0x4a, 0xcf, 0x1a, 0xe0, 0x35, 0x52, 0x07, 0xbe, 0xdd, 0x91, 0xb0,
2161 0x00000010, 0x0ce7001a, 0x0000000f, 0x43680010, 0x00000000, 0x03f30c00, 1229 0x8c, 0x21, 0x6f, 0xac, 0xda, 0x77, 0x0f, 0xd7, 0x4f, 0xc6, 0x93, 0xe4,
2162 0x00000010, 0x91870850, 0x0000000f, 0x46ec0010, 0x00000010, 0xb68d0c4e, 1230 0xc6, 0xdc, 0xfa, 0x24, 0x79, 0xaf, 0x26, 0x84, 0x96, 0x2f, 0xbe, 0x2c,
2163 0x00000000, 0x838d0c00, 0x00000000, 0xa3050800, 0x00000001, 0xa3460e00, 1231 0xbe, 0x85, 0xfe, 0x64, 0xa9, 0x17, 0xdf, 0x97, 0x34, 0xbe, 0xbc, 0xaf,
2164 0x00000000, 0x02048c00, 0x00000010, 0x91840a02, 0x00000002, 0x21421800, 1232 0xbe, 0xf9, 0x12, 0xa6, 0x4b, 0x6f, 0x05, 0xed, 0xbb, 0x95, 0xe7, 0x17,
2165 0x00000010, 0x001f0000, 0x00000008, 0x22000008, 0x00000003, 0x8384a000, 1233 0xa3, 0xee, 0x11, 0x7e, 0x9c, 0x5f, 0xf5, 0x6f, 0x0c, 0x9a, 0x7e, 0x42,
2166 0x0000000f, 0x65870010, 0x00000009, 0x2607ffff, 0x00000000, 0x27750c00, 1234 0xf0, 0x08, 0xf4, 0x41, 0x65, 0x77, 0x80, 0xbe, 0x29, 0x74, 0xce, 0x2a,
2167 0x00000000, 0x66f40000, 0x0000000c, 0x29000000, 0x00000018, 0x800001aa, 1235 0xd0, 0xbd, 0xab, 0xfc, 0x71, 0x88, 0xa5, 0x7c, 0x71, 0xac, 0x47, 0x1c,
2168 0x00000000, 0x03068c00, 0x00000003, 0xf4680c00, 0x00000010, 0x20530000, 1236 0x8f, 0x4c, 0x04, 0xeb, 0x81, 0xc4, 0x4b, 0xc7, 0x27, 0x70, 0xbf, 0x1b,
2169 0x00000000, 0x22c58c00, 0x00000018, 0x8000ffe5, 0x00000000, 0x39760000, 1237 0xfd, 0xe2, 0xce, 0xdf, 0xc5, 0xed, 0x4a, 0xc7, 0xab, 0x7b, 0x25, 0xee,
2170 0x00000000, 0x39840000, 0x0000000c, 0x33e70019, 0x00000010, 0x001f0000, 1238 0x93, 0x0e, 0xe9, 0x4b, 0xc7, 0xdc, 0xfb, 0xe2, 0x9f, 0xc4, 0x31, 0x7e,
2171 0x00000000, 0x031e0000, 0x00000000, 0x0760fe00, 0x0000000f, 0x0f0e0007, 1239 0x85, 0xe3, 0x78, 0xf7, 0xff, 0x2c, 0x8e, 0x9d, 0x12, 0xc7, 0x22, 0xb9,
2172 0x00000000, 0x83850800, 0x00000000, 0x0a7d0000, 0x00000000, 0x0afe0000, 1240 0x57, 0x4d, 0xbf, 0xd9, 0x2e, 0x7d, 0x18, 0xf5, 0x8d, 0x7e, 0xbd, 0x4f,
2173 0x00000000, 0x0b7f0000, 0x00000000, 0x0d7a0000, 0x00000000, 0x0c000000, 1241 0x70, 0x1f, 0x78, 0xb5, 0x5b, 0x8f, 0xe7, 0x33, 0x7f, 0x4e, 0xf6, 0x95,
2174 0x00000000, 0x0bfc0000, 0x00000000, 0x0c970e00, 0x00000008, 0x0f800003, 1242 0xca, 0xbe, 0x7b, 0x26, 0xed, 0x3b, 0xc5, 0xf5, 0xee, 0xf1, 0xf1, 0xc9,
2175 0x0000000f, 0x47670010, 0x00000008, 0x070e0001, 0x0000000b, 0xc38000ff, 1243 0xef, 0x15, 0x9f, 0x9d, 0x59, 0x95, 0x02, 0xee, 0xa8, 0xe3, 0xb1, 0x29,
2176 0x00000002, 0x43870000, 0x00000001, 0x33e70e00, 0x0000000f, 0x038e0010, 1244 0xde, 0x37, 0x86, 0x1f, 0xf9, 0xb5, 0x36, 0x85, 0xba, 0x05, 0xfe, 0xb9,
2177 0x00000002, 0x33e70e00, 0x00000000, 0x28f30000, 0x00000010, 0x009f0000, 1245 0x9e, 0x7a, 0x4a, 0xe3, 0xfb, 0xc7, 0xa7, 0xef, 0x57, 0x8d, 0x3c, 0xc4,
2178 0x00000000, 0x02043600, 0x00000010, 0x91840a02, 0x00000002, 0x21421800, 1246 0x6d, 0x43, 0xb8, 0x84, 0xf9, 0x4e, 0xb7, 0xf3, 0x7d, 0xe7, 0xfa, 0xb7,
2179 0x00000008, 0x22000006, 0x00000000, 0x231b0000, 0x00000000, 0x23ff0000, 1247 0x9a, 0xfd, 0x3a, 0x2a, 0xfe, 0x55, 0x88, 0x7f, 0x7a, 0xb9, 0x96, 0xeb,
2180 0x00000000, 0x241b0000, 0x00000003, 0x8384a000, 0x0000000f, 0x65870010, 1248 0xbe, 0x75, 0xba, 0xdd, 0xeb, 0xdf, 0x9d, 0x97, 0xd1, 0xf7, 0x4f, 0xfb,
2181 0x00000009, 0x2607ffff, 0x00000000, 0x27110000, 0x00000000, 0x26900000, 1249 0x63, 0xd1, 0x9b, 0x32, 0xfa, 0x49, 0x5e, 0xb9, 0xf4, 0x7d, 0xd4, 0x4f,
2182 0x0000000c, 0x29000000, 0x00000018, 0x8000017e, 0x00000003, 0xf4683600, 1250 0x62, 0x7e, 0x72, 0x9f, 0x41, 0xfa, 0x5b, 0x34, 0x5e, 0x72, 0xdf, 0x70,
2183 0x00000000, 0x3a100000, 0x00000000, 0x3a910000, 0x00000003, 0xf66c2400, 1251 0x3e, 0x47, 0xac, 0xa3, 0x6c, 0x57, 0x5e, 0xf9, 0x71, 0x39, 0x23, 0x7c,
2184 0x00000010, 0x001f0000, 0x00000010, 0xb1923604, 0x00000008, 0x0f800004, 1252 0x53, 0xc5, 0x8d, 0xd6, 0x8b, 0x64, 0x7d, 0x2a, 0xbf, 0xc5, 0x4e, 0x37,
2185 0x00000000, 0x00000000, 0x00000010, 0x009f0000, 0x00000000, 0x3e170000, 1253 0x1f, 0x64, 0x1f, 0xf3, 0x35, 0x0b, 0x5f, 0x34, 0x34, 0x39, 0xfe, 0x18,
2186 0x00000000, 0x3e940000, 0x00000000, 0x3f150000, 0x00000000, 0x3f960000, 1254 0xe5, 0xab, 0x38, 0xaf, 0xf7, 0x6f, 0xcb, 0x11, 0x9f, 0x76, 0x9e, 0xf3,
2187 0x00000010, 0x001f0000, 0x00000000, 0x0f060000, 0x00000010, 0x20530000, 1255 0xf0, 0xfb, 0x80, 0x7d, 0xe9, 0x2b, 0x80, 0x23, 0xf1, 0xcd, 0x50, 0x4d,
2188 0x00000000, 0x22c53600, 0x00000018, 0x8000ffac, 0x00000010, 0x001f0000, 1256 0xce, 0x74, 0x78, 0xe1, 0xdd, 0x30, 0x9a, 0x33, 0x78, 0xdb, 0xec, 0xe7,
2189 0x00000000, 0x031e0000, 0x00000000, 0x83850800, 0x00000009, 0x076000ff, 1257 0x48, 0x27, 0xe9, 0x5f, 0x1d, 0xc0, 0x31, 0x2c, 0x38, 0x9e, 0x50, 0x7f,
2190 0x0000000f, 0x0f0e0007, 0x00000000, 0x0c000000, 0x00000000, 0x0a7d0000, 1258 0x9f, 0xf7, 0xc6, 0x0f, 0x6f, 0x5e, 0x8c, 0xff, 0x19, 0xcc, 0xe3, 0x87,
2191 0x00000000, 0x0afe0000, 0x00000000, 0x0b7f0000, 0x00000000, 0x0d7a0000, 1259 0xe5, 0x5d, 0xdd, 0x18, 0x03, 0xfd, 0x2e, 0x62, 0xec, 0x46, 0x5e, 0xdf,
2192 0x00000000, 0x0bfc0000, 0x00000000, 0x0c970e00, 0x00000008, 0x0f800003, 1260 0xc3, 0xe7, 0xb5, 0x4a, 0xf5, 0xf2, 0xbb, 0xc3, 0x52, 0x0d, 0x6b, 0xc9,
2193 0x0000000f, 0x47670010, 0x00000008, 0x070e0001, 0x0000000b, 0xc38000ff, 1261 0xee, 0x94, 0xae, 0x7f, 0xc8, 0x77, 0x27, 0xee, 0xbd, 0xb7, 0x75, 0x0d,
2194 0x00000002, 0x43870000, 0x00000001, 0x33e70e00, 0x0000000f, 0x038e0010, 1262 0x4c, 0xc4, 0x69, 0x58, 0x31, 0x33, 0xc1, 0x82, 0xde, 0xf8, 0xe2, 0x4b,
2195 0x00000002, 0x33e70e00, 0x00000000, 0x39840000, 0x00000003, 0xb9720800, 1263 0x5e, 0x7e, 0xaf, 0xbf, 0x18, 0xf3, 0x65, 0xf7, 0x91, 0x9c, 0x88, 0xda,
2196 0x00000000, 0x28f30000, 0x0000000f, 0x65680010, 0x00000010, 0x009f0000, 1264 0x8b, 0xba, 0xfb, 0xee, 0x1e, 0xd0, 0xb7, 0xd5, 0xbd, 0xd8, 0x3f, 0x73,
2197 0x00000000, 0x02043600, 0x00000010, 0x91840a02, 0x00000002, 0x21421800, 1265 0x3b, 0xd7, 0x51, 0xab, 0x4c, 0xf2, 0x2b, 0x0d, 0x5c, 0xd3, 0xa8, 0xc3,
2198 0x00000008, 0x22000007, 0x00000000, 0x231b0000, 0x00000000, 0x23ff0000, 1266 0x13, 0x13, 0xaa, 0x04, 0xf7, 0x9a, 0x79, 0x07, 0xab, 0x1a, 0xd1, 0x8b,
2199 0x00000000, 0x241b0000, 0x00000003, 0x8384a000, 0x0000000f, 0x65870010, 1267 0xfa, 0x68, 0x17, 0xde, 0xc1, 0x44, 0x8b, 0x83, 0x7d, 0x9f, 0x55, 0xe8,
2200 0x00000009, 0x2607ffff, 0x00000000, 0x27110000, 0x00000000, 0x26900000, 1268 0xaf, 0x08, 0x8f, 0xf7, 0x5d, 0x1c, 0xd3, 0xe1, 0x60, 0x5d, 0xf2, 0xfa,
2201 0x0000000c, 0x29000000, 0x00000018, 0x80000145, 0x00000003, 0xf4683600, 1269 0x15, 0x93, 0x73, 0xfd, 0xab, 0xfb, 0x6e, 0xee, 0xe1, 0x7e, 0x2a, 0x19,
2202 0x00000000, 0x3a100000, 0x00000000, 0x3a910000, 0x00000003, 0xf66c2400, 1270 0xac, 0xcb, 0x01, 0xf9, 0xfb, 0x24, 0x7e, 0x49, 0x89, 0x5f, 0x54, 0xc7,
2203 0x00000010, 0x001f0000, 0x00000010, 0xb1923604, 0x00000008, 0x0f800004, 1271 0x0f, 0xef, 0xed, 0x4f, 0x7d, 0xef, 0x7a, 0xaa, 0x1b, 0xde, 0xbc, 0xfb,
2204 0x00000000, 0x00000000, 0x00000010, 0x009f0000, 0x00000000, 0x3e170000, 1272 0xfc, 0x4f, 0x63, 0xd7, 0xf6, 0x98, 0xb7, 0x0e, 0x57, 0xbb, 0xe7, 0xae,
2205 0x00000000, 0x3e940000, 0x00000000, 0x3f150000, 0x00000000, 0x3f960000, 1273 0x43, 0xde, 0x8b, 0x5d, 0x87, 0x30, 0xce, 0x73, 0xbf, 0xbc, 0x38, 0xd3,
2206 0x00000010, 0x001f0000, 0x00000000, 0x0f060000, 0x00000010, 0x20530000, 1274 0x21, 0x79, 0x74, 0x57, 0x44, 0xf2, 0x41, 0xec, 0xfb, 0x22, 0x62, 0xee,
2207 0x00000000, 0x22c53600, 0x00000018, 0x8000ff73, 0x00000010, 0x0ce70005, 1275 0x1b, 0x8c, 0xbf, 0x92, 0xfb, 0xee, 0x97, 0x2a, 0xf4, 0xd9, 0x17, 0x87,
2208 0x00000008, 0x2c80000c, 0x00000008, 0x2d000070, 0x00000008, 0x2d800010, 1276 0xcc, 0xfb, 0xc4, 0xbc, 0x57, 0xb0, 0xbe, 0x3e, 0xae, 0x04, 0x67, 0xbe,
2209 0x00000000, 0x00000000, 0x00000010, 0x205f0000, 0x00000018, 0x8000011d, 1277 0xff, 0xb5, 0x3f, 0x9c, 0xaf, 0x99, 0x8e, 0x61, 0x1f, 0x5e, 0x2a, 0x16,
2210 0x00000000, 0x2c1e0000, 0x00000008, 0x2c8000b8, 0x00000008, 0x2d000010, 1278 0x78, 0xbf, 0xc4, 0xe5, 0xfb, 0x45, 0xbf, 0xe0, 0xe1, 0xf0, 0xf9, 0x29,
2211 0x00000008, 0x2d800048, 0x00000000, 0x00000000, 0x00000010, 0x91de0000, 1279 0xd5, 0xf6, 0x13, 0x4d, 0x65, 0x3a, 0x73, 0xb0, 0xa7, 0xd5, 0xed, 0x23,
2212 0x00000018, 0x8000fe5d, 0x0000000c, 0x29800001, 0x00000000, 0x2a000000, 1280 0xc1, 0x27, 0xd4, 0x79, 0x4b, 0xde, 0xc1, 0xf2, 0x5e, 0xd6, 0xef, 0x61,
2213 0x00000010, 0x001f0000, 0x00000000, 0x0f008000, 0x00000008, 0x0f800007, 1281 0xf4, 0x73, 0xad, 0x79, 0x8c, 0xc7, 0xd0, 0xb7, 0x39, 0xbf, 0xca, 0xbd,
2214 0x00000018, 0x80000006, 0x0000000c, 0x29800001, 0x00000000, 0x2a000000, 1282 0xb5, 0x75, 0x9b, 0xe9, 0x4b, 0xa7, 0xde, 0x67, 0xee, 0xb9, 0xb6, 0x6a,
2215 0x00000010, 0x001f0000, 0x0000000f, 0x0f470007, 0x00000008, 0x0f800008, 1283 0xd0, 0x16, 0xee, 0x5b, 0x1f, 0xb2, 0xf3, 0x92, 0x1f, 0x85, 0x77, 0x89,
2216 0x00000018, 0x80000119, 0x00000010, 0x20530000, 0x00000018, 0x8000fe4f, 1284 0xff, 0x3d, 0x62, 0xfa, 0x85, 0x73, 0xc5, 0xb8, 0x67, 0xf3, 0xbd, 0x34,
2217 0x0000000c, 0x29800001, 0x00000010, 0x91de0000, 0x00000000, 0x2fd50000, 1285 0xa1, 0xdf, 0x23, 0x09, 0x6f, 0x9e, 0x25, 0x32, 0x65, 0x82, 0xfb, 0xec,
2218 0x00000000, 0x2a000000, 0x00000009, 0x0261ffff, 0x0000000d, 0x70e10001, 1286 0x9b, 0x40, 0xf7, 0xdc, 0x84, 0xbe, 0xbc, 0xb5, 0x4b, 0x70, 0xb8, 0x91,
2219 0x00000018, 0x80000101, 0x00000000, 0x2c400000, 0x00000008, 0x2c8000c4, 1287 0x71, 0x5b, 0x3e, 0x9a, 0x0b, 0x7e, 0x67, 0x21, 0x5c, 0x7f, 0x73, 0xfb,
2220 0x00000008, 0x2d00001c, 0x00000008, 0x2d800001, 0x00000005, 0x70e10800, 1288 0xd1, 0x73, 0x6c, 0xd7, 0xbc, 0x81, 0x3c, 0xf3, 0xcd, 0x55, 0xb3, 0xf8,
2221 0x00000010, 0x91de0000, 0x00000018, 0x8000fe41, 0x0000000c, 0x29800001, 1289 0xfc, 0xa6, 0x9d, 0x51, 0xd8, 0x99, 0xe9, 0x17, 0xbf, 0xda, 0x6f, 0x01,
2222 0x00000010, 0x91de0000, 0x00000000, 0x2fd50000, 0x00000010, 0x001f0000, 1290 0xed, 0x92, 0x3a, 0x73, 0xd2, 0x7d, 0x97, 0xc3, 0x4e, 0x53, 0x4f, 0x26,
2223 0x00000000, 0x02700000, 0x00000000, 0x0d620000, 0x00000000, 0xbb630800, 1291 0xbf, 0x13, 0x30, 0x9e, 0x5b, 0xc7, 0x63, 0xd5, 0xbc, 0x95, 0xe4, 0x97,
2224 0x00000000, 0x2a000000, 0x00000000, 0x0f400000, 0x00000000, 0x2c400000, 1292 0x4c, 0x7a, 0xcf, 0x16, 0xe2, 0x6e, 0xf2, 0xc1, 0xe4, 0x8f, 0xf7, 0x1d,
2225 0x0000000c, 0x73e7001b, 0x00000010, 0x0ce7000e, 0x00000000, 0x286d0000, 1293 0x7b, 0x9b, 0xa7, 0x5e, 0xfa, 0xe3, 0xef, 0x70, 0xbe, 0x84, 0x65, 0x3d,
2226 0x0000000f, 0x65ed0010, 0x00000009, 0x266dffff, 0x00000018, 0x80000069, 1294 0x96, 0xe9, 0xef, 0xbb, 0x3c, 0x3e, 0x6f, 0x01, 0x9f, 0x8c, 0xd8, 0x6d,
2227 0x00000008, 0x02000004, 0x00000010, 0x91c40803, 0x00000018, 0x800000f6, 1295 0xb7, 0xf0, 0x3b, 0x74, 0x96, 0xda, 0x25, 0xf1, 0x39, 0x57, 0x2d, 0x75,
2228 0x00000010, 0x20530000, 0x00000018, 0x800000e5, 0x00000008, 0x2c8000b8, 1296 0x50, 0xec, 0xfb, 0x49, 0xfa, 0x1f, 0xc4, 0x31, 0x6e, 0x6f, 0xc9, 0x49,
2229 0x00000008, 0x2d000010, 0x00000008, 0x2d800048, 0x00000018, 0x80000005, 1297 0xdc, 0x24, 0x8f, 0x9e, 0x16, 0xbf, 0x7f, 0x84, 0xdf, 0xb6, 0xf1, 0xbb,
2230 0x00000008, 0x2c8000c4, 0x00000008, 0x2d00001c, 0x00000008, 0x2d800001, 1298 0xc5, 0xf5, 0xdb, 0xd4, 0x59, 0xaf, 0x9c, 0x99, 0x3a, 0x1f, 0xb8, 0x5e,
2231 0x00000000, 0x00000000, 0x00000010, 0x205f0000, 0x00000008, 0x2c800048, 1299 0xdb, 0x27, 0xf9, 0xdd, 0x53, 0x24, 0xe7, 0xa1, 0x42, 0xbe, 0x3b, 0x38,
2232 0x00000008, 0x2d000068, 0x00000008, 0x2d800104, 0x00000000, 0x00000000, 1300 0xe2, 0x4f, 0x89, 0x6a, 0x5a, 0xee, 0xdd, 0x57, 0x2c, 0xfb, 0x92, 0x7a,
2233 0x00000010, 0x91de0000, 0x00000000, 0x27f60000, 0x00000010, 0xb87a9e04, 1301 0x1f, 0xe6, 0x71, 0xfe, 0xec, 0x29, 0xf0, 0x34, 0xdf, 0x11, 0x8c, 0xdc,
2234 0x00000008, 0x2200000d, 0x00000018, 0x800000e2, 0x00000010, 0x20530000, 1302 0xe0, 0x39, 0xf2, 0xe2, 0xc7, 0x37, 0x13, 0xff, 0x50, 0x07, 0x74, 0x9c,
2235 0x00000018, 0x8000fe18, 0x0000000c, 0x29800001, 0x00000010, 0x91de0000, 1303 0x6a, 0xcd, 0xf7, 0x07, 0xcc, 0xe3, 0xfc, 0x26, 0xf7, 0xb7, 0xa1, 0xaf,
2236 0x00000000, 0x2fd50000, 0x00000010, 0x001f0000, 0x00000000, 0x02700000, 1304 0xdc, 0xdf, 0x76, 0x48, 0xfa, 0x08, 0xc1, 0xe5, 0x81, 0x21, 0xb2, 0x43,
2237 0x00000000, 0x0d620000, 0x00000000, 0xbb630800, 0x00000000, 0x2a000000, 1305 0xc7, 0xae, 0xd2, 0x7f, 0xfe, 0x61, 0x47, 0x54, 0xec, 0x28, 0xf7, 0xd8,
2238 0x00000010, 0x0e670011, 0x00000000, 0x286d0000, 0x0000000f, 0x65ed0010, 1306 0x11, 0xd0, 0x7b, 0x1d, 0xcd, 0xaf, 0x50, 0x5f, 0x73, 0x1e, 0x2e, 0x57,
2239 0x00000009, 0x266dffff, 0x00000004, 0xb8f1a000, 0x00000000, 0x0f400000, 1307 0xeb, 0x29, 0x47, 0xf4, 0xbd, 0xb0, 0xae, 0x88, 0xc6, 0xcb, 0xd4, 0xab,
2240 0x0000000c, 0x73e7001c, 0x00000018, 0x80000040, 0x00000008, 0x02000004, 1308 0xf0, 0xb7, 0x37, 0x59, 0x84, 0x3a, 0x96, 0xdc, 0x49, 0xf3, 0x35, 0xea,
2241 0x00000010, 0x91c40802, 0x00000018, 0x800000cd, 0x00000000, 0x2c1e0000, 1309 0xd5, 0x3e, 0x0e, 0xc4, 0x2b, 0xea, 0x18, 0xea, 0x73, 0xe3, 0x41, 0xb6,
2242 0x00000008, 0x2c8000b8, 0x00000008, 0x2d000010, 0x00000008, 0x2d800048, 1310 0x47, 0x1d, 0x1f, 0x34, 0xf5, 0x7a, 0xca, 0xef, 0x98, 0xbd, 0xeb, 0xa4,
2243 0x00000010, 0x20530000, 0x00000010, 0x91de0000, 0x00000018, 0x8000fdfe, 1311 0x5e, 0x9c, 0xc0, 0x77, 0x51, 0xfd, 0x5e, 0x23, 0xfe, 0xd9, 0xe6, 0x3d,
2244 0x0000000c, 0x29800001, 0x00000000, 0x03550000, 0x00000000, 0x06460000, 1312 0xb8, 0xfb, 0x98, 0xa1, 0x8b, 0x7c, 0xe3, 0xfd, 0x27, 0x96, 0x0a, 0xad,
2245 0x00000000, 0x03d60000, 0x00000000, 0x2a000000, 0x0000000f, 0x0f480007, 1313 0xf2, 0x8d, 0x07, 0xd6, 0x55, 0x09, 0xad, 0x36, 0xe3, 0xe9, 0xbe, 0x2b,
2246 0x00000010, 0xb18c0027, 0x0000000f, 0x47420008, 0x00000009, 0x070e000f, 1314 0x5e, 0x29, 0xf9, 0x62, 0xf7, 0x7b, 0xe2, 0xcf, 0x47, 0xe2, 0xcf, 0x59,
2247 0x00000008, 0x070e0008, 0x00000010, 0x001f0000, 0x00000008, 0x09000001, 1315 0xe0, 0x9f, 0xdc, 0x28, 0x78, 0x2c, 0x0a, 0xea, 0x17, 0xbb, 0xdc, 0x73,
2248 0x00000007, 0x09121c00, 0x00000003, 0xcbca9200, 0x00000000, 0x0b97a200, 1316 0x63, 0xd6, 0x11, 0x8f, 0x47, 0xd5, 0x5f, 0x3f, 0x97, 0x8f, 0x31, 0xd8,
2249 0x00000007, 0x4b171c00, 0x0000000f, 0x0a960003, 0x00000000, 0x0a959c00, 1317 0x17, 0x00, 0x00, 0x00 };
2250 0x00000000, 0x4a009a00, 0x00000008, 0x82120001, 0x00000001, 0x0c170800,
2251 0x00000000, 0x02180000, 0x00000000, 0x0c971800, 0x00000008, 0x0d00ffff,
2252 0x00000008, 0x0f800006, 0x0000000c, 0x29000000, 0x00000008, 0x22000001,
2253 0x00000000, 0x22c50c00, 0x00000010, 0x009f0000, 0x00000010, 0xb197320b,
2254 0x00000000, 0x231b0000, 0x00000000, 0x27110800, 0x00000000, 0x66900000,
2255 0x00000018, 0x800000a4, 0x00000000, 0x02180000, 0x00000010, 0x20530000,
2256 0x00000000, 0x22c53600, 0x00000010, 0x001f0000, 0x00000008, 0x0f800006,
2257 0x00000018, 0x8000fff5, 0x00000010, 0x91870002, 0x00000008, 0x2200000a,
2258 0x00000000, 0x231b0000, 0x00000000, 0x27110800, 0x00000000, 0x66900000,
2259 0x00000018, 0x80000098, 0x00000008, 0x0200000a, 0x00000010, 0x91c40804,
2260 0x00000010, 0x02c20003, 0x00000010, 0x001f0000, 0x00000008, 0x0f800008,
2261 0x00000010, 0x20530000, 0x00000018, 0x8000fdc9, 0x00000000, 0x06820000,
2262 0x00000010, 0x001f0000, 0x00000010, 0x0ce70028, 0x00000000, 0x03720000,
2263 0x00000000, 0xa8760c00, 0x00000000, 0x0cf60000, 0x00000010, 0xb8723224,
2264 0x00000000, 0x03440000, 0x00000008, 0x22000010, 0x00000000, 0x03ca0000,
2265 0x0000000f, 0x65680010, 0x00000000, 0x0bcf0000, 0x00000000, 0x27f20000,
2266 0x00000010, 0xb7ef3203, 0x0000000c, 0x21420004, 0x0000000c, 0x73e70019,
2267 0x00000000, 0x07520000, 0x00000000, 0x29000000, 0x00000018, 0x8000007e,
2268 0x00000004, 0xb9723200, 0x00000010, 0x20530000, 0x00000000, 0x22060000,
2269 0x0000000c, 0x61420004, 0x00000000, 0x25070000, 0x00000000, 0x27970000,
2270 0x00000000, 0x290e0000, 0x00000010, 0x0ce70010, 0x00000010, 0xb873320f,
2271 0x0000000f, 0x436c0010, 0x00000000, 0x03f30c00, 0x00000000, 0x03f30000,
2272 0x00000000, 0x83990e00, 0x00000001, 0x83860e00, 0x00000000, 0x83060e00,
2273 0x00000003, 0xf66c0c00, 0x00000000, 0x39f30e00, 0x00000000, 0x3af50e00,
2274 0x00000000, 0x7a740000, 0x0000000f, 0x43680010, 0x00000001, 0x83860e00,
2275 0x00000000, 0x83060e00, 0x00000003, 0xf4680c00, 0x00000000, 0x286d0000,
2276 0x00000000, 0x03690000, 0x00000010, 0xb1f60c54, 0x00000000, 0x0a6a0000,
2277 0x00000000, 0x0aeb0000, 0x00000009, 0x0b6cffff, 0x00000000, 0x0c000000,
2278 0x00000000, 0x0be90000, 0x00000003, 0x8cf6a000, 0x0000000c, 0x09800002,
2279 0x00000010, 0x009f0000, 0x00000010, 0xb8173209, 0x00000000, 0x35140000,
2280 0x00000000, 0x35950000, 0x00000005, 0x766c2c00, 0x00000000, 0x34970000,
2281 0x00000004, 0xb8f12e00, 0x00000010, 0x001f0000, 0x00000008, 0x0f800004,
2282 0x00000018, 0x8000fff7, 0x00000000, 0x03e90000, 0x00000010, 0xb8f6a01a,
2283 0x00000010, 0x20130019, 0x00000010, 0xb1f10e18, 0x00000000, 0x83973200,
2284 0x00000000, 0x38700e00, 0x00000000, 0xbb760e00, 0x00000000, 0x37d00000,
2285 0x0000000c, 0x73e7001a, 0x00000003, 0xb8f1a000, 0x00000000, 0x32140000,
2286 0x00000000, 0x32950000, 0x00000005, 0x73e72c00, 0x00000000, 0x33190000,
2287 0x00000005, 0x74680000, 0x00000010, 0x0ce7000d, 0x00000008, 0x22000009,
2288 0x00000000, 0x07520000, 0x00000000, 0x29000000, 0x0000000c, 0x73e70019,
2289 0x0000000f, 0x65680010, 0x0000000c, 0x21420004, 0x00000018, 0x8000003c,
2290 0x00000010, 0x20530000, 0x0000000c, 0x61420004, 0x00000000, 0x290e0000,
2291 0x00000018, 0x80000002, 0x00000010, 0x91973206, 0x00000000, 0x35140000,
2292 0x00000000, 0x35950000, 0x00000005, 0x766c2c00, 0x00000000, 0x34990000,
2293 0x00000004, 0xb8f13200, 0x00000000, 0x83690c00, 0x00000010, 0xb1860013,
2294 0x00000000, 0x28e90000, 0x00000008, 0x22000004, 0x00000000, 0x23ec0000,
2295 0x00000000, 0x03690000, 0x00000010, 0xb8660c07, 0x00000009, 0x036cffff,
2296 0x00000000, 0x326a0000, 0x00000000, 0x32eb0000, 0x00000005, 0x73e70c00,
2297 0x00000000, 0x33690000, 0x00000005, 0x74680000, 0x0000000c, 0x73e7001c,
2298 0x00000000, 0x03690000, 0x00000010, 0xb1f60c12, 0x00000010, 0xb1d00c11,
2299 0x0000000c, 0x21420005, 0x0000000c, 0x33e7001c, 0x00000018, 0x8000000e,
2300 0x00000010, 0x2e67000d, 0x00000000, 0x03690000, 0x00000010, 0xb1f60c0b,
2301 0x00000010, 0xb1d00c0a, 0x00000000, 0x03440000, 0x00000008, 0x2200000c,
2302 0x00000000, 0x07520000, 0x00000000, 0x29000000, 0x00000018, 0x80000015,
2303 0x0000000c, 0x33e7001c, 0x00000010, 0x20530000, 0x00000000, 0x22060000,
2304 0x00000000, 0x290e0000, 0x00000018, 0x000d0000, 0x00000000, 0x06820000,
2305 0x00000010, 0x2de7000d, 0x00000010, 0x0ce7000c, 0x00000000, 0x27f20000,
2306 0x00000010, 0xb96d9e0a, 0x00000000, 0xa86d9e00, 0x00000009, 0x0361ffff,
2307 0x00000010, 0xb7500c07, 0x00000008, 0x2200000f, 0x0000000f, 0x65680010,
2308 0x00000000, 0x29000000, 0x00000018, 0x80000004, 0x0000000c, 0x33e7001b,
2309 0x00000010, 0x20530000, 0x00000018, 0x000d0000, 0x00000000, 0x2b820000,
2310 0x00000010, 0x20d2002f, 0x00000010, 0x0052002e, 0x00000009, 0x054e0007,
2311 0x00000010, 0xb18a002c, 0x00000000, 0x050a8c00, 0x00000008, 0x850a0008,
2312 0x00000010, 0x918a0029, 0x00000003, 0xc5008800, 0x00000008, 0xa3460001,
2313 0x00000010, 0xb1c60007, 0x00000008, 0x22000001, 0x0000000c, 0x29800000,
2314 0x00000010, 0x20530000, 0x00000000, 0x274e8c00, 0x00000000, 0x66cd0000,
2315 0x00000000, 0x22c58c00, 0x00000008, 0x22000014, 0x00000003, 0x22c58e00,
2316 0x00000003, 0x23c58e00, 0x00000003, 0x22c58e00, 0x00000003, 0x26cd9e00,
2317 0x00000003, 0x27cd9e00, 0x00000003, 0x26cd9e00, 0x00000003, 0x274ea000,
2318 0x00000003, 0x284ea000, 0x00000003, 0x274ea000, 0x0000000c, 0x69520000,
2319 0x0000000c, 0x29800000, 0x00000010, 0x20530000, 0x00000003, 0x22c58e00,
2320 0x00000003, 0x23c58e00, 0x00000003, 0x22c58e00, 0x00000003, 0x26cd9e00,
2321 0x00000003, 0x27cd9e00, 0x00000003, 0x26cd9e00, 0x00000003, 0x274ea000,
2322 0x00000003, 0x284ea000, 0x00000003, 0x274ea000, 0x00000000, 0xa2c58c00,
2323 0x00000000, 0xa74e8c00, 0x00000000, 0xe6cd0000, 0x0000000f, 0x620a0010,
2324 0x00000008, 0x23460001, 0x0000000c, 0x29800000, 0x00000010, 0x20530000,
2325 0x0000000c, 0x29520000, 0x00000018, 0x80000002, 0x0000000c, 0x29800000,
2326 0x00000018, 0x00570000 };
2327 1318
2328static const int bnx2_TPAT_b06FwReleaseMajor = 0x1; 1319static const int bnx2_TPAT_b06FwReleaseMajor = 0x1;
2329static const int bnx2_TPAT_b06FwReleaseMinor = 0x0; 1320static const int bnx2_TPAT_b06FwReleaseMinor = 0x0;
@@ -2339,201 +1330,199 @@ static const u32 bnx2_TPAT_b06FwBssAddr = 0x08001aa0;
2339static const int bnx2_TPAT_b06FwBssLen = 0x250; 1330static const int bnx2_TPAT_b06FwBssLen = 0x250;
2340static const u32 bnx2_TPAT_b06FwSbssAddr = 0x08001a60; 1331static const u32 bnx2_TPAT_b06FwSbssAddr = 0x08001a60;
2341static const int bnx2_TPAT_b06FwSbssLen = 0x34; 1332static const int bnx2_TPAT_b06FwSbssLen = 0x34;
2342static u32 bnx2_TPAT_b06FwText[(0x122c/4) + 1] = { 1333static u8 bnx2_TPAT_b06FwText[] = {
2343 0x0a000218, 0x00000000, 0x00000000, 0x0000000d, 0x74706174, 0x20322e35, 1334 0x1f, 0x8b, 0x08, 0x08, 0x47, 0xd2, 0x41, 0x44, 0x00, 0x03, 0x74, 0x65,
2344 0x2e313100, 0x02050b01, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1335 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xc5, 0x57, 0x4d, 0x68,
2345 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1336 0x1c, 0xe7, 0x19, 0x7e, 0xe7, 0x77, 0x47, 0x62, 0x25, 0x8d, 0x93, 0x3d,
2346 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1337 0xac, 0x5d, 0xa5, 0x99, 0x91, 0x46, 0x3f, 0x54, 0x26, 0x9e, 0x84, 0xa5,
2347 0x00000000, 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, 0x3c020800, 1338 0x56, 0x61, 0x20, 0xe3, 0x99, 0x95, 0x2c, 0x0c, 0x05, 0x07, 0x42, 0x08,
2348 0x24421a60, 0x3c030800, 0x24631cf0, 0xac400000, 0x0043202b, 0x1480fffd, 1339 0xe4, 0xb2, 0x1d, 0x49, 0x36, 0x85, 0x1e, 0x5a, 0x9a, 0x43, 0xa0, 0x05,
2349 0x24420004, 0x3c1d0800, 0x37bd2ffc, 0x03a0f021, 0x3c100800, 0x26100860, 1340 0x0f, 0x33, 0xeb, 0x34, 0x87, 0xc5, 0xdb, 0xaa, 0xc5, 0xbe, 0x94, 0xd6,
2350 0x3c1c0800, 0x279c1a60, 0x0e000546, 0x00000000, 0x0000000d, 0x8f820010, 1341 0x95, 0xea, 0xe8, 0xb2, 0x68, 0xe2, 0x53, 0x0f, 0xc5, 0xd8, 0xb4, 0x54,
2351 0x8c450008, 0x24030800, 0xaf430178, 0x97430104, 0x3c020008, 0xaf420140, 1342 0xd0, 0x53, 0x7b, 0x0a, 0x85, 0x5c, 0x4c, 0x69, 0x20, 0x85, 0x12, 0x44,
2352 0x8f820024, 0x30420001, 0x10400007, 0x3069ffff, 0x24020002, 0x2523fffe, 1343 0x0f, 0x21, 0xd4, 0xad, 0xa7, 0xcf, 0xfb, 0xcd, 0x8c, 0xbc, 0xbb, 0x95,
2353 0xa7420146, 0xa7430148, 0x0a000242, 0x3c020800, 0xa7400146, 0x3c020800, 1344 0x5b, 0x1f, 0x02, 0x15, 0xac, 0x66, 0xe6, 0xfb, 0xde, 0xf7, 0xfb, 0x79,
2354 0x8c43083c, 0x1460000e, 0x24020f00, 0x8f820024, 0x30430020, 0x0003182b, 1345 0x9f, 0xe7, 0x79, 0xbf, 0xf7, 0x6b, 0xca, 0x34, 0x49, 0xe5, 0xdf, 0x14,
2355 0x00031823, 0x30650009, 0x30420c00, 0x24030400, 0x14430002, 0x34a40001, 1346 0x7e, 0x6f, 0x7f, 0xe3, 0xdb, 0x6f, 0x7f, 0xf5, 0xa5, 0x57, 0x2c, 0xa2,
2356 0x34a40005, 0xa744014a, 0x0a000264, 0x3c020800, 0x8f830014, 0x14620008, 1347 0x57, 0x5e, 0x92, 0x64, 0x5d, 0xa6, 0x2f, 0xe0, 0x4f, 0x21, 0x32, 0xab,
2357 0x00000000, 0x8f820024, 0x30420020, 0x0002102b, 0x00021023, 0x3042000d, 1348 0xf1, 0xf9, 0x47, 0x86, 0xec, 0x75, 0xce, 0x04, 0x0e, 0x19, 0x8a, 0x77,
2358 0x0a000262, 0x34420005, 0x8f820024, 0x30420020, 0x0002102b, 0x00021023, 1349 0x34, 0xbb, 0xe9, 0x10, 0xf9, 0x83, 0x15, 0x2b, 0xa4, 0x7f, 0xe5, 0x71,
2359 0x30420009, 0x34420001, 0xa742014a, 0x3c020800, 0x8c430820, 0x8f840024, 1350 0x43, 0x25, 0x6e, 0x7f, 0xc1, 0xfb, 0xe7, 0xb9, 0x7b, 0xe7, 0xed, 0xa3,
2360 0x3c020048, 0x00621825, 0x30840006, 0x24020002, 0x1082000d, 0x2c820003, 1351 0xdb, 0x0a, 0x19, 0xa6, 0xd7, 0x31, 0xcc, 0x45, 0x32, 0x66, 0xe1, 0xf3,
2361 0x50400005, 0x24020004, 0x10800012, 0x3c020001, 0x0a000284, 0x00000000, 1352 0xd3, 0xa5, 0x75, 0x8d, 0xa6, 0xab, 0xb1, 0x4c, 0x4a, 0xfa, 0x06, 0xad,
2362 0x10820007, 0x24020006, 0x1482000f, 0x3c020111, 0x0a00027c, 0x00621025, 1353 0xf5, 0x30, 0x8e, 0xf3, 0x8e, 0x14, 0x66, 0xaa, 0x14, 0xde, 0x32, 0x48,
2363 0x0a00027b, 0x3c020101, 0x3c020011, 0x00621025, 0x24030001, 0xaf421000, 1354 0xf6, 0x7c, 0x29, 0xc8, 0x1c, 0xf4, 0x49, 0x14, 0xb8, 0x35, 0xf2, 0xcd,
2364 0xaf830020, 0x0a000284, 0x00000000, 0x00621025, 0xaf421000, 0xaf800020, 1355 0x3c, 0xff, 0xa6, 0x2b, 0x93, 0xec, 0x3c, 0xce, 0xe7, 0x17, 0xd6, 0xa5,
2365 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8f830020, 0x1060003f, 1356 0x60, 0x7f, 0x43, 0x0a, 0xf7, 0x03, 0xde, 0x37, 0xd6, 0xb1, 0x2e, 0xf9,
2366 0x3c048000, 0x8f421000, 0x00441024, 0x1040fffd, 0x00000000, 0x10600039, 1357 0xfb, 0xfc, 0xf4, 0x8c, 0xb0, 0x37, 0x4d, 0x9d, 0x06, 0xcd, 0xc8, 0x0e,
2367 0x00000000, 0x8f421000, 0x3c030020, 0x00431024, 0x10400034, 0x00000000, 1358 0xfb, 0x5a, 0x14, 0xba, 0x2b, 0x4d, 0x85, 0xe6, 0xf1, 0x9b, 0xa0, 0x6d,
2368 0x97421014, 0x14400031, 0x00000000, 0x97421008, 0x8f840010, 0x24420006, 1359 0x97, 0xea, 0x81, 0x4b, 0xaa, 0xe2, 0xc8, 0x14, 0x36, 0x24, 0xfa, 0x65,
2369 0x00024082, 0x00081880, 0x00643821, 0x8ce50000, 0x30430003, 0x30420001, 1360 0x4b, 0xc3, 0xef, 0x92, 0xd4, 0xde, 0xdf, 0x2a, 0xc7, 0x69, 0x50, 0x8a,
2370 0x10400004, 0x00000000, 0x0000000d, 0x0a0002c3, 0x00081080, 0x5460000f, 1361 0xb5, 0x44, 0x0d, 0x5e, 0x5b, 0xe1, 0x1f, 0xb8, 0x2b, 0xa6, 0x4c, 0xf3,
2371 0x30a5ffff, 0x3c06ffff, 0x00a62824, 0x0005182b, 0x00a61026, 0x0002102b, 1362 0xf8, 0x4d, 0xe1, 0x3d, 0x82, 0x9d, 0x46, 0x41, 0x6b, 0xbc, 0x6f, 0x02,
2372 0x00621824, 0x10600004, 0x00000000, 0x0000000d, 0x00000000, 0x240001fb, 1363 0xef, 0x58, 0x27, 0xc6, 0x0a, 0xc4, 0x3a, 0x2c, 0xac, 0xc3, 0xa1, 0x6e,
2373 0x8ce20000, 0x0a0002c2, 0x00462825, 0x0005182b, 0x38a2ffff, 0x0002102b, 1364 0x7f, 0x03, 0xfb, 0x58, 0x68, 0x46, 0xa4, 0x53, 0x57, 0xac, 0x7d, 0x8a,
2374 0x00621824, 0x10600004, 0x00000000, 0x0000000d, 0x00000000, 0x24000205, 1365 0x12, 0x53, 0xa1, 0xe4, 0xac, 0x46, 0xfe, 0x65, 0x15, 0xdf, 0xcf, 0x51,
2375 0x8ce20000, 0x3445ffff, 0x00081080, 0x00441021, 0x3c030800, 0xac450000, 1366 0x6c, 0x4a, 0xb0, 0xe9, 0x96, 0xf8, 0xd5, 0xd0, 0xaf, 0xa3, 0x7d, 0x86,
2376 0x8c620830, 0x24420001, 0xac620830, 0x8f840018, 0x01202821, 0x24820008, 1367 0x92, 0xc6, 0x29, 0x49, 0xf6, 0xbe, 0x8f, 0xf6, 0x05, 0x33, 0xa2, 0xef,
2377 0x30421fff, 0x24434000, 0x0343d821, 0x30a30007, 0xaf84000c, 0xaf820018, 1368 0xe1, 0x29, 0xe1, 0xfb, 0x14, 0x8f, 0x87, 0x6f, 0x89, 0x14, 0x87, 0xcc,
2378 0xaf420084, 0x10600002, 0x24a20007, 0x3045fff8, 0x8f820030, 0x8f840000, 1369 0x20, 0xb3, 0x28, 0xcd, 0x2a, 0x5f, 0x6e, 0x2f, 0xda, 0xe2, 0x6c, 0x1c,
2379 0x00451821, 0xaf82001c, 0x0064102b, 0xaf830030, 0x14400002, 0x00641023, 1370 0x3b, 0xd8, 0xf5, 0x5f, 0xa5, 0x8e, 0x49, 0xb1, 0xea, 0xc1, 0xa6, 0xef,
2380 0xaf820030, 0x8f840030, 0x34028000, 0x00821021, 0x03421821, 0x3c021000, 1371 0x98, 0x6d, 0xe0, 0xe4, 0x0b, 0x3c, 0xbf, 0xc6, 0xed, 0xfc, 0x87, 0x76,
2381 0xaf830010, 0xaf440080, 0x03e00008, 0xaf420178, 0x8f830024, 0x27bdffe0, 1372 0x8b, 0x14, 0xcf, 0x31, 0x43, 0x6a, 0x51, 0xd1, 0xd7, 0x30, 0x83, 0x5b,
2382 0xafbf0018, 0xafb10014, 0x30620200, 0x14400004, 0xafb00010, 0x0000000d, 1373 0x2f, 0x93, 0x2f, 0xe2, 0x61, 0xe0, 0xdd, 0xc4, 0x9e, 0x74, 0x60, 0x9b,
2383 0x00000000, 0x24000242, 0x00031a82, 0x30630003, 0x000310c0, 0x00431021, 1374 0xf8, 0x32, 0xc5, 0x4d, 0x83, 0xec, 0xd5, 0x2d, 0xf4, 0x7c, 0xdc, 0x53,
2384 0x00021080, 0x00431021, 0x00021080, 0x3c030800, 0x24631aa0, 0x00438821, 1375 0x10, 0x67, 0xc6, 0x49, 0x2d, 0xfd, 0x18, 0xd7, 0xdf, 0x62, 0x5d, 0xb1,
2385 0x8e240000, 0x10800004, 0x00000000, 0x0000000d, 0x00000000, 0x2400024d, 1376 0x69, 0xd0, 0x0c, 0x75, 0x5e, 0xcf, 0xf3, 0x3b, 0x6e, 0x9e, 0xeb, 0x9e,
2386 0x8f850010, 0x24020001, 0xae220000, 0x8ca70008, 0xa2200007, 0x8f620004, 1377 0xb3, 0xfc, 0x3e, 0xad, 0x34, 0x35, 0x5a, 0x34, 0xf1, 0x44, 0xdc, 0x1c,
2387 0x26300014, 0x02002021, 0x00021402, 0xa2220004, 0x304600ff, 0x24c60005, 1378 0xc4, 0x46, 0x2d, 0xe7, 0x9f, 0x2a, 0xd7, 0xfa, 0x48, 0x42, 0xe8, 0xe9,
2388 0x0e000673, 0x00063082, 0x8f620004, 0xa6220008, 0x8f430108, 0x3c021000, 1379 0xcf, 0xbd, 0xdf, 0xf0, 0xde, 0x97, 0xd7, 0x85, 0x7d, 0x9e, 0xef, 0xae,
2389 0x00621824, 0x10600008, 0x00000000, 0x97420104, 0x92230007, 0x2442ffec, 1380 0x3e, 0xcd, 0x5e, 0x93, 0x0b, 0xfb, 0x3c, 0x5f, 0x6b, 0xf1, 0x7c, 0x36,
2390 0x3045ffff, 0x34630002, 0x0a000321, 0xa2230007, 0x97420104, 0x2442fff0, 1381 0xf6, 0xc6, 0x9c, 0x24, 0x5a, 0x1b, 0xb8, 0x46, 0xd4, 0xc3, 0xba, 0x1c,
2391 0x3045ffff, 0x8f620004, 0x3042ffff, 0x2c420013, 0x54400005, 0x92230007, 1382 0x3c, 0x07, 0x4d, 0xac, 0xdd, 0x5e, 0xb6, 0x24, 0x83, 0x12, 0x27, 0x7f,
2392 0x92220007, 0x34420001, 0xa2220007, 0x92230007, 0x24020001, 0x10620009, 1383 0x11, 0x3c, 0xf0, 0x43, 0xc7, 0xfe, 0x53, 0xa8, 0xd4, 0x68, 0xcf, 0xad,
2393 0x28620002, 0x14400014, 0x24020002, 0x10620012, 0x24020003, 0x1062000a, 1384 0x53, 0x37, 0x6b, 0x52, 0x92, 0x75, 0x29, 0xc8, 0x64, 0x8c, 0x5f, 0xa3,
2394 0x00000000, 0x0a000342, 0x00000000, 0x8f820010, 0x8c43000c, 0x3c04ffff, 1385 0x5d, 0xe7, 0xf3, 0x7c, 0xcd, 0x75, 0x81, 0x33, 0xb1, 0x5f, 0x73, 0x8d,
2395 0x00641824, 0x00651825, 0x0a000342, 0xac43000c, 0x8f820010, 0x8c430010, 1386 0x66, 0xd1, 0xbf, 0x62, 0x6e, 0x91, 0x8b, 0x98, 0xcb, 0x88, 0xc9, 0xbc,
2396 0x3c04ffff, 0x00641824, 0x00651825, 0xac430010, 0x8f620004, 0x3042ffff, 1387 0x78, 0x4f, 0x32, 0x17, 0xfd, 0x14, 0xcb, 0x2d, 0xdb, 0x4c, 0xc8, 0x6e,
2397 0x24420002, 0x00021083, 0xa2220005, 0x304500ff, 0x8f820010, 0x3c04ffff, 1388 0x06, 0x0a, 0x99, 0xb2, 0x67, 0xc2, 0x26, 0xa6, 0x76, 0x66, 0xd0, 0x43,
2398 0x00052880, 0x00a22821, 0x8ca70000, 0x96220008, 0x97430104, 0x00e42024, 1389 0xe5, 0x1d, 0xc1, 0xe3, 0xb4, 0xff, 0x30, 0xbf, 0xb7, 0xd4, 0xa4, 0xfb,
2399 0x24420002, 0x00621823, 0x00833825, 0xaca70000, 0x92240005, 0x00041080, 1390 0x59, 0x83, 0xee, 0x66, 0x24, 0x47, 0x1c, 0xab, 0x86, 0x49, 0x1f, 0x64,
2400 0x02021021, 0x90430000, 0x3c05fff6, 0x34a5ffff, 0x3063000f, 0x00832021, 1391 0xd5, 0x3e, 0xc0, 0x65, 0x27, 0x39, 0xa3, 0x40, 0x67, 0x9b, 0xee, 0x03,
2401 0xa2240006, 0x308200ff, 0x24420003, 0x00021080, 0x02021021, 0x8c460000, 1392 0xb0, 0xc4, 0x06, 0x0e, 0x31, 0xf6, 0x5c, 0x3d, 0x79, 0x4f, 0xb7, 0xcf,
2402 0x308300ff, 0x8f820010, 0x3c04ff3f, 0x00031880, 0x00c53824, 0x00621821, 1393 0x6c, 0x3a, 0xf6, 0x7b, 0x21, 0xb3, 0xf3, 0x86, 0x8a, 0xd6, 0xe1, 0x38,
2403 0xae26000c, 0xac67000c, 0x8e22000c, 0x92230006, 0x3484ffff, 0x00441024, 1394 0x7c, 0x1d, 0xfe, 0x26, 0x5d, 0x87, 0x5e, 0x64, 0xc4, 0x63, 0xee, 0xc0,
2404 0x24630003, 0x00031880, 0x02031821, 0x00e42024, 0xae22000c, 0xac640000, 1395 0xa0, 0xfd, 0x5e, 0x8d, 0xac, 0x5d, 0x95, 0xa2, 0x7e, 0x83, 0xdc, 0x45,
2405 0x92220006, 0x24420004, 0x00021080, 0x02021021, 0x94470002, 0xac470000, 1396 0xdb, 0x22, 0x59, 0x6e, 0xc8, 0x88, 0xdf, 0xdc, 0x6e, 0x4e, 0xeb, 0xae,
2406 0x92230006, 0x8f820010, 0x00031880, 0x00621821, 0x24020010, 0xac670010, 1397 0x46, 0x87, 0xce, 0x77, 0x75, 0x9a, 0x4e, 0x5c, 0x9d, 0xd8, 0xc6, 0xa0,
2407 0x24030002, 0xa7420140, 0xa7400142, 0xa7400144, 0xa7430146, 0x97420104, 1398 0xb9, 0xf7, 0x0d, 0x29, 0xec, 0xf3, 0xfa, 0x39, 0xce, 0x46, 0x19, 0x67,
2408 0x24030001, 0x2442fffe, 0xa7420148, 0xa743014a, 0x8f820024, 0x24030002, 1399 0x55, 0x0a, 0x6e, 0xd5, 0x68, 0x7e, 0xe7, 0x6f, 0x79, 0xe0, 0x20, 0xc6,
2409 0x30440006, 0x1083000d, 0x2c820003, 0x10400005, 0x24020004, 0x10800011, 1400 0xe0, 0xf1, 0x66, 0xcb, 0x56, 0x68, 0x12, 0x6d, 0xbb, 0xdc, 0x77, 0x54,
2410 0x3c020009, 0x0a0003a5, 0x00000000, 0x10820007, 0x24020006, 0x1482000d, 1401 0xb6, 0xf3, 0x18, 0x79, 0x1e, 0xb8, 0xcf, 0x53, 0xc0, 0xfc, 0x7e, 0x9d,
2411 0x3c020119, 0x0a00039f, 0x24030001, 0x0a00039e, 0x3c020109, 0x3c020019, 1402 0x7d, 0x6a, 0x34, 0xb7, 0xc3, 0xba, 0xc0, 0x73, 0x97, 0xbf, 0x79, 0x6d,
2412 0x24030001, 0xaf421000, 0xaf830020, 0x0a0003a5, 0x00000000, 0xaf421000, 1403 0x13, 0x14, 0x61, 0x37, 0xd1, 0x72, 0x03, 0xfb, 0x97, 0x85, 0x06, 0x22,
2413 0xaf800020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x92220004, 1404 0xec, 0x56, 0x76, 0x26, 0xf1, 0x14, 0x71, 0x50, 0x0a, 0x3e, 0x73, 0x5e,
2414 0x24030008, 0x8f840020, 0x24420002, 0x30420007, 0x00621823, 0x30630007, 1405 0xa8, 0x53, 0x08, 0x5c, 0x55, 0xac, 0x67, 0x8b, 0x16, 0x9a, 0xdb, 0xa2,
2415 0x10800006, 0xae230010, 0x3c038000, 0x8f421000, 0x00431024, 0x1040fffd, 1406 0x0f, 0x6d, 0x03, 0xee, 0x33, 0xc7, 0xfa, 0xf0, 0x3d, 0xa8, 0xd6, 0x20,
2416 0x00000000, 0x8f820018, 0xaf82000c, 0x24420010, 0x30421fff, 0xaf820018, 1407 0x03, 0xf3, 0x14, 0xb3, 0x68, 0x62, 0xaf, 0x6b, 0x2e, 0xdb, 0xb3, 0x6d,
2417 0xaf420084, 0x97430104, 0x24424000, 0x0342d821, 0x3063ffff, 0x30620007, 1408 0xbc, 0xac, 0x91, 0xbd, 0xbc, 0x8b, 0xd1, 0xf7, 0x7b, 0xd8, 0xef, 0x4d,
2418 0x10400002, 0x24620007, 0x3043fff8, 0x8f820030, 0x8f840000, 0x00431821, 1409 0xce, 0x35, 0x8e, 0xf5, 0x17, 0x62, 0xfb, 0x79, 0xec, 0x79, 0x61, 0x35,
2419 0xaf82001c, 0x0064102b, 0xaf830030, 0x14400002, 0x00641023, 0xaf820030, 1410 0xe5, 0xbe, 0x81, 0x46, 0xce, 0x4e, 0x6c, 0xaa, 0x88, 0xbd, 0x8c, 0xc0,
2420 0x8f840030, 0x34028000, 0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x00821021, 1411 0x87, 0x3f, 0xfc, 0x2c, 0xd7, 0x3c, 0x70, 0xb8, 0x35, 0x03, 0x6c, 0x6c,
2421 0x03421821, 0x3c021000, 0xaf830010, 0xaf440080, 0xaf420178, 0x03e00008, 1412 0x2b, 0x85, 0x9e, 0x1d, 0x8c, 0x9b, 0xb8, 0x0a, 0xfc, 0x0a, 0x8c, 0xd8,
2422 0x27bd0020, 0x8f830024, 0x27bdffe0, 0xafbf0018, 0xafb10014, 0x30620200, 1413 0x6e, 0xbd, 0x97, 0x53, 0x2a, 0xe6, 0xba, 0xc6, 0x73, 0x21, 0xe7, 0x38,
2423 0x14400004, 0xafb00010, 0x0000000d, 0x00000000, 0x240002e4, 0x00031a82, 1414 0xab, 0xbf, 0x03, 0x27, 0x22, 0xaa, 0xd3, 0xe2, 0x41, 0x9d, 0xae, 0x0e,
2424 0x30630003, 0x000310c0, 0x00431021, 0x00021080, 0x00431021, 0x00021080, 1415 0xea, 0x34, 0x77, 0x43, 0x47, 0x1c, 0xf2, 0xbc, 0xdb, 0x62, 0x0d, 0x02,
2425 0x3c030800, 0x24631aa0, 0x00438021, 0x8e040000, 0x14800004, 0x00000000, 1416 0x6b, 0x87, 0xed, 0xec, 0xa6, 0x22, 0xf3, 0x3a, 0xd0, 0x7f, 0x40, 0xb4,
2426 0x0000000d, 0x00000000, 0x240002e9, 0x8f620004, 0x04410008, 0x26050014, 1417 0x35, 0xd0, 0x11, 0x37, 0x75, 0x68, 0x6c, 0x99, 0x2e, 0xfe, 0x84, 0xe8,
2427 0x92020006, 0x8e03000c, 0x24420003, 0x00021080, 0x00a21021, 0xac430000, 1418 0xe2, 0x80, 0x7d, 0x79, 0xfc, 0xc2, 0x27, 0xc2, 0x9e, 0x65, 0x60, 0x7e,
2428 0xae000000, 0x92020005, 0x24420001, 0x00021080, 0x00a21021, 0x8c430000, 1419 0x75, 0x20, 0x23, 0x1f, 0x20, 0x5f, 0xee, 0x07, 0xc8, 0x83, 0x6d, 0xfc,
2429 0x3c040001, 0x00641821, 0xac430000, 0x92060004, 0x27710008, 0x02202021, 1420 0xd6, 0x91, 0x1b, 0x19, 0x1b, 0xce, 0x13, 0x8f, 0x81, 0xcf, 0x06, 0xfa,
2430 0x24c60005, 0x0e000673, 0x00063082, 0x92040006, 0x3c057fff, 0x8f620004, 1421 0x2e, 0xa1, 0x8d, 0xf3, 0x16, 0xdb, 0xea, 0xd4, 0x76, 0xa7, 0x28, 0xad,
2431 0x00042080, 0x00912021, 0x8c830004, 0x34a5ffff, 0x00451024, 0x00621821, 1422 0x72, 0x91, 0xc9, 0xb9, 0xe8, 0x14, 0xf8, 0x34, 0x81, 0xfc, 0x72, 0x47,
2432 0xac830004, 0x92050005, 0x3c07ffff, 0x92040004, 0x00052880, 0x00b12821, 1423 0x19, 0xcd, 0x45, 0xc8, 0x59, 0x8d, 0xd3, 0xc8, 0x3d, 0x3f, 0x47, 0x3b,
2433 0x8ca30000, 0x97420104, 0x96060008, 0x00671824, 0x00441021, 0x00461023, 1424 0x8f, 0xf7, 0x33, 0x3c, 0x27, 0xf0, 0x7d, 0x1a, 0xb6, 0xc3, 0x79, 0xa8,
2434 0x3042ffff, 0x00621825, 0xaca30000, 0x92030007, 0x24020001, 0x1062000a, 1425 0xf2, 0x7b, 0x5a, 0x0e, 0x02, 0xef, 0x76, 0x0c, 0xd8, 0x5b, 0xd0, 0x0b,
2435 0x28620002, 0x1440001d, 0x2402000a, 0x24020002, 0x10620019, 0x24020003, 1426 0xc7, 0xbb, 0x86, 0x7c, 0xc1, 0x31, 0xaf, 0x21, 0xa6, 0x3a, 0xe6, 0x36,
2436 0x1062000e, 0x2402000a, 0x0a000447, 0x00000000, 0x92020004, 0x97430104, 1427 0x69, 0xfe, 0x80, 0x62, 0xa5, 0xcc, 0x4f, 0xe1, 0x71, 0x7e, 0x6a, 0x0a,
2437 0x8e24000c, 0x00621821, 0x2463fff2, 0x3063ffff, 0x00872024, 0x00832025, 1428 0x1e, 0x24, 0x99, 0x09, 0x1f, 0xd6, 0x6d, 0xa5, 0x53, 0xc6, 0x8e, 0xfc,
2438 0xae24000c, 0x0a000447, 0x2402000a, 0x92020004, 0x97430104, 0x8e240010, 1429 0x00, 0x1a, 0x0e, 0x94, 0x3c, 0xdf, 0xc4, 0x19, 0x11, 0x01, 0x77, 0x1f,
2439 0x00621821, 0x2463ffee, 0x3063ffff, 0x00872024, 0x00832025, 0xae240010, 1430 0xda, 0x8d, 0xa0, 0xdd, 0x70, 0x48, 0xbb, 0xe1, 0xff, 0xd4, 0x2e, 0x74,
2440 0x2402000a, 0xa7420140, 0x96030012, 0x8f840024, 0xa7430142, 0x92020004, 1431 0x09, 0x8d, 0xdc, 0x05, 0xa7, 0x3e, 0xe8, 0x9f, 0xa4, 0x63, 0xd6, 0x30,
2441 0xa7420144, 0xa7400146, 0x97430104, 0x30840006, 0x24020001, 0xa7430148, 1432 0x6b, 0xd9, 0xa2, 0x7b, 0x4b, 0xcf, 0xa2, 0xe5, 0xbf, 0x3e, 0xab, 0x96,
2442 0xa742014a, 0x24020002, 0x1082000d, 0x2c820003, 0x10400005, 0x24020004, 1433 0x63, 0xd6, 0xb2, 0xca, 0x5a, 0x6e, 0x0c, 0x6b, 0xf9, 0x53, 0xf8, 0x17,
2443 0x10800011, 0x3c020041, 0x0a00046c, 0x00000000, 0x10820007, 0x24020006, 1434 0x9a, 0xbc, 0xa0, 0x36, 0x48, 0x5b, 0x04, 0x0e, 0x3b, 0x75, 0x52, 0x6e,
2444 0x1482000d, 0x3c020151, 0x0a000466, 0x24030001, 0x0a000465, 0x3c020141, 1435 0x3c, 0xe1, 0x1b, 0x73, 0x38, 0x1c, 0xe0, 0xdf, 0x81, 0x86, 0x3e, 0x69,
2445 0x3c020051, 0x24030001, 0xaf421000, 0xaf830020, 0x0a00046c, 0x00000000, 1436 0xb4, 0x1d, 0x39, 0x4f, 0xf5, 0xec, 0xe6, 0x96, 0xb0, 0x51, 0x49, 0x47,
2446 0xaf421000, 0xaf800020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1437 0xdc, 0xbf, 0xb3, 0x64, 0x5b, 0x96, 0x3c, 0xac, 0x79, 0xa8, 0x7e, 0x27,
2447 0x8f820020, 0x8f840018, 0x10400006, 0x92030004, 0x3c058000, 0x8f421000, 1438 0xbf, 0xa6, 0x79, 0x3c, 0x4f, 0x6c, 0x81, 0xeb, 0xd6, 0x8f, 0x80, 0x51,
2448 0x00451024, 0x1040fffd, 0x00000000, 0x2463000a, 0x30620007, 0x10400002, 1439 0xda, 0x63, 0x9e, 0x3b, 0xe6, 0x9a, 0xe0, 0x17, 0xbe, 0xa1, 0x05, 0x0d,
2449 0x24620007, 0x304303f8, 0x00831021, 0x30421fff, 0xaf84000c, 0xaf820018, 1440 0x7c, 0xad, 0xc1, 0x4e, 0xdd, 0x29, 0xf4, 0x73, 0x17, 0xe3, 0xee, 0xf5,
2450 0xaf420084, 0x97430104, 0x24424000, 0x0342d821, 0x3063ffff, 0x30620007, 1441 0x98, 0x5f, 0x06, 0xe9, 0x37, 0x9d, 0xe6, 0x55, 0x91, 0x73, 0xe7, 0xcd,
2451 0x10400002, 0x24620007, 0x3043fff8, 0x8f820030, 0x8f840000, 0x00431821, 1442 0x75, 0x62, 0xed, 0xf1, 0x79, 0x87, 0xfe, 0x41, 0x8d, 0x14, 0xa1, 0xf7,
2452 0xaf82001c, 0x0064102b, 0xaf830030, 0x14400002, 0x00641023, 0xaf820030, 1443 0xc9, 0x52, 0xef, 0x2f, 0x20, 0x46, 0x93, 0xf8, 0x66, 0xcd, 0x9f, 0x2e,
2453 0x8f840030, 0x34028000, 0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x00821021, 1444 0x35, 0x3f, 0x8d, 0x27, 0xb7, 0x5d, 0x54, 0x0b, 0xee, 0x80, 0x87, 0x3b,
2454 0x03421821, 0x3c021000, 0xaf830010, 0xaf440080, 0xaf420178, 0x03e00008, 1445 0x8c, 0x6b, 0x1d, 0xf9, 0x8d, 0xe7, 0xff, 0x7b, 0xbe, 0xe9, 0x30, 0xb6,
2455 0x27bd0020, 0x8f620000, 0x97430104, 0x3c048000, 0x3045ffff, 0x3066ffff, 1446 0x8e, 0xf5, 0x03, 0x5a, 0x80, 0xee, 0xd0, 0x7e, 0xc0, 0xb6, 0xec, 0x53,
2456 0x8f420178, 0x00441024, 0x1440fffd, 0x2402000a, 0x30a30007, 0xa7420140, 1447 0xd9, 0x9a, 0xa5, 0xed, 0xa7, 0x63, 0xb6, 0x68, 0x3f, 0x60, 0x3b, 0xd6,
2457 0x24020008, 0x00431023, 0x30420007, 0x24a3fffe, 0xa7420142, 0xa7430144, 1448 0xc5, 0x73, 0xa4, 0xdc, 0xe4, 0xf3, 0x38, 0x60, 0x5d, 0xc0, 0xaf, 0x8d,
2458 0xa7400146, 0xa7460148, 0x8f420108, 0x8f830024, 0x30420020, 0x0002102b, 1449 0x36, 0xae, 0x19, 0xd8, 0x9f, 0xcf, 0x66, 0x5e, 0x27, 0xd7, 0x13, 0x7c,
2459 0x00021023, 0x30420009, 0x34420001, 0x30630006, 0xa742014a, 0x24020002, 1450 0x7e, 0x8f, 0x9d, 0xd3, 0xc7, 0xda, 0xb8, 0x00, 0xbe, 0x7f, 0x4b, 0xfd,
2460 0x1062000d, 0x2c620003, 0x10400005, 0x24020004, 0x10600011, 0x3c020041, 1451 0x4f, 0x6d, 0xbc, 0x06, 0x2d, 0x5c, 0x51, 0x0b, 0x6d, 0x6c, 0xe3, 0x79,
2461 0x0a0004d6, 0x00000000, 0x10620007, 0x24020006, 0x1462000d, 0x3c020151, 1452 0x01, 0xdf, 0xaf, 0x8d, 0x69, 0xa3, 0xf2, 0x7b, 0xfa, 0xf9, 0x9c, 0xf4,
2462 0x0a0004d0, 0x24030001, 0x0a0004cf, 0x3c020141, 0x3c020051, 0x24030001, 1453 0x9b, 0xe2, 0x6c, 0xe5, 0xf9, 0x94, 0x1d, 0x8a, 0xb5, 0x52, 0x07, 0x6b,
2463 0xaf421000, 0xaf830020, 0x0a0004d6, 0x00000000, 0xaf421000, 0xaf800020, 1454 0xc7, 0x3a, 0x98, 0x44, 0xae, 0x18, 0xe1, 0xb8, 0x12, 0xba, 0xb6, 0x99,
2464 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8f820020, 0x24a30008, 1455 0x12, 0x6b, 0x62, 0xf8, 0xfc, 0xfa, 0x7f, 0xe9, 0x82, 0xc0, 0x23, 0x31,
2465 0x8f850018, 0x10400006, 0x30c6ffff, 0x3c048000, 0x8f421000, 0x00441024, 1456 0x37, 0x6a, 0x0c, 0x3e, 0x0f, 0xf2, 0xfc, 0x8a, 0x8b, 0xfe, 0xaa, 0xd6,
2466 0x1040fffd, 0x00000000, 0x3063ffff, 0x30620007, 0x10400002, 0x24620007, 1457 0x10, 0xd8, 0xf3, 0x59, 0xcb, 0x78, 0xa0, 0xbe, 0x73, 0xe6, 0xa1, 0x05,
2467 0x3043fff8, 0x00a31021, 0x30421fff, 0x24434000, 0x0343d821, 0x00c02021, 1458 0xce, 0x01, 0x8f, 0xf3, 0x3d, 0x27, 0x40, 0x5b, 0x1b, 0xf1, 0x67, 0x4c,
2468 0x30830007, 0xaf85000c, 0xaf820018, 0xaf420084, 0x10600002, 0x24820007, 1459 0x36, 0xa4, 0xf5, 0x7d, 0x83, 0xfd, 0xa0, 0xb3, 0x93, 0x6a, 0x2c, 0x1d,
2469 0x3044fff8, 0x8f820030, 0x8f850000, 0x00441821, 0xaf82001c, 0x0065102b, 1460 0x9a, 0x7a, 0x82, 0x13, 0xf3, 0x28, 0x1a, 0xc2, 0xa9, 0x23, 0x70, 0xfa,
2470 0xaf830030, 0x14400002, 0x00651023, 0xaf820030, 0x8f840030, 0x34028000, 1461 0xf0, 0x18, 0xa7, 0xa8, 0xc4, 0x29, 0x12, 0x38, 0xfd, 0xb1, 0xc4, 0xe9,
2471 0x3c030800, 0x8c650834, 0x00821021, 0x03421821, 0xaf830010, 0xaf440080, 1462 0x0f, 0x4f, 0xc1, 0xe9, 0xc3, 0x67, 0xc0, 0xc9, 0xa0, 0x3d, 0xa7, 0x89,
2472 0x10a00006, 0x2402000e, 0x9383002f, 0x14620004, 0x3c021000, 0x2402043f, 1463 0x73, 0x56, 0x17, 0x35, 0xe9, 0xa1, 0x7b, 0x52, 0x4d, 0x75, 0x52, 0xdc,
2473 0xa7420148, 0x3c021000, 0x03e00008, 0xaf420178, 0x8f820024, 0x30424000, 1464 0x6d, 0x73, 0x8f, 0x86, 0xeb, 0x0e, 0xdb, 0x7a, 0x80, 0xf5, 0xa5, 0xc0,
2474 0x10400005, 0x24020800, 0x0000000d, 0x00000000, 0x2400040e, 0x24020800, 1465 0xee, 0xfa, 0x58, 0xed, 0x91, 0xc0, 0xbe, 0x5d, 0xe2, 0x74, 0x1d, 0x38,
2475 0xaf420178, 0x97440104, 0x3c030008, 0xaf430140, 0x8f820024, 0x30420001, 1466 0xb5, 0x4b, 0x9c, 0xb6, 0x87, 0x70, 0xda, 0x1e, 0xc1, 0x89, 0xf3, 0x49,
2476 0x10400006, 0x3085ffff, 0x24020002, 0x24a3fffe, 0xa7420146, 0x0a000526, 1467 0xcb, 0xd8, 0xee, 0x55, 0x18, 0x55, 0xf8, 0xe8, 0x74, 0xdb, 0x9c, 0xc6,
2477 0xa7430148, 0xa7400146, 0x8f840018, 0x2402000d, 0xa742014a, 0x24830008, 1468 0xfe, 0xcf, 0x51, 0xfa, 0x63, 0x95, 0xeb, 0x5a, 0x60, 0xf7, 0xaa, 0x2a,
2478 0x30631fff, 0x24624000, 0x0342d821, 0x30a20007, 0xaf84000c, 0xaf830018, 1469 0x8b, 0xf3, 0x80, 0xdf, 0x9f, 0xd4, 0x27, 0x98, 0xcb, 0x0f, 0x5c, 0x8e,
2479 0xaf430084, 0x10400002, 0x24a20007, 0x3045fff8, 0x8f820030, 0x8f840000, 1470 0x23, 0xea, 0x57, 0xa7, 0xca, 0x43, 0xcf, 0xab, 0xa8, 0xad, 0xf0, 0xcd,
2480 0x00451821, 0xaf82001c, 0x0064102b, 0xaf830030, 0x14400002, 0x00641023, 1471 0x36, 0xaa, 0xd4, 0x86, 0xde, 0x15, 0xd4, 0xe5, 0xe1, 0x71, 0x5d, 0x5e,
2481 0xaf820030, 0x8f840030, 0x34028000, 0x00821021, 0x03421821, 0x3c021000, 1472 0xc4, 0xe0, 0x7a, 0x59, 0x97, 0xef, 0x39, 0x5c, 0x97, 0x2f, 0x6a, 0x34,
2482 0xaf830010, 0xaf440080, 0x03e00008, 0xaf420178, 0x27bdffe8, 0x3c046008, 1473 0xb9, 0x51, 0x62, 0xc9, 0x9c, 0x9e, 0x42, 0xdf, 0x25, 0x81, 0x79, 0x8a,
2483 0xafbf0014, 0xafb00010, 0x8c825000, 0x3c1a8000, 0x2403ff7f, 0x375b4000, 1474 0xfc, 0xbd, 0x89, 0xfd, 0x47, 0x82, 0x9b, 0xa8, 0xb1, 0x4a, 0xde, 0xa2,
2484 0x00431024, 0x3442380c, 0xac825000, 0x8f430008, 0x3c100800, 0x37428000, 1475 0x86, 0xa5, 0x30, 0x2b, 0x62, 0xf5, 0xc5, 0xd6, 0x5d, 0x9f, 0x20, 0x4f,
2485 0x34630001, 0xaf430008, 0xaf820010, 0x3c02601c, 0xaf800018, 0xaf400080, 1476 0x1b, 0x1d, 0x15, 0x75, 0xfd, 0xfd, 0x8c, 0xf3, 0x33, 0x5d, 0x4e, 0x7a,
2486 0xaf400084, 0x8c450008, 0x3c036000, 0x8c620808, 0x3c040800, 0x3c030080, 1477 0x14, 0x9f, 0xf1, 0xae, 0xe5, 0xc0, 0xdc, 0x7f, 0xeb, 0x3c, 0x9f, 0x33,
2487 0xac830820, 0x3042fff0, 0x38420010, 0x2c420001, 0xaf850000, 0xaf820004, 1478 0xf5, 0xd5, 0xa0, 0x85, 0xf6, 0x81, 0x41, 0xa8, 0x7d, 0x70, 0x4f, 0xa1,
2488 0x0e000658, 0x00000000, 0x8f420000, 0x30420001, 0x1040fffb, 0x00000000, 1479 0x38, 0x38, 0x2f, 0xa1, 0xc6, 0xc1, 0x37, 0x7c, 0x92, 0x6c, 0xb6, 0x23,
2489 0x8f430108, 0x8f440100, 0x30622000, 0xaf830024, 0xaf840014, 0x10400004, 1480 0x7b, 0x4d, 0x70, 0x21, 0x26, 0x1f, 0xeb, 0xf4, 0x33, 0x71, 0x57, 0xe9,
2490 0x8e02082c, 0x24420001, 0x0a0005c6, 0xae02082c, 0x30620200, 0x14400003, 1481 0x28, 0x9e, 0x81, 0xda, 0x92, 0x0c, 0x9c, 0xf3, 0x88, 0x89, 0x65, 0xa4,
2491 0x24020f00, 0x14820027, 0x24020d00, 0x97420104, 0x1040001c, 0x30624000, 1482 0x03, 0xd4, 0x41, 0x38, 0xfb, 0x83, 0x55, 0xc4, 0xe5, 0x2c, 0x70, 0xcb,
2492 0x14400005, 0x00000000, 0x0e00022f, 0x00000000, 0x0a0005bb, 0x00000000, 1483 0x54, 0xf8, 0xbe, 0xa9, 0x17, 0xf7, 0x1c, 0x54, 0x35, 0x22, 0x5e, 0x8f,
2493 0x8f620008, 0x8f630000, 0x24020030, 0x00031e02, 0x306300f0, 0x10620007, 1484 0x4a, 0x7e, 0x88, 0x3a, 0x4b, 0x6a, 0xf7, 0xc9, 0x8a, 0x5c, 0xf0, 0x1c,
2494 0x28620031, 0x1440002f, 0x24020040, 0x10620007, 0x00000000, 0x0a0005bb, 1485 0xe7, 0x48, 0x37, 0xe3, 0xda, 0xf9, 0xac, 0x21, 0xdf, 0xe0, 0x5c, 0x7e,
2495 0x00000000, 0x0e0002e8, 0x00000000, 0x0a0005bb, 0x00000000, 0x0e0003db, 1486 0x88, 0x18, 0xe2, 0xfd, 0x80, 0xcf, 0x16, 0x85, 0xeb, 0x6f, 0xdc, 0x67,
2496 0x00000000, 0x0a0005bb, 0x00000000, 0x30620040, 0x1440002b, 0x00000000, 1487 0x96, 0x90, 0x6b, 0x68, 0x0a, 0x79, 0x0f, 0x79, 0x77, 0x96, 0x71, 0xf2,
2497 0x0000000d, 0x00000000, 0x240004b2, 0x0a0005c6, 0x00000000, 0x1482000f, 1488 0x23, 0xc6, 0x4b, 0x9c, 0x1b, 0xe7, 0xe4, 0x62, 0x9e, 0x5f, 0x6b, 0x05,
2498 0x30620006, 0x97420104, 0x10400005, 0x30620040, 0x0e000510, 0x00000000, 1489 0x7f, 0x71, 0x87, 0x41, 0xfc, 0x36, 0xfb, 0x2e, 0xe7, 0xdb, 0x2f, 0x2b,
2499 0x0a0005bb, 0x00000000, 0x1440001b, 0x00000000, 0x0000000d, 0x00000000, 1490 0x74, 0x44, 0x82, 0x8f, 0xe6, 0xcb, 0xc8, 0xc3, 0xe7, 0xe0, 0xe3, 0x0b,
2500 0x240004c4, 0x0a0005c6, 0x00000000, 0x1040000e, 0x30621000, 0x10400005, 1491 0x2d, 0x16, 0xf5, 0x56, 0xe5, 0xf3, 0xc9, 0xd8, 0x18, 0x1f, 0x29, 0xa3,
2501 0x00000000, 0x0e000688, 0x00000000, 0x0a0005bb, 0x00000000, 0x0e0004a1, 1492 0xdf, 0x3e, 0xf8, 0xbc, 0x52, 0xce, 0x57, 0xf1, 0xe3, 0x57, 0xe0, 0xc7,
2502 0x00000000, 0x8f82002c, 0x24420001, 0xaf82002c, 0x0a0005c6, 0x00000000, 1493 0x61, 0xd9, 0xcf, 0x77, 0x16, 0x1d, 0x36, 0xbc, 0x3e, 0xe6, 0x11, 0xdb,
2503 0x30620040, 0x14400004, 0x00000000, 0x0000000d, 0x00000000, 0x240004db, 1494 0x9b, 0xda, 0xe8, 0x18, 0x5f, 0x1a, 0xf3, 0xff, 0xfd, 0x90, 0xff, 0x34,
2504 0x8f420138, 0x3c034000, 0x00431025, 0xaf420138, 0x0a000566, 0x00000000, 1495 0xef, 0xc9, 0x8c, 0x0a, 0x0e, 0xe2, 0xef, 0x3d, 0x7d, 0xd4, 0xf7, 0x17,
2505 0x3c046008, 0x8c835000, 0x3c1a8000, 0x2402ff7f, 0x375b4000, 0x00621824, 1496 0x6a, 0xf1, 0x7d, 0xb6, 0xe0, 0x9e, 0x83, 0x67, 0x76, 0x38, 0xb4, 0x36,
2506 0x3463380c, 0xac835000, 0x8f420008, 0x3c056000, 0x3c03601c, 0x34420001, 1497 0x75, 0x6c, 0xec, 0x87, 0x18, 0x7b, 0x15, 0x79, 0x84, 0x7c, 0x05, 0x77,
2507 0xaf420008, 0x37428000, 0xaf800018, 0xaf820010, 0xaf400080, 0xaf400084, 1498 0xa6, 0x90, 0xf0, 0x9e, 0x5d, 0xa9, 0xe2, 0x03, 0x4e, 0xd0, 0xe5, 0xb4,
2508 0x8c660008, 0x8ca20808, 0x3c040800, 0x3c030080, 0xac830820, 0x3042fff0, 1499 0xe4, 0x82, 0x5c, 0x70, 0x81, 0xeb, 0xb4, 0xd5, 0x4d, 0x70, 0x21, 0x05,
2509 0x38420010, 0x2c420001, 0xaf860000, 0xaf820004, 0x03e00008, 0x00000000, 1500 0x17, 0xe0, 0xd7, 0xd1, 0xbc, 0x59, 0xe0, 0xcc, 0x39, 0x07, 0xdf, 0x19,
2510 0x3084ffff, 0x30820007, 0x10400002, 0x24820007, 0x3044fff8, 0x8f820018, 1501 0xf3, 0x82, 0x79, 0xc0, 0x9c, 0x78, 0xc2, 0x85, 0x2b, 0x3d, 0xc3, 0xd8,
2511 0x00441821, 0x30631fff, 0x24644000, 0x0344d821, 0xaf82000c, 0xaf830018, 1502 0xfd, 0x2f, 0x3c, 0x78, 0x57, 0xf0, 0x80, 0xf9, 0x58, 0xe4, 0x85, 0x2e,
2512 0x03e00008, 0xaf430084, 0x3084ffff, 0x30820007, 0x10400002, 0x24820007, 1503 0x70, 0x48, 0xca, 0xbc, 0x50, 0xe8, 0x9c, 0xeb, 0x1b, 0xd6, 0x78, 0xa1,
2513 0x3044fff8, 0x8f820030, 0x8f830000, 0x00442021, 0xaf82001c, 0x0083102b, 1504 0x8d, 0x2d, 0x68, 0xa3, 0xad, 0x70, 0xbd, 0xc3, 0xba, 0x60, 0x3f, 0xd6,
2514 0xaf840030, 0x14400002, 0x00831023, 0xaf820030, 0x8f820030, 0x34038000, 1505 0xc6, 0x49, 0x7e, 0x85, 0x46, 0xd2, 0xbe, 0x6d, 0x55, 0xf9, 0x21, 0x85,
2515 0x00431821, 0x03432021, 0xaf840010, 0x03e00008, 0xaf420080, 0x8f830024, 1506 0x2e, 0xba, 0xa5, 0x46, 0xd2, 0x52, 0x23, 0xb0, 0x89, 0x95, 0x16, 0xe7,
2516 0x24020002, 0x30630006, 0x1062000d, 0x2c620003, 0x50400005, 0x24020004, 1507 0x7a, 0xdb, 0x0a, 0x91, 0x17, 0xba, 0x62, 0xcc, 0x98, 0x8a, 0x3b, 0x09,
2517 0x10600012, 0x3c020001, 0x0a00062a, 0x00000000, 0x10620007, 0x24020006, 1508 0xeb, 0x96, 0xf3, 0xe9, 0x50, 0x1e, 0x2d, 0xef, 0xa5, 0x1d, 0x71, 0x2f,
2518 0x1462000f, 0x3c020111, 0x0a000622, 0x00821025, 0x0a000621, 0x3c020101, 1509 0xfd, 0x8a, 0x3e, 0x9a, 0x47, 0x67, 0x90, 0x43, 0xf8, 0x5e, 0x3a, 0xa7,
2519 0x3c020011, 0x00821025, 0x24030001, 0xaf421000, 0xaf830020, 0x0a00062a, 1510 0xf3, 0xbd, 0x14, 0xba, 0xd3, 0x87, 0xef, 0xa5, 0xc9, 0xc8, 0xbd, 0xb4,
2520 0x00000000, 0x00821025, 0xaf421000, 0xaf800020, 0x00000000, 0x00000000, 1511 0xf2, 0xe5, 0xf6, 0x93, 0xf2, 0x69, 0x15, 0x13, 0xce, 0xa9, 0x02, 0xf3,
2521 0x00000000, 0x03e00008, 0x00000000, 0x8f820020, 0x10400005, 0x3c038000, 1512 0x13, 0x6a, 0xbf, 0xca, 0x86, 0xf3, 0x0d, 0x6b, 0xb9, 0xcc, 0x51, 0xa8,
2522 0x8f421000, 0x00431024, 0x1040fffd, 0x00000000, 0x03e00008, 0x00000000, 1513 0xb5, 0xee, 0x67, 0x15, 0xe7, 0xdf, 0xc0, 0x3c, 0xf8, 0xee, 0x9f, 0xc4,
2523 0x8f820024, 0x27bdffe8, 0x30424000, 0x14400005, 0xafbf0010, 0x0e00022f, 1514 0x79, 0xa3, 0xe4, 0xfc, 0x54, 0xe1, 0xd3, 0x1f, 0xe6, 0xfd, 0x1b, 0xfa,
2524 0x00000000, 0x0a000656, 0x8fbf0010, 0x8f620008, 0x8f630000, 0x24020030, 1515 0x28, 0xef, 0xab, 0x71, 0x2a, 0xde, 0x17, 0x63, 0x3e, 0x54, 0x9a, 0x38,
2525 0x00031e02, 0x306300f0, 0x10620008, 0x28620031, 0x1440000d, 0x8fbf0010, 1516 0xdb, 0x96, 0x91, 0x6b, 0x66, 0xf8, 0xbe, 0x85, 0x5c, 0xe0, 0xd5, 0x71,
2526 0x24020040, 0x10620007, 0x00000000, 0x0a000656, 0x00000000, 0x0e0002e8, 1517 0xef, 0x98, 0xe1, 0xb1, 0xd3, 0x0c, 0xe7, 0x4d, 0x03, 0xbc, 0x17, 0x9c,
2527 0x00000000, 0x0a000656, 0x8fbf0010, 0x0e0003db, 0x00000000, 0x8fbf0010, 1518 0x3d, 0x12, 0xf7, 0x01, 0xac, 0x7b, 0x86, 0xab, 0xab, 0x51, 0x2e, 0xbe,
2528 0x03e00008, 0x27bd0018, 0x8f840028, 0x1080000f, 0x3c026000, 0x8c430c3c, 1519 0x88, 0x0b, 0x45, 0xb5, 0x97, 0xaa, 0xcd, 0x19, 0x6a, 0x5b, 0x2e, 0xb1,
2529 0x30630fff, 0xaf830008, 0x14600011, 0x3082000f, 0x10400005, 0x308200f0, 1520 0x2e, 0x62, 0xfd, 0xa0, 0xb8, 0x8f, 0xd3, 0x2e, 0x6a, 0xb1, 0x43, 0xd4,
2530 0x10400003, 0x30820f00, 0x14400006, 0x00000000, 0x0000000d, 0x00000000, 1521 0x39, 0x77, 0x70, 0x9f, 0x4b, 0x06, 0x8f, 0xf2, 0x07, 0x0d, 0x95, 0xba,
2531 0x2400051a, 0x03e00008, 0x00000000, 0x0000000d, 0x00000000, 0x2400051f, 1522 0xc7, 0x3e, 0x5d, 0xac, 0xd7, 0x36, 0x6f, 0xe3, 0xed, 0xdd, 0x41, 0x15,
2532 0x03e00008, 0x00000000, 0xaf830028, 0x03e00008, 0x00000000, 0x10c00007, 1523 0x53, 0xee, 0xe7, 0xb6, 0x7f, 0xe0, 0xbc, 0x45, 0x1d, 0x37, 0x32, 0x67,
2533 0x00000000, 0x8ca20000, 0x24c6ffff, 0x24a50004, 0xac820000, 0x14c0fffb, 1524 0xf5, 0xce, 0x7f, 0xff, 0x06, 0x63, 0xe1, 0x4b, 0x7b, 0x30, 0x12, 0x00,
2534 0x24840004, 0x03e00008, 0x00000000, 0x0a000684, 0x00a01021, 0xac860000, 1525 0x00, 0x00 };
2535 0x00000000, 0x00000000, 0x24840004, 0x00a01021, 0x1440fffa, 0x24a5ffff,
2536 0x03e00008, 0x00000000, 0x0000000d, 0x03e00008, 0x00000000, 0x00000000};
2537 1526
2538static u32 bnx2_TPAT_b06FwData[(0x0/4) + 1] = { 0x0 }; 1527static u32 bnx2_TPAT_b06FwData[(0x0/4) + 1] = { 0x0 };
2539static u32 bnx2_TPAT_b06FwRodata[(0x0/4) + 1] = { 0x0 }; 1528static u32 bnx2_TPAT_b06FwRodata[(0x0/4) + 1] = { 0x0 };
@@ -2554,939 +1543,422 @@ static const u32 bnx2_TXP_b06FwBssAddr = 0x080057a0;
2554static const int bnx2_TXP_b06FwBssLen = 0x1c4; 1543static const int bnx2_TXP_b06FwBssLen = 0x1c4;
2555static const u32 bnx2_TXP_b06FwSbssAddr = 0x08005760; 1544static const u32 bnx2_TXP_b06FwSbssAddr = 0x08005760;
2556static const int bnx2_TXP_b06FwSbssLen = 0x38; 1545static const int bnx2_TXP_b06FwSbssLen = 0x38;
2557static u32 bnx2_TXP_b06FwText[(0x5748/4) + 1] = { 1546static u8 bnx2_TXP_b06FwText[] = {
2558 0x0a000d2c, 0x00000000, 0x00000000, 0x0000000d, 0x74787020, 0x322e352e, 1547 0x1f, 0x8b, 0x08, 0x08, 0x21, 0xd3, 0x41, 0x44, 0x00, 0x03, 0x74, 0x65,
2559 0x38000000, 0x02050800, 0x0000000a, 0x000003e8, 0x0000ea60, 0x00000000, 1548 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xed, 0x5c, 0x6d, 0x6c,
2560 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1549 0x1b, 0xf7, 0x79, 0x7f, 0xee, 0x85, 0xd2, 0x51, 0x96, 0xe9, 0x93, 0xc2,
2561 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1550 0x78, 0x6c, 0xc0, 0xa6, 0x77, 0xd6, 0x51, 0x66, 0x20, 0xb5, 0xa0, 0x05,
2562 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1551 0x36, 0x55, 0x87, 0x43, 0x73, 0x3e, 0x52, 0x2f, 0x4e, 0x5c, 0x57, 0x71,
2563 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1552 0x94, 0x86, 0x6e, 0x0d, 0x8c, 0xa0, 0xec, 0xd8, 0xeb, 0x5a, 0x2c, 0x1f,
2564 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1553 0x8c, 0xd5, 0x68, 0xd1, 0x99, 0xa1, 0x68, 0xc7, 0xc9, 0x68, 0x51, 0xa9,
2565 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1554 0xe5, 0xa8, 0x43, 0x57, 0x80, 0x95, 0x64, 0xcb, 0x29, 0x4e, 0x3a, 0x65,
2566 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1555 0xcb, 0x16, 0x0c, 0x58, 0x16, 0xcd, 0x2f, 0x5d, 0x3f, 0x74, 0x80, 0x3f,
2567 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1556 0xec, 0x43, 0x3a, 0xec, 0x83, 0x91, 0x14, 0xad, 0x11, 0x6c, 0x59, 0xb0,
2568 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1557 0x2f, 0x33, 0xd6, 0x26, 0xb7, 0xdf, 0x73, 0x77, 0x94, 0x95, 0xc4, 0x4e,
2569 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1558 0xab, 0x7d, 0xbe, 0x07, 0x20, 0xee, 0x7f, 0xff, 0xd7, 0xe7, 0xfd, 0xe5,
2570 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1559 0x7f, 0x90, 0x06, 0xb7, 0x53, 0x17, 0x85, 0xb0, 0x1d, 0x3f, 0xed, 0x99,
2571 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1560 0x93, 0x27, 0x3e, 0xf7, 0xf9, 0xcf, 0x0d, 0xa1, 0x39, 0x4c, 0x4a, 0x4c,
2572 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1561 0xe4, 0xc1, 0x5b, 0x12, 0x51, 0xf9, 0x1d, 0x8a, 0x20, 0x82, 0x08, 0x22,
2573 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1562 0x88, 0x20, 0x82, 0x08, 0x22, 0x88, 0x20, 0x82, 0x08, 0x22, 0x88, 0x20,
2574 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1563 0x82, 0x08, 0x22, 0x88, 0x20, 0x82, 0x08, 0x22, 0x88, 0x20, 0x82, 0x08,
2575 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1564 0x22, 0x88, 0x20, 0x82, 0x08, 0x22, 0x88, 0x20, 0x82, 0x08, 0x22, 0x88,
2576 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1565 0x20, 0x82, 0x08, 0x22, 0x88, 0x20, 0x82, 0x08, 0x22, 0x88, 0x20, 0x82,
2577 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1566 0x08, 0x22, 0x88, 0x20, 0x82, 0x08, 0x22, 0x88, 0x20, 0x82, 0x08, 0x22,
2578 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1567 0xf8, 0x9d, 0x20, 0x11, 0xa9, 0xfc, 0xdc, 0x1e, 0xfe, 0x48, 0x11, 0xcd,
2579 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1568 0xf2, 0x53, 0xb6, 0x41, 0x8a, 0x64, 0x1e, 0x39, 0x34, 0x65, 0x10, 0x59,
2580 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1569 0xce, 0x80, 0x56, 0xa0, 0xf7, 0xbd, 0x6a, 0x52, 0x26, 0xee, 0xff, 0xb4,
2581 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1570 0xf9, 0xdb, 0x53, 0xaf, 0x7f, 0x41, 0x7f, 0xaf, 0x25, 0x91, 0xa2, 0x9a,
2582 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1571 0x6b, 0x79, 0xb5, 0x9f, 0x94, 0x34, 0xd6, 0xfc, 0xd5, 0xee, 0xaf, 0xef,
2583 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1572 0xa0, 0x44, 0x7b, 0xaf, 0x24, 0xd5, 0x9b, 0xb7, 0xbc, 0xd7, 0x77, 0x27,
2584 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1573 0xe9, 0x15, 0x57, 0xa5, 0x35, 0x57, 0x16, 0x46, 0x9b, 0x0a, 0x4d, 0x37,
2585 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1574 0x1d, 0x3a, 0xdd, 0xa8, 0x52, 0xc1, 0xbd, 0x4c, 0xb5, 0x39, 0x35, 0x61,
2586 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1575 0x2f, 0xff, 0x84, 0xa6, 0xe7, 0x7a, 0x13, 0x85, 0x65, 0x87, 0x6a, 0x8d,
2587 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1576 0x54, 0xc2, 0x76, 0xd5, 0x44, 0x61, 0x3e, 0x89, 0xf7, 0xde, 0x84, 0x3d,
2588 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1577 0xaf, 0x57, 0x89, 0x76, 0x62, 0x4e, 0x2a, 0x51, 0x68, 0xea, 0x65, 0xa2,
2589 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1578 0xbe, 0xdc, 0x75, 0x4a, 0x27, 0x0a, 0xee, 0x82, 0xb0, 0xae, 0x0a, 0x54,
2590 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1579 0xfb, 0x2c, 0xa9, 0x09, 0xf3, 0xb6, 0xf7, 0x29, 0x43, 0xa5, 0x1e, 0x83,
2591 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1580 0x76, 0xec, 0x30, 0xe8, 0xd9, 0x94, 0xa9, 0x50, 0xe5, 0x7c, 0x9c, 0x2c,
2592 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1581 0x9f, 0x26, 0x95, 0x2a, 0xf3, 0x03, 0xea, 0x15, 0x8a, 0x91, 0x95, 0x6c,
2593 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1582 0xbf, 0x7b, 0x9e, 0x9d, 0xfb, 0x16, 0xff, 0x9d, 0x16, 0xce, 0xa2, 0xc4,
2594 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1583 0xa8, 0x4b, 0x64, 0x03, 0x2f, 0x3b, 0xf7, 0xbe, 0x17, 0xac, 0x51, 0x70,
2595 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1584 0xae, 0x9c, 0x18, 0x69, 0x7a, 0x5e, 0x31, 0x87, 0x33, 0x72, 0xed, 0xb5,
2596 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1585 0x31, 0x6a, 0x25, 0xad, 0xd6, 0x74, 0x2e, 0xbf, 0x23, 0xf8, 0x1b, 0x2f,
2597 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1586 0xa6, 0x91, 0xdf, 0x2d, 0x12, 0x8d, 0xaf, 0x50, 0x25, 0x49, 0xad, 0x5a,
2598 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1587 0xee, 0x61, 0x7a, 0x21, 0xd7, 0x4d, 0x67, 0xb1, 0xdf, 0xf3, 0x39, 0xf0,
2599 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1588 0xd1, 0x38, 0x29, 0xd8, 0xae, 0x9e, 0x22, 0xe1, 0x05, 0xb2, 0xe7, 0xfb,
2600 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1589 0xd4, 0x02, 0xe1, 0x6c, 0xc3, 0xfb, 0x8c, 0x9d, 0xc3, 0x79, 0x83, 0xff,
2601 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1590 0xeb, 0x59, 0x49, 0xbd, 0xdc, 0xa2, 0x14, 0xd5, 0x9a, 0x7d, 0xb9, 0x9f,
2602 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1591 0x93, 0x40, 0x9d, 0x06, 0xf3, 0xc7, 0xa3, 0xc7, 0x70, 0xae, 0x6d, 0xa0,
2603 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1592 0xdf, 0x25, 0x4b, 0xcc, 0xc4, 0xe8, 0x4f, 0x55, 0x5d, 0xb3, 0xa5, 0x5e,
2604 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1593 0xaa, 0x9d, 0xef, 0x04, 0x9e, 0x56, 0xaf, 0x88, 0xb9, 0x63, 0x79, 0x4a,
2605 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1594 0x6e, 0x23, 0x12, 0x24, 0x33, 0x83, 0x7d, 0x89, 0x6a, 0x4e, 0x0a, 0x6b,
2606 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1595 0x33, 0xc3, 0xef, 0xd0, 0x0e, 0xd2, 0x7a, 0x64, 0x9a, 0x76, 0xba, 0xc0,
2607 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1596 0xc7, 0x6e, 0xc8, 0x20, 0x33, 0xfc, 0x2e, 0x84, 0x22, 0x1a, 0x99, 0xd4,
2608 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1597 0x49, 0x2a, 0x0b, 0x05, 0xb7, 0x83, 0xa6, 0x33, 0x0a, 0xd5, 0x81, 0x47,
2609 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1598 0x3d, 0xf7, 0x35, 0xc1, 0x5e, 0x2e, 0x09, 0x85, 0x65, 0xcc, 0x73, 0x5f,
2610 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1599 0x0b, 0xff, 0x76, 0xad, 0x1b, 0xfb, 0x88, 0x54, 0xcb, 0x94, 0x30, 0xa6,
2611 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1600 0xd0, 0x14, 0xe6, 0x4d, 0x81, 0xa6, 0x69, 0x77, 0x07, 0xad, 0x4f, 0x26,
2612 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1601 0x13, 0xcc, 0xab, 0x1a, 0xc6, 0xbf, 0x32, 0x21, 0x90, 0x6a, 0x58, 0xf4,
2613 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1602 0xeb, 0x3c, 0x64, 0x38, 0xdf, 0xcb, 0x32, 0xa3, 0xd3, 0x4d, 0x4a, 0x8a,
2614 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1603 0x94, 0x49, 0x55, 0xe8, 0x32, 0x2d, 0x3a, 0x2c, 0x7f, 0xc8, 0x13, 0xf2,
2615 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1604 0xae, 0x39, 0xbc, 0x0e, 0x72, 0x6b, 0x16, 0xc1, 0x8f, 0x71, 0xe0, 0x70,
2616 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1605 0x50, 0x78, 0x6c, 0x71, 0x52, 0x18, 0x73, 0x7f, 0x93, 0xa0, 0xae, 0x93,
2617 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1606 0xc2, 0x01, 0xf7, 0xa8, 0x10, 0xf2, 0x1e, 0xb2, 0x53, 0xc8, 0x9a, 0x50,
2618 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1607 0xe8, 0x92, 0x1b, 0xc8, 0x6e, 0x01, 0xfa, 0x69, 0xa9, 0x16, 0xe4, 0x70,
2619 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1608 0x78, 0x63, 0x0e, 0x8f, 0xd5, 0x97, 0x65, 0x3a, 0xed, 0xf2, 0xfc, 0x3f,
2620 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1609 0x82, 0x7c, 0x14, 0x72, 0x76, 0x77, 0x53, 0x19, 0xfd, 0xb5, 0x79, 0xb2,
2621 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1610 0xec, 0x9c, 0x88, 0x35, 0x09, 0x92, 0x8c, 0x9d, 0xf8, 0x75, 0xd1, 0xd4,
2622 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1611 0x62, 0xa7, 0x25, 0x19, 0x49, 0x9a, 0x72, 0x99, 0x87, 0x78, 0x36, 0xdb,
2623 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1612 0x7c, 0x64, 0x5c, 0xb9, 0x9f, 0xd7, 0x71, 0xbf, 0x8a, 0xfe, 0xcd, 0x7d,
2624 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1613 0xac, 0x17, 0x09, 0xe0, 0xa3, 0x67, 0x59, 0x9f, 0x2b, 0xcd, 0x8c, 0x7a,
2625 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1614 0x80, 0x9f, 0x2e, 0xf3, 0xb6, 0xcd, 0x53, 0x19, 0x73, 0x45, 0xaa, 0x2c,
2626 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1615 0xe2, 0x9c, 0xf3, 0xbf, 0xf5, 0x62, 0x79, 0xbc, 0x1b, 0x1d, 0xa0, 0x8b,
2627 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1616 0xcf, 0x95, 0x81, 0x93, 0x48, 0xe5, 0x45, 0xde, 0x8b, 0xc7, 0x09, 0xb2,
2628 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1617 0xaf, 0xf5, 0x88, 0x94, 0x85, 0x7c, 0x75, 0x9c, 0x13, 0xc7, 0x9c, 0x6e,
2629 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1618 0xf0, 0x0f, 0xb4, 0x2e, 0xa3, 0x0d, 0xda, 0x45, 0x43, 0xc4, 0xfa, 0x4e,
2630 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1619 0x9a, 0xca, 0xb1, 0xbe, 0x30, 0x9e, 0xdb, 0xb0, 0x77, 0x9c, 0x8e, 0x9c,
2631 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1620 0x67, 0x7e, 0xc8, 0xf4, 0x3c, 0x70, 0x9c, 0x9e, 0xd7, 0xd5, 0x22, 0xe9,
2632 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1621 0xe0, 0x8d, 0x85, 0x79, 0x9d, 0x54, 0x56, 0x3d, 0x6f, 0x24, 0x37, 0xa0,
2633 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1622 0xbe, 0xec, 0xeb, 0xf9, 0x80, 0x9a, 0x11, 0xa8, 0xda, 0x61, 0xfe, 0x21,
2634 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1623 0x70, 0xd0, 0x4b, 0x44, 0xfc, 0xfe, 0xcf, 0x64, 0x4d, 0xb2, 0xfd, 0x24,
2635 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1624 0xf9, 0x2c, 0xd8, 0xd3, 0x4e, 0xe0, 0xcf, 0x36, 0x97, 0x86, 0x5c, 0x52,
2636 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1625 0xbe, 0x1d, 0x8c, 0xdc, 0xd5, 0x0e, 0xf4, 0xf1, 0x16, 0x6c, 0xa6, 0xb6,
2637 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1626 0x2c, 0xb3, 0xfd, 0xe5, 0xa0, 0x6e, 0xb4, 0xcd, 0x80, 0x6e, 0xf9, 0xb2,
2638 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1627 0xd9, 0x8f, 0xfd, 0x3d, 0xef, 0xcb, 0xb9, 0x00, 0xa7, 0xda, 0xbc, 0x85,
2639 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1628 0xb5, 0x32, 0xf8, 0xae, 0x1f, 0xd7, 0xfc, 0xf3, 0xf7, 0x87, 0xe7, 0xab,
2640 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1629 0x34, 0x05, 0xbc, 0x6b, 0x4d, 0x89, 0x0a, 0x2a, 0xef, 0xf1, 0x2e, 0xf7,
2641 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1630 0x97, 0x83, 0xbd, 0xa0, 0xb7, 0xe7, 0xfa, 0xd4, 0x7d, 0xb0, 0x25, 0xb6,
2642 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1631 0xb1, 0xda, 0x0a, 0xf3, 0x18, 0xfb, 0xe4, 0x99, 0xc7, 0xaa, 0x8f, 0xa3,
2643 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1632 0x3d, 0xcf, 0x7a, 0x44, 0x69, 0x89, 0x58, 0xcf, 0x2f, 0xb3, 0x2e, 0x41,
2644 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1633 0x3f, 0x03, 0xbd, 0xaa, 0x38, 0x2c, 0xff, 0x2f, 0x85, 0xf6, 0x29, 0x52,
2645 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1634 0x7f, 0x86, 0xf5, 0xfd, 0x05, 0x2a, 0xc0, 0xc6, 0xa7, 0x70, 0xd2, 0x22,
2646 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1635 0x68, 0x5a, 0x68, 0xf6, 0x81, 0x57, 0x6d, 0xbb, 0x83, 0x7c, 0x07, 0xff,
2647 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1636 0xc7, 0x0b, 0xe6, 0x77, 0x03, 0x27, 0xb6, 0x99, 0x9a, 0x2a, 0x52, 0x15,
2648 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1637 0x3f, 0xe8, 0x8d, 0xa1, 0x67, 0x6d, 0x49, 0x9f, 0x28, 0x03, 0x37, 0xe8,
2649 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1638 0x3d, 0xd9, 0x7b, 0x58, 0x9f, 0x31, 0xc7, 0xa5, 0xa1, 0xb6, 0x9d, 0x2d,
2650 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1639 0x38, 0x2c, 0xa7, 0x2e, 0x9c, 0xdb, 0xc6, 0x49, 0x46, 0x1f, 0xef, 0xa3,
2651 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1640 0x40, 0xe7, 0xdb, 0x3a, 0xc3, 0xfa, 0xa7, 0x5b, 0xeb, 0xd4, 0x41, 0xd9,
2652 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1641 0x0c, 0x7c, 0xd9, 0xbc, 0x08, 0xf9, 0xa5, 0xe1, 0x53, 0x64, 0x7a, 0xba,
2653 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1642 0x99, 0xa4, 0x63, 0x4d, 0xc6, 0xaf, 0x08, 0xbb, 0x83, 0x6f, 0x9b, 0x1f,
2654 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1643 0x85, 0x9d, 0x8d, 0x0b, 0x23, 0xb0, 0x89, 0x47, 0x17, 0x19, 0x27, 0x8f,
2655 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1644 0xd8, 0x2e, 0x8b, 0xcb, 0x65, 0x61, 0xd4, 0x2d, 0x09, 0xe3, 0xcb, 0x6c,
2656 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1645 0x27, 0x6c, 0x23, 0xba, 0xfa, 0x38, 0x31, 0x0d, 0x98, 0xe3, 0xfe, 0x22,
2657 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1646 0xc1, 0xb6, 0x5a, 0x3b, 0x17, 0x07, 0x1e, 0xdb, 0x80, 0x4f, 0x37, 0x6c,
2658 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1647 0x0f, 0xfa, 0x65, 0xe8, 0x13, 0xac, 0x33, 0xc5, 0x8c, 0xa1, 0xfd, 0x25,
2659 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1648 0x7d, 0x9c, 0x0f, 0x23, 0x1b, 0x7c, 0x18, 0x00, 0x4f, 0x3e, 0xcc, 0x87,
2660 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1649 0xfa, 0xc7, 0xf9, 0x60, 0x55, 0xc1, 0x87, 0x3a, 0xfc, 0x50, 0xdd, 0x65,
2661 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1650 0x9a, 0x3d, 0x12, 0xf7, 0x10, 0xb4, 0x93, 0xf6, 0x8a, 0x26, 0xeb, 0x28,
2662 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1651 0xdb, 0x49, 0x46, 0x9b, 0xc6, 0x0e, 0x4b, 0x4e, 0xb7, 0x6f, 0x1b, 0xa3,
2663 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1652 0x3e, 0x2f, 0x7e, 0x17, 0xbd, 0x4c, 0xdf, 0x1d, 0x9a, 0xc7, 0x17, 0xd9,
2664 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1653 0xdf, 0x40, 0xcf, 0x33, 0x86, 0x7a, 0x88, 0xee, 0xd0, 0xbd, 0xef, 0x0e,
2665 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1654 0xdd, 0x38, 0xa7, 0xed, 0x83, 0x98, 0xe6, 0xb6, 0x3f, 0x66, 0x5d, 0x79,
2666 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1655 0xc3, 0x93, 0x0c, 0x03, 0x32, 0x60, 0x7d, 0x61, 0x1c, 0x74, 0xf5, 0xcb,
2667 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1656 0xa0, 0xa7, 0x02, 0xbf, 0xc0, 0xb6, 0x54, 0xf6, 0xe7, 0x75, 0x50, 0xb9,
2668 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1657 0x27, 0x98, 0x3f, 0xd5, 0xf4, 0xfe, 0x4b, 0x34, 0x3f, 0xf0, 0xec, 0xbc,
2669 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1658 0x11, 0xda, 0xb8, 0x42, 0x7f, 0xb2, 0xa8, 0x97, 0x35, 0xa1, 0x9b, 0xaa,
2670 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1659 0xf7, 0xc3, 0xaf, 0x34, 0xd9, 0x3e, 0x76, 0xde, 0xc3, 0x97, 0xa5, 0x43,
2671 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1660 0x5f, 0xf6, 0x3e, 0x78, 0xcf, 0xb1, 0xe7, 0xe8, 0x07, 0xeb, 0x49, 0x7e,
2672 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1661 0x66, 0xd4, 0x09, 0x2a, 0x71, 0xbc, 0xd9, 0x21, 0xfa, 0xfe, 0xbb, 0x8f,
2673 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1662 0x63, 0x41, 0x55, 0x36, 0xe3, 0x54, 0xed, 0xa1, 0xaa, 0x64, 0xb2, 0x1d,
2674 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1663 0xb1, 0x6d, 0xb4, 0xf1, 0xde, 0x1e, 0xc6, 0xdd, 0x41, 0x89, 0x0c, 0x1e,
2675 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1664 0x47, 0x8c, 0x68, 0x32, 0x0d, 0xef, 0x87, 0xf2, 0x60, 0x7f, 0x4a, 0xb1,
2676 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1665 0x40, 0xdf, 0xf6, 0xc3, 0x5f, 0x32, 0x3f, 0x37, 0xeb, 0x0a, 0xfb, 0x51,
2677 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1666 0xd2, 0x44, 0x83, 0xfd, 0x28, 0xa9, 0x92, 0x79, 0x50, 0xb0, 0x16, 0xbf,
2678 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1667 0x26, 0x58, 0xe0, 0x9b, 0x05, 0xbe, 0x59, 0xe0, 0x9b, 0x0d, 0xbe, 0x15,
2679 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1668 0x5c, 0xc6, 0x85, 0xf1, 0x08, 0xf6, 0x2f, 0x06, 0xfb, 0x03, 0xc7, 0x9d,
2680 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1669 0x54, 0xf1, 0xed, 0x9b, 0x69, 0x85, 0x3f, 0xf6, 0x7d, 0xc1, 0xa8, 0x10,
2681 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1670 0xf8, 0x02, 0xde, 0x6f, 0x1c, 0xeb, 0x1f, 0x47, 0x8c, 0xb3, 0x44, 0xd1,
2682 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1671 0xb8, 0xc3, 0x8f, 0xfa, 0x26, 0x7e, 0x4c, 0x3b, 0xcc, 0x1f, 0x9e, 0xcf,
2683 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1672 0x76, 0xec, 0x40, 0xe6, 0x6d, 0x9e, 0xec, 0x07, 0x0e, 0x9d, 0x4c, 0x77,
2684 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1673 0x48, 0x07, 0xef, 0xdf, 0x1b, 0xee, 0x7f, 0x00, 0x7b, 0xb2, 0xdd, 0xde,
2685 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1674 0xed, 0x5c, 0x3e, 0x93, 0xe3, 0xe8, 0x27, 0xd1, 0x83, 0x3c, 0x02, 0x7e,
2686 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1675 0x66, 0x0d, 0x76, 0x76, 0x53, 0x4a, 0xd1, 0xeb, 0xbb, 0x6f, 0x20, 0xb7,
2687 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1676 0xa0, 0xea, 0x03, 0xa6, 0xa7, 0xc9, 0xe6, 0xfb, 0x5e, 0x3d, 0x0f, 0xdf,
2688 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1677 0x69, 0xea, 0x29, 0x5b, 0x1a, 0xa4, 0x37, 0xdc, 0x2c, 0xfd, 0x9d, 0x6b,
2689 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1678 0xd0, 0xdf, 0xba, 0x1a, 0xbd, 0xea, 0xa6, 0xe9, 0x6f, 0xdc, 0x14, 0xfd,
2690 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1679 0xb5, 0xdb, 0xce, 0x43, 0x92, 0xac, 0x47, 0x89, 0xa2, 0x7b, 0xb7, 0x5c,
2691 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1680 0x08, 0x3a, 0x8e, 0xbd, 0xec, 0xbc, 0x5c, 0x96, 0x4d, 0x3f, 0x3f, 0x98,
2692 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1681 0x98, 0x6e, 0x90, 0xb2, 0xd3, 0xa0, 0xed, 0xf7, 0x23, 0xef, 0x49, 0x9a,
2693 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1682 0xb4, 0xe3, 0x3e, 0x3c, 0x7b, 0x4d, 0xb2, 0x7a, 0xcc, 0x53, 0x9e, 0x68,
2694 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1683 0xb0, 0x1e, 0x75, 0x0f, 0x4f, 0xe5, 0xe3, 0x8c, 0xfb, 0xc4, 0x34, 0xfc,
2695 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1684 0x91, 0x8d, 0xb3, 0xaa, 0xd0, 0xc5, 0xaa, 0x7b, 0xe8, 0xfe, 0x20, 0x17,
2696 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1685 0x7a, 0x2f, 0xcc, 0x89, 0x38, 0xaf, 0x5a, 0x7f, 0x6a, 0xc2, 0x60, 0x3f,
2697 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1686 0x2b, 0x6c, 0xf2, 0xb3, 0x24, 0x14, 0x41, 0x53, 0x1d, 0xb8, 0x16, 0x41,
2698 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1687 0xe7, 0x57, 0x5d, 0x45, 0x28, 0x9c, 0xef, 0xa5, 0xe9, 0x45, 0x8e, 0x55,
2699 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1688 0x3c, 0x4f, 0x09, 0x73, 0x19, 0x7e, 0xef, 0xc0, 0x3b, 0x21, 0x7e, 0x14,
2700 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1689 0xb6, 0x53, 0x42, 0x7f, 0x73, 0x82, 0x9c, 0x30, 0x17, 0x89, 0xd1, 0x05,
2701 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1690 0x5f, 0x77, 0xb8, 0xdf, 0x2a, 0xfd, 0xb0, 0xff, 0x4e, 0xff, 0xf9, 0x8d,
2702 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1691 0xfe, 0x72, 0xe9, 0xeb, 0x1b, 0xfd, 0xef, 0xa8, 0x01, 0x4e, 0xc3, 0xc2,
2703 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1692 0xe3, 0xee, 0xf3, 0x61, 0xdf, 0x6d, 0xf0, 0xd3, 0xf3, 0xea, 0x88, 0x27,
2704 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1693 0x35, 0xe3, 0x36, 0x72, 0x1f, 0xf6, 0x29, 0x5b, 0xf1, 0x21, 0x1f, 0xf2,
2705 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1694 0x1f, 0xaa, 0x2d, 0xb1, 0x9c, 0x14, 0x0a, 0xf6, 0xe4, 0xf1, 0x4e, 0xf8,
2706 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1695 0x92, 0xdb, 0x68, 0x73, 0xec, 0x6a, 0xfb, 0x31, 0x9e, 0xc3, 0xeb, 0x6f,
2707 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1696 0xdd, 0x43, 0x96, 0x2a, 0x64, 0xb9, 0x35, 0x79, 0xd5, 0x1a, 0xa7, 0x42,
2708 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1697 0x9f, 0xd0, 0x3d, 0x6c, 0x43, 0x2e, 0x12, 0xe4, 0x52, 0x83, 0x5c, 0x0a,
2709 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1698 0xf7, 0x94, 0x0b, 0xce, 0xd8, 0xd0, 0x29, 0xc6, 0xa3, 0x2b, 0x3c, 0x9b,
2710 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1699 0x14, 0xd9, 0xac, 0x96, 0xea, 0xc6, 0xa7, 0x28, 0x66, 0x30, 0x1e, 0x06,
2711 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1700 0xf0, 0x38, 0x8a, 0xb5, 0x1c, 0xc3, 0x48, 0x89, 0x99, 0x2c, 0xcf, 0xdc,
2712 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1701 0x13, 0xb6, 0x71, 0xab, 0xb4, 0xe0, 0xdc, 0x2a, 0x5d, 0x34, 0xf8, 0xfd,
2713 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1702 0xf6, 0x64, 0x90, 0x37, 0x77, 0x3f, 0x89, 0xbc, 0x19, 0xeb, 0xd9, 0x1f,
2714 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1703 0x72, 0xff, 0x30, 0xe6, 0x71, 0x7c, 0xa0, 0x43, 0x35, 0xfc, 0xea, 0xfe,
2715 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1704 0xdc, 0x6b, 0x4f, 0xf0, 0xdc, 0x4e, 0x53, 0x9e, 0xfc, 0x35, 0x9e, 0x1d,
2716 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1705 0xa6, 0xf6, 0xe4, 0x4f, 0x0d, 0xde, 0x77, 0x78, 0xf2, 0xa2, 0xbf, 0x07,
2717 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1706 0x62, 0xa6, 0xbf, 0x36, 0xfb, 0x24, 0xaf, 0x7d, 0x0e, 0x3e, 0xf6, 0x0c,
2718 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1707 0xe2, 0xcb, 0x69, 0x47, 0x3b, 0x54, 0xc1, 0x6f, 0x8a, 0x71, 0x6a, 0xf2,
2719 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1708 0xb8, 0x85, 0x71, 0x19, 0xb1, 0x90, 0xdb, 0x0a, 0x1d, 0xc3, 0xbc, 0xa7,
2720 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1709 0x31, 0xef, 0xa8, 0x33, 0x8e, 0xbc, 0xbd, 0x4d, 0xd7, 0xbf, 0xc5, 0x0b,
2721 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1710 0xf3, 0xec, 0xcf, 0x91, 0xed, 0xaf, 0xfc, 0x7b, 0xdc, 0x86, 0x5f, 0x16,
2722 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1711 0x57, 0x6e, 0xc6, 0x0b, 0xa0, 0x5b, 0x5a, 0xf9, 0x45, 0xbc, 0x08, 0x3d,
2723 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1712 0x13, 0x0d, 0x09, 0x7e, 0xf9, 0x33, 0x54, 0x53, 0x3d, 0x7a, 0x19, 0xf1,
2724 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1713 0xab, 0x96, 0x85, 0xbf, 0x82, 0x34, 0x45, 0x03, 0x7e, 0x4c, 0x25, 0xa5,
2725 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1714 0xcb, 0x3c, 0xa9, 0x52, 0x57, 0x3e, 0x6e, 0x23, 0xde, 0xd4, 0x54, 0x09,
2726 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1715 0xfd, 0xfd, 0x78, 0x6e, 0xee, 0xff, 0x65, 0x1c, 0x7e, 0x0b, 0x3e, 0x82,
2727 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1716 0x14, 0x3b, 0xdf, 0x8d, 0xfd, 0xbf, 0x8d, 0x7e, 0x4c, 0xc8, 0x6c, 0xf4,
2728 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1717 0x3f, 0x1b, 0xf4, 0xdf, 0x02, 0x2e, 0xbc, 0x8e, 0xe3, 0x27, 0x29, 0x53,
2729 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1718 0x79, 0x15, 0x38, 0xf0, 0xdc, 0xa4, 0x3f, 0xb7, 0x38, 0xcf, 0x3c, 0xa8,
2730 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1719 0x96, 0x16, 0x8c, 0x34, 0x15, 0xe6, 0x92, 0x34, 0x3a, 0xa7, 0xd2, 0xd8,
2731 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1720 0x9c, 0x3e, 0xd1, 0x62, 0xfb, 0x01, 0xcd, 0x84, 0x1c, 0x41, 0x5c, 0x21,
2732 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1721 0x50, 0xac, 0xa7, 0x9e, 0xa6, 0xbe, 0xd4, 0x31, 0xfa, 0x6f, 0x0f, 0xb1,
2733 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1722 0x08, 0x71, 0xa8, 0x9b, 0x64, 0x7f, 0x9f, 0x54, 0xfb, 0x4c, 0x96, 0xd1,
2734 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1723 0x87, 0xce, 0x2d, 0xce, 0xdf, 0x6b, 0x5f, 0x28, 0xf1, 0x4a, 0xea, 0x23,
2735 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1724 0xfb, 0xbe, 0x1b, 0xee, 0xab, 0x62, 0xdf, 0x34, 0xf6, 0x64, 0x1a, 0xf5,
2736 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1725 0xf8, 0xc8, 0x79, 0xb2, 0x3a, 0x81, 0x5f, 0x31, 0x83, 0x98, 0x8f, 0x7d,
2737 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1726 0xce, 0xcc, 0xb1, 0xde, 0xd3, 0x4e, 0xfc, 0x06, 0x63, 0x94, 0xc9, 0x2e,
2738 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1727 0x23, 0x27, 0x18, 0xf1, 0xf7, 0x08, 0xf2, 0x05, 0x71, 0x65, 0x10, 0xf9,
2739 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1728 0xda, 0x3b, 0xc0, 0x87, 0xe3, 0x18, 0xd3, 0x2c, 0x83, 0xde, 0x41, 0xe4,
2740 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1729 0x09, 0x9c, 0xe3, 0x7b, 0xa7, 0xec, 0x1c, 0xda, 0xcb, 0x5a, 0xbc, 0x00,
2741 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1730 0xdb, 0x16, 0x4d, 0x7a, 0x50, 0xf2, 0x7d, 0x2c, 0xcb, 0x65, 0x10, 0x72,
2742 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1731 0x62, 0xbc, 0x73, 0x90, 0x13, 0xf3, 0x68, 0x38, 0x5e, 0x6c, 0x32, 0x8f,
2743 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1732 0x08, 0xf8, 0x68, 0xb0, 0x27, 0xd9, 0xcf, 0xf3, 0xc5, 0x15, 0x0b, 0xf3,
2744 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1733 0x7e, 0xac, 0x72, 0x2e, 0x66, 0x1b, 0xdc, 0x86, 0xed, 0xac, 0x8c, 0x63,
2745 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1734 0x2e, 0xb7, 0x1f, 0xc6, 0xbe, 0x7d, 0xb9, 0x1a, 0x75, 0xe4, 0x9e, 0x86,
2746 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1735 0xdd, 0x8a, 0xf9, 0x01, 0xc4, 0x68, 0x01, 0xb9, 0xa0, 0xe7, 0x75, 0xe4,
2747 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1736 0xbf, 0x00, 0x7a, 0x98, 0x0e, 0xe8, 0xf5, 0x2c, 0xf3, 0x95, 0xfe, 0x40,
2748 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1737 0xe4, 0x5c, 0x2d, 0xdf, 0xce, 0x6b, 0x38, 0x9e, 0xf3, 0xf9, 0x88, 0x23,
2749 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1738 0x8d, 0x3d, 0x88, 0xa5, 0xfe, 0xd9, 0xd0, 0xb1, 0x71, 0x2a, 0x34, 0x3e,
2750 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1739 0x8b, 0x9c, 0x93, 0x6d, 0x67, 0x9b, 0x60, 0x9f, 0x67, 0x1a, 0x09, 0xb1,
2751 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1740 0x66, 0x8d, 0x2a, 0x0d, 0x39, 0x6c, 0xbf, 0x8a, 0xb6, 0x12, 0xb6, 0xd7,
2752 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1741 0xd1, 0xee, 0x0e, 0xdb, 0xd7, 0xd0, 0x56, 0xc3, 0xf6, 0xcf, 0xd0, 0x4e,
2753 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1742 0x86, 0xed, 0x9f, 0xa3, 0x9d, 0x0a, 0xdb, 0x37, 0xd1, 0x4e, 0x87, 0xed,
2754 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1743 0x5b, 0x68, 0x6b, 0x61, 0xfb, 0x3d, 0xb4, 0x13, 0xb0, 0x73, 0x03, 0xef,
2755 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1744 0x37, 0x50, 0x2b, 0x66, 0xf1, 0xfc, 0x57, 0xe0, 0x36, 0x08, 0xde, 0x64,
2756 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1745 0xc1, 0x8f, 0x5e, 0x8c, 0xe5, 0xd0, 0x87, 0x1c, 0xb1, 0x91, 0xc7, 0xd3,
2757 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1746 0xc1, 0x18, 0x95, 0x61, 0x7b, 0x18, 0x1f, 0x2f, 0x16, 0x1a, 0x26, 0x9e,
2758 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1747 0x6c, 0x0f, 0xba, 0x4a, 0xc2, 0x65, 0xd8, 0xb9, 0xef, 0x63, 0x72, 0xb6,
2759 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1748 0x34, 0x09, 0xdb, 0x9e, 0xa0, 0x7f, 0x74, 0xf7, 0xd3, 0x6b, 0xee, 0x38,
2760 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1749 0xe2, 0x46, 0x11, 0x71, 0xc3, 0x42, 0xdc, 0x30, 0x11, 0x37, 0x86, 0x11,
2761 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1750 0x37, 0xf2, 0x88, 0x1b, 0x39, 0xc4, 0x0d, 0xa2, 0x33, 0x7e, 0x8c, 0x4a,
2762 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1751 0x2a, 0xa8, 0x51, 0x15, 0xcb, 0x2d, 0x82, 0xbf, 0x13, 0x90, 0xcd, 0x24,
2763 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1752 0x78, 0x7d, 0x38, 0x3e, 0xd2, 0xcc, 0xc3, 0x9f, 0x69, 0xf0, 0x11, 0x69,
2764 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1753 0xf8, 0xf2, 0x1c, 0x6a, 0x13, 0xa2, 0x2b, 0xb3, 0x1a, 0xfc, 0x8f, 0x47,
2765 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1754 0x45, 0xc4, 0xfe, 0x69, 0x15, 0xb8, 0x19, 0xbb, 0x7c, 0x9b, 0x91, 0xcc,
2766 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1755 0x2f, 0xf6, 0x50, 0xd7, 0x20, 0xe8, 0x39, 0x8b, 0xbe, 0x14, 0xf6, 0x63,
2767 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1756 0xbe, 0xde, 0x2a, 0xd9, 0x86, 0x46, 0x0b, 0x6e, 0x1c, 0xfe, 0x9f, 0xdf,
2768 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1757 0xe3, 0xcc, 0xe3, 0x43, 0x4f, 0x19, 0x4c, 0x03, 0xea, 0x3c, 0x23, 0xad,
2769 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1758 0x14, 0x1c, 0x81, 0x24, 0x93, 0x9f, 0xed, 0x1c, 0xe2, 0xcf, 0x90, 0x43,
2770 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1759 0x74, 0x41, 0x06, 0x55, 0xc4, 0x05, 0x9d, 0xf3, 0x0b, 0xe8, 0xf2, 0x27,
2771 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1760 0xcd, 0xff, 0x1e, 0xe6, 0xef, 0xc5, 0xd9, 0x3c, 0x8f, 0xcf, 0x39, 0x85,
2772 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1761 0xfa, 0xc1, 0xea, 0x91, 0x68, 0x3d, 0x25, 0xa1, 0x9e, 0x28, 0xd0, 0x59,
2773 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1762 0x2a, 0x00, 0x9f, 0x82, 0xdb, 0xbe, 0x07, 0xb0, 0x0e, 0x05, 0xfe, 0x6c,
2774 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1763 0xe2, 0xd0, 0xb7, 0x0d, 0x0b, 0xeb, 0x18, 0x3f, 0xd6, 0x5b, 0xe0, 0xbe,
2775 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1764 0xb1, 0xe7, 0x05, 0xec, 0xf9, 0x4f, 0x49, 0xea, 0x9a, 0x0c, 0xfc, 0x91,
2776 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1765 0x5f, 0xf3, 0xca, 0xc2, 0x48, 0xf3, 0x2c, 0xf8, 0xd3, 0x87, 0x1a, 0x05,
2777 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1766 0x7e, 0xa4, 0xd4, 0x02, 0x9f, 0xda, 0xf3, 0x5f, 0xc1, 0x7c, 0x7e, 0xf7,
2778 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1767 0xef, 0x0e, 0x4a, 0xd2, 0xea, 0x12, 0xe6, 0x69, 0xac, 0x3f, 0x25, 0xb9,
2779 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1768 0xff, 0x86, 0xf7, 0xa2, 0x91, 0xa7, 0x5d, 0xab, 0xbc, 0x2e, 0x4b, 0x7d,
2780 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1769 0xab, 0x37, 0xbc, 0x9a, 0xa3, 0xd1, 0x62, 0x93, 0xc0, 0xab, 0xf8, 0x6d,
2781 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1770 0x8b, 0xf4, 0x35, 0x12, 0xf5, 0x59, 0x0b, 0x7a, 0x5a, 0x1c, 0x12, 0xc9,
2782 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1771 0x1e, 0xea, 0x84, 0x8f, 0x32, 0x68, 0x09, 0x7c, 0xdf, 0x35, 0x63, 0xd1,
2783 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1772 0x13, 0x43, 0xed, 0x7c, 0x10, 0x51, 0x0f, 0xb8, 0xee, 0x5a, 0xd5, 0x30,
2784 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1773 0x87, 0x73, 0x71, 0xa6, 0x45, 0x03, 0x2f, 0x85, 0x60, 0x8d, 0x1f, 0xb3,
2785 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1774 0xb8, 0x8e, 0x05, 0xdf, 0xdc, 0xb5, 0xd2, 0xd5, 0x19, 0xd4, 0x1a, 0x90,
2786 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1775 0xf3, 0xae, 0x19, 0xae, 0x85, 0xb6, 0x81, 0x2f, 0x31, 0xd8, 0x06, 0xe7,
2787 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1776 0xf1, 0x08, 0xf4, 0xf0, 0x87, 0x27, 0xe0, 0xf1, 0x6b, 0xcd, 0x13, 0xd0,
2788 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1777 0xfb, 0x2e, 0x2a, 0xcb, 0x3e, 0x11, 0x9f, 0xc0, 0xe3, 0xff, 0xe4, 0xbc,
2789 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1778 0x0e, 0xf3, 0xbf, 0x4b, 0xc5, 0xd9, 0x2e, 0xec, 0xb5, 0x9b, 0xa6, 0x93,
2790 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1779 0x8c, 0x9b, 0x3e, 0x8c, 0x41, 0x2d, 0x06, 0x7e, 0xc6, 0xcd, 0x8f, 0xe6,
2791 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1780 0x7d, 0x6b, 0xa5, 0x2b, 0x33, 0x6b, 0xa5, 0x6b, 0xa0, 0xbf, 0x6e, 0x70,
2792 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1781 0x8d, 0x0c, 0x5d, 0x6a, 0x70, 0x6d, 0xcf, 0x79, 0xd1, 0x18, 0x74, 0x64,
2793 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1782 0xbf, 0x5f, 0x33, 0xdb, 0x8b, 0x39, 0xea, 0x3b, 0x47, 0xaa, 0x68, 0x96,
2794 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1783 0x84, 0x31, 0xe4, 0x45, 0x23, 0xee, 0x49, 0x7f, 0xee, 0x99, 0x06, 0xd7,
2795 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1784 0x2b, 0x18, 0x5b, 0x61, 0x5d, 0x18, 0x03, 0x3e, 0x49, 0xba, 0xe8, 0xb2,
2796 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1785 0x4f, 0x0a, 0xec, 0x78, 0x0c, 0xfc, 0x5a, 0xf0, 0xe9, 0x4a, 0x71, 0x1c,
2797 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1786 0x47, 0xbe, 0xc1, 0xf2, 0xf9, 0x21, 0xc7, 0x41, 0xa1, 0xd3, 0x6c, 0xfb,
2798 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1787 0xdb, 0x89, 0x5e, 0xe6, 0x59, 0xa1, 0x01, 0xdf, 0x3f, 0x34, 0x11, 0xe6,
2799 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1788 0x1c, 0x7f, 0x8f, 0x39, 0x8c, 0x3b, 0xcd, 0x4a, 0x26, 0xce, 0xc8, 0x33,
2800 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1789 0xcf, 0x38, 0xa7, 0xe4, 0x7d, 0xc1, 0x5b, 0xf0, 0x7d, 0x53, 0x6e, 0xe9,
2801 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1790 0xc3, 0x74, 0x33, 0x46, 0x95, 0x59, 0xf0, 0x2e, 0x8f, 0x27, 0x9c, 0x6b,
2802 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1791 0x1d, 0x7c, 0x03, 0x2d, 0xd5, 0x20, 0x9f, 0x3d, 0xc1, 0x31, 0x0d, 0xfe,
2803 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1792 0x06, 0x36, 0xcd, 0x31, 0x6b, 0xe3, 0xde, 0xc9, 0xf7, 0x25, 0x32, 0x19,
2804 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1793 0x41, 0xce, 0x2a, 0xe2, 0x2c, 0x3b, 0xcf, 0x7e, 0x10, 0xf8, 0xb8, 0xdf,
2805 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1794 0xa5, 0xfa, 0x2c, 0xd3, 0x05, 0x1b, 0x4f, 0xb2, 0x2e, 0xfe, 0x7f, 0xf9,
2806 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1795 0x38, 0xba, 0x45, 0x3e, 0x8e, 0x6e, 0x99, 0x8f, 0x12, 0xf8, 0x58, 0xd9,
2807 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1796 0xe0, 0xa3, 0x82, 0x3d, 0xf8, 0x3e, 0xe1, 0xab, 0x64, 0x4d, 0x3c, 0x02,
2808 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1797 0x3f, 0x0c, 0xff, 0xd1, 0x3c, 0x05, 0x9f, 0x70, 0x52, 0xb8, 0xda, 0xf0,
2809 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1798 0x68, 0x1c, 0xb5, 0xb2, 0x74, 0xff, 0x66, 0xfa, 0x33, 0xa0, 0xff, 0xcf,
2810 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1799 0x31, 0x5e, 0xa5, 0x6b, 0xb3, 0x94, 0x56, 0xa8, 0x7d, 0x2e, 0xed, 0x92,
2811 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1800 0xe9, 0x3b, 0x74, 0x75, 0xb6, 0x8b, 0xae, 0xcf, 0x66, 0xc0, 0xeb, 0x2c,
2812 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1801 0xc5, 0x7a, 0x32, 0xc3, 0x15, 0x18, 0xf1, 0xcf, 0x5a, 0xba, 0xc5, 0xba,
2813 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1802 0xf8, 0xfb, 0xf3, 0x82, 0xf9, 0x70, 0xd0, 0xe7, 0xc3, 0xd8, 0x47, 0xf8,
2814 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1803 0x30, 0x7e, 0x4f, 0x3e, 0x1c, 0xfc, 0x18, 0x1f, 0xc6, 0x3f, 0xc6, 0x07,
2815 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1804 0xe6, 0x01, 0xf3, 0xe2, 0xd1, 0xde, 0xf0, 0xff, 0x1f, 0x7d, 0x82, 0x7d,
2816 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1805 0x7c, 0x09, 0x74, 0x22, 0xa7, 0xd8, 0x19, 0xe4, 0x50, 0x9c, 0x63, 0xd5,
2817 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1806 0x0c, 0xe6, 0x57, 0x60, 0xbf, 0x32, 0x72, 0xea, 0x23, 0xa1, 0xfd, 0x16,
2818 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1807 0x1c, 0xe8, 0x65, 0x23, 0xe6, 0xdb, 0xaf, 0x64, 0xe6, 0xe1, 0x03, 0xaa,
2819 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1808 0xa5, 0x96, 0xc3, 0xfe, 0x07, 0x6d, 0x87, 0x79, 0xda, 0x0b, 0x5a, 0x12,
2820 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1809 0x54, 0x99, 0x54, 0x10, 0x5f, 0x87, 0xa1, 0xb7, 0x71, 0xdf, 0x07, 0x4a,
2821 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1810 0x26, 0xeb, 0xe1, 0x7e, 0xcc, 0x3f, 0x1c, 0xe6, 0x45, 0x88, 0x73, 0x38,
2822 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1811 0xa3, 0xd6, 0x38, 0x0d, 0xfc, 0xf8, 0x9c, 0x6a, 0xa9, 0xec, 0xf0, 0x9a,
2823 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1812 0x34, 0x62, 0x21, 0x3f, 0x37, 0xeb, 0xb7, 0xaf, 0xef, 0xf7, 0xd2, 0x71,
2824 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1813 0xe8, 0x26, 0xeb, 0xb4, 0x82, 0xdc, 0x78, 0x02, 0xf1, 0xc5, 0xd7, 0xd3,
2825 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1814 0xec, 0x02, 0xb1, 0xdf, 0x7f, 0x06, 0x75, 0xd1, 0x61, 0xfc, 0x34, 0x1a,
2826 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1815 0x71, 0x03, 0x9b, 0x5a, 0xf2, 0xcf, 0xfc, 0xb0, 0x4f, 0xaa, 0x39, 0xeb,
2827 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1816 0xc8, 0xdf, 0x0d, 0xec, 0xcb, 0xe7, 0x56, 0xc1, 0x1b, 0x09, 0xe7, 0x72,
2828 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1817 0x5f, 0x37, 0xe2, 0x00, 0xf8, 0xe4, 0xfe, 0x07, 0xfa, 0x97, 0xe0, 0x1f,
2829 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1818 0x39, 0x2f, 0x68, 0xe3, 0x8e, 0x1c, 0xc2, 0xe1, 0x78, 0x9d, 0x07, 0xcd,
2830 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1819 0x9c, 0x63, 0x73, 0x2e, 0x81, 0xfc, 0x63, 0xe9, 0x4d, 0xf4, 0x0d, 0xd3,
2831 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1820 0xe9, 0xa1, 0x2c, 0xe4, 0xc3, 0x7d, 0x0f, 0x84, 0x7d, 0x3c, 0x8f, 0x94,
2832 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1821 0x07, 0x4d, 0xfd, 0x07, 0x55, 0xdf, 0xaf, 0x43, 0x0f, 0x51, 0xf7, 0xd5,
2833 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1822 0x96, 0x90, 0x63, 0x00, 0xa7, 0xca, 0x6a, 0x16, 0xb9, 0x3c, 0xdf, 0xab,
2834 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1823 0xe9, 0x97, 0x91, 0x07, 0x83, 0x27, 0x0a, 0xf5, 0x1a, 0xa5, 0xd0, 0x0f,
2835 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1824 0xe7, 0x40, 0x1f, 0xdf, 0x3d, 0xf5, 0x21, 0xf7, 0x91, 0xc0, 0x08, 0xd8,
2836 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1825 0xe9, 0xaa, 0x44, 0x7b, 0xe5, 0x01, 0xb5, 0x46, 0xff, 0x80, 0xb9, 0x32,
2837 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1826 0x95, 0x57, 0x39, 0x87, 0x90, 0xe9, 0xc8, 0x2a, 0xd1, 0x5b, 0x33, 0xec,
2838 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1827 0x97, 0x19, 0xd8, 0x2f, 0xb3, 0x7f, 0x7d, 0xd0, 0x1f, 0x7b, 0x6b, 0x06,
2839 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1828 0x35, 0xf8, 0xcc, 0x00, 0xc7, 0xb0, 0x75, 0x11, 0xbc, 0x44, 0xee, 0xc3,
2840 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1829 0xf9, 0xf9, 0x5d, 0xee, 0x98, 0xda, 0xf7, 0x4b, 0x0a, 0x55, 0x66, 0xf8,
2841 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1830 0x6e, 0x49, 0xc6, 0xf9, 0x5c, 0x5b, 0x6c, 0x03, 0x7e, 0x02, 0xa1, 0xee,
2842 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1831 0x12, 0x38, 0xa6, 0x09, 0xd0, 0xa1, 0x5d, 0x90, 0x3d, 0xf8, 0x1f, 0xb6,
2843 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1832 0xdb, 0xfa, 0xf4, 0x2f, 0xd0, 0x27, 0x9e, 0x27, 0x6f, 0xc2, 0x25, 0x33,
2844 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1833 0x6b, 0x8b, 0x1c, 0x1f, 0x3e, 0x0d, 0xdb, 0xb3, 0xe2, 0x63, 0xcd, 0x0e,
2845 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1834 0x6a, 0xf5, 0xb2, 0x3d, 0xb0, 0x5e, 0x5c, 0x66, 0x9d, 0xc0, 0x19, 0xd0,
2846 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1835 0xa1, 0x19, 0xae, 0xe7, 0x65, 0xcc, 0xbb, 0x2f, 0x9c, 0xc7, 0xfc, 0xfe,
2847 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1836 0x1e, 0x4d, 0x0f, 0xa9, 0x42, 0x59, 0x0d, 0xe2, 0x45, 0x6d, 0xa8, 0x03,
2848 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1837 0x63, 0x22, 0x1d, 0x7c, 0x38, 0x8f, 0xb5, 0x9c, 0x53, 0xc5, 0x85, 0xc0,
2849 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1838 0x6f, 0x71, 0x1f, 0xdf, 0xd7, 0xa9, 0x54, 0xbe, 0xd4, 0x4b, 0x95, 0x4b,
2850 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1839 0x0a, 0xf8, 0x02, 0x44, 0x17, 0x82, 0x7d, 0xd8, 0x17, 0x1c, 0x87, 0xdc,
2851 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1840 0xc4, 0x73, 0x0a, 0xc5, 0xce, 0x21, 0x87, 0xbc, 0xd0, 0x45, 0x1d, 0x17,
2852 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1841 0xfa, 0x49, 0xba, 0xa0, 0x73, 0x7e, 0xa8, 0x9d, 0x81, 0x0c, 0x8f, 0x50,
2853 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1842 0x9e, 0x9e, 0x73, 0x07, 0x39, 0xc7, 0xc3, 0x39, 0x5c, 0xe7, 0x25, 0x49,
2854 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1843 0x42, 0xf2, 0x2f, 0xbe, 0x68, 0xd1, 0x8b, 0x43, 0xc0, 0x2b, 0x8f, 0xf6,
2855 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1844 0x8f, 0x91, 0xc7, 0xbb, 0x23, 0xf7, 0x71, 0xcc, 0x96, 0xcd, 0x3e, 0xc8,
2856 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1845 0x16, 0x74, 0xe5, 0x1e, 0xf2, 0xef, 0x44, 0x5f, 0x1c, 0x62, 0x7a, 0x34,
2857 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1846 0xd0, 0x52, 0x87, 0xae, 0xf3, 0x3d, 0x57, 0x17, 0xd9, 0x32, 0xeb, 0x32,
2858 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1847 0xf2, 0xaa, 0x0b, 0x75, 0x9a, 0x6a, 0xe8, 0x90, 0x59, 0x1f, 0xf4, 0x02,
2859 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1848 0x32, 0x4b, 0x73, 0x3f, 0xef, 0x2d, 0x84, 0xfb, 0xde, 0xd1, 0xf7, 0x17,
2860 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1849 0xef, 0xad, 0xef, 0x3e, 0xd4, 0x9b, 0x8f, 0xc0, 0x67, 0xa3, 0x2e, 0x32,
2861 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1850 0xe0, 0xd3, 0x55, 0xe4, 0x72, 0x06, 0xbf, 0x07, 0x77, 0x95, 0x15, 0xe4,
2862 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1851 0x85, 0xfc, 0x5e, 0x6b, 0xdd, 0xcd, 0x77, 0x07, 0xf6, 0x7d, 0x06, 0x3c,
2863 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1852 0xba, 0x32, 0xf7, 0x00, 0x5d, 0x9d, 0x53, 0xe8, 0x5a, 0x43, 0xcf, 0x16,
2864 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1853 0xa8, 0x83, 0xaa, 0xc9, 0x34, 0x5d, 0x5f, 0x6a, 0xe7, 0x93, 0x22, 0xf4,
2865 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1854 0xc4, 0x22, 0xce, 0xcd, 0xaf, 0x2c, 0x55, 0x4b, 0x37, 0x76, 0xa7, 0x49,
2866 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1855 0x7e, 0x09, 0xb6, 0xfd, 0x92, 0xae, 0xd5, 0xc0, 0xe7, 0xba, 0xe1, 0xa2,
2867 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1856 0x56, 0xe3, 0x3a, 0x32, 0x05, 0xbb, 0xd3, 0x53, 0x2d, 0xca, 0x90, 0xb4,
2868 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1857 0xa0, 0xd0, 0xaf, 0x66, 0x74, 0x8d, 0x75, 0xee, 0xa2, 0x81, 0x7e, 0x37,
2869 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1858 0x7e, 0x7b, 0x3d, 0xd0, 0x43, 0xf4, 0xf5, 0xa3, 0xbe, 0xd5, 0xb3, 0x9a,
2870 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1859 0xd8, 0x4d, 0x6f, 0x43, 0x27, 0xca, 0x7e, 0xdf, 0x47, 0xf7, 0xbc, 0x1e,
2871 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1860 0xee, 0x59, 0x2d, 0x5d, 0xe1, 0x3a, 0x68, 0x86, 0x75, 0xbe, 0x17, 0xfe,
2872 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1861 0x03, 0xef, 0x6e, 0x07, 0x95, 0x27, 0x11, 0xa3, 0x66, 0x1e, 0xa5, 0xc2,
2873 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1862 0x90, 0x18, 0xd0, 0xed, 0xf3, 0x82, 0xfb, 0xf8, 0x7e, 0xb2, 0x76, 0x1f,
2874 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1863 0xdb, 0xb2, 0xb8, 0x0a, 0xbd, 0x3a, 0xc8, 0x7a, 0x80, 0xdc, 0x0e, 0x39,
2875 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1864 0x04, 0xfb, 0x4e, 0x09, 0x39, 0x44, 0xc1, 0x0d, 0x74, 0xa3, 0x75, 0x30,
2876 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1865 0x49, 0xc7, 0x5e, 0x62, 0x19, 0x61, 0x6c, 0x43, 0xef, 0x36, 0xee, 0xc4,
2877 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1866 0x31, 0x66, 0xd0, 0xf1, 0xef, 0xb7, 0x73, 0x4a, 0xb6, 0xbd, 0x34, 0xe4,
2878 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1867 0xa1, 0xa3, 0xf6, 0xe8, 0x53, 0x2b, 0xbe, 0x4f, 0x81, 0x4e, 0xa4, 0x02,
2879 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1868 0x19, 0xd4, 0x30, 0x36, 0xed, 0x4e, 0xc2, 0x27, 0xc6, 0xe8, 0xe6, 0xa4,
2880 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1869 0x05, 0x9d, 0x68, 0x01, 0x87, 0xc3, 0x71, 0xbe, 0x4b, 0xb8, 0x39, 0x59,
2881 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1870 0xc4, 0xfb, 0x61, 0x3f, 0xf7, 0x97, 0xf6, 0x40, 0x97, 0xdc, 0x07, 0xc2,
2882 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1871 0xfc, 0x9c, 0xcf, 0xd3, 0x84, 0xda, 0xac, 0x2e, 0x4c, 0xcf, 0x7a, 0x34,
2883 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1872 0x9a, 0xeb, 0x4b, 0x5d, 0xa5, 0x4e, 0xff, 0xce, 0xd8, 0xf7, 0x9b, 0xfe,
2884 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1873 0x9c, 0x5d, 0x18, 0xff, 0x00, 0x3a, 0x85, 0x27, 0xe2, 0xf5, 0xe9, 0x66,
2885 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1874 0x35, 0xd5, 0x41, 0xac, 0x53, 0x24, 0x2c, 0x18, 0xec, 0x3b, 0x04, 0xba,
2886 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1875 0xea, 0xdf, 0x47, 0x13, 0x15, 0x9d, 0xd7, 0x99, 0x6e, 0x61, 0xb1, 0xc5,
2887 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1876 0x6b, 0x58, 0xce, 0xbc, 0x46, 0xa2, 0x9b, 0x49, 0xd8, 0xe5, 0x9e, 0x3d,
2888 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1877 0x7e, 0xbd, 0xf8, 0xf8, 0x10, 0xe3, 0xda, 0x0d, 0x99, 0x42, 0xbf, 0x50,
2889 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1878 0xdb, 0x94, 0x83, 0xbe, 0x59, 0xae, 0x4d, 0xa7, 0xf9, 0xde, 0x23, 0xef,
2890 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1879 0xeb, 0x5a, 0xa8, 0x1f, 0x1f, 0xd7, 0xb5, 0xe7, 0xb0, 0xf6, 0x2d, 0xf6,
2891 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1880 0xab, 0x90, 0x75, 0xe0, 0x23, 0xbe, 0x41, 0x6f, 0xcd, 0x55, 0xb3, 0xfc,
2892 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1881 0xcd, 0xa3, 0x35, 0x21, 0xa0, 0x16, 0x3f, 0x4e, 0x6f, 0xcf, 0x3d, 0x4b,
2893 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1882 0xbf, 0x9c, 0x65, 0xdd, 0x31, 0x68, 0x14, 0xfa, 0x74, 0x94, 0xe4, 0xec,
2894 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1883 0x69, 0x1a, 0x50, 0xaf, 0xfb, 0xb5, 0x8d, 0x9e, 0xf3, 0x6b, 0x3a, 0x33,
2895 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1884 0x4b, 0xc5, 0xc6, 0x40, 0xea, 0x1a, 0xfa, 0xca, 0x93, 0xba, 0xb6, 0x8e,
2896 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1885 0xdc, 0xa3, 0xd0, 0xfc, 0x80, 0xef, 0x6c, 0xb2, 0x35, 0xd8, 0xde, 0x22,
2897 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1886 0x6a, 0x9b, 0xb7, 0x9d, 0xbb, 0xe9, 0x2c, 0xd7, 0x56, 0x81, 0xff, 0x5e,
2898 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1887 0x33, 0x50, 0x63, 0xac, 0xaa, 0xa1, 0x0e, 0x31, 0x70, 0x9d, 0xc1, 0xf1,
2899 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1888 0x07, 0x4f, 0x37, 0x06, 0x9f, 0xb2, 0x1f, 0x7c, 0x67, 0xd9, 0x42, 0xfe,
2900 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1889 0xab, 0xfc, 0x8d, 0x0a, 0xf2, 0x5f, 0x5d, 0xfe, 0x40, 0xeb, 0x65, 0x3f,
2901 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1890 0x6b, 0x80, 0x96, 0x41, 0x3a, 0x33, 0xcf, 0xf2, 0x47, 0xec, 0xf5, 0xed,
2902 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1891 0x34, 0x0d, 0xfe, 0x72, 0x7c, 0x19, 0xa4, 0x5f, 0x2d, 0x15, 0xfd, 0xfb,
2903 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1892 0x6b, 0x1b, 0xb9, 0xd6, 0x11, 0x67, 0x12, 0xf5, 0xfa, 0x77, 0x40, 0x2f,
2904 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1893 0xce, 0x1e, 0xda, 0x8d, 0xa7, 0x0a, 0x9b, 0xdc, 0x72, 0x9e, 0x23, 0x07,
2905 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1894 0x79, 0xce, 0xde, 0x2d, 0xe6, 0x39, 0x7b, 0xb7, 0x92, 0xe7, 0xc8, 0x9d,
2906 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1895 0xe0, 0xab, 0xd6, 0xbb, 0x65, 0xdc, 0xa4, 0x00, 0xb7, 0x03, 0x5b, 0xc4,
2907 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1896 0xed, 0xc0, 0x56, 0x70, 0x93, 0x3a, 0xcd, 0xbf, 0x40, 0x8c, 0x35, 0x10,
2908 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1897 0xdb, 0xe0, 0xd7, 0x86, 0xfa, 0x59, 0x7f, 0x80, 0xa3, 0x8f, 0xeb, 0xef,
2909 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1898 0x8b, 0xa7, 0x18, 0xe0, 0xf9, 0xd8, 0x16, 0xf1, 0x7c, 0x6c, 0x2b, 0x78,
2910 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1899 0x8a, 0x9d, 0x26, 0xe3, 0x28, 0xc3, 0xd7, 0x70, 0x6d, 0x83, 0xd8, 0x3c,
2911 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1900 0x24, 0x87, 0xba, 0x2e, 0x87, 0x75, 0x0e, 0x03, 0x7c, 0x50, 0xaf, 0x46,
2912 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1901 0x4b, 0x4c, 0xcb, 0x46, 0xdf, 0x9d, 0x3a, 0x4b, 0x32, 0x5b, 0xa5, 0x4a,
2913 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1902 0x83, 0xef, 0x95, 0xfb, 0xb0, 0x0f, 0xf7, 0xf1, 0x37, 0x2a, 0x8b, 0x64,
2914 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1903 0xc4, 0xf7, 0xe7, 0x9a, 0x77, 0xa7, 0xf5, 0x2a, 0x68, 0x9d, 0x0a, 0x69,
2915 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1904 0xad, 0xf8, 0xb9, 0xe0, 0xbe, 0x4d, 0xb9, 0x60, 0x40, 0xe3, 0x08, 0x68,
2916 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1905 0x2c, 0x86, 0x34, 0x3e, 0xdd, 0x60, 0xda, 0xf6, 0xf9, 0xb4, 0x2d, 0x6d,
2917 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1906 0xa2, 0x6d, 0xe4, 0x9e, 0xf9, 0x1f, 0xe3, 0x81, 0x5a, 0x1a, 0xb9, 0xd7,
2918 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1907 0x6b, 0x4d, 0xd4, 0xd2, 0x4d, 0xd4, 0xd2, 0xd0, 0xf7, 0x57, 0x9b, 0xa8,
2919 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1908 0xa5, 0x9b, 0xa8, 0xa5, 0x61, 0x07, 0xaf, 0xc0, 0x56, 0x82, 0x3b, 0xdc,
2920 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1909 0x12, 0x71, 0x0d, 0xee, 0xd7, 0xe3, 0x14, 0xe4, 0x39, 0x05, 0xc4, 0xf0,
2921 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1910 0xa3, 0xc8, 0xf1, 0xd8, 0x6e, 0x4f, 0x13, 0xc7, 0x04, 0x3d, 0x87, 0x9a,
2922 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1911 0x2f, 0x5b, 0x25, 0x33, 0x5e, 0x9c, 0x1f, 0x50, 0x97, 0x02, 0xfb, 0xd6,
2923 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1912 0x5a, 0xc4, 0x71, 0x70, 0x20, 0x85, 0x08, 0xa9, 0xb2, 0x5f, 0xb0, 0x73,
2924 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1913 0x4c, 0xe7, 0x76, 0xf0, 0x10, 0xbe, 0xdb, 0x60, 0x1f, 0xc6, 0xbe, 0xb4,
2925 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1914 0x4e, 0x0b, 0x8d, 0xf0, 0x1b, 0x9a, 0xcc, 0xfd, 0xfc, 0xce, 0x31, 0xb7,
2926 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1915 0xcf, 0xf7, 0x69, 0x76, 0xb6, 0x0f, 0x71, 0x80, 0xfb, 0x15, 0xf8, 0x35,
2927 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1916 0xe8, 0xca, 0x52, 0x1b, 0x17, 0x19, 0xeb, 0x55, 0xaa, 0xcf, 0x07, 0x31,
2928 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1917 0x7c, 0xca, 0xe0, 0x38, 0x87, 0xf8, 0xbe, 0xc4, 0xdf, 0xb0, 0x10, 0xeb,
2929 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1918 0x97, 0xae, 0x68, 0x32, 0x6a, 0xc7, 0x3a, 0x7f, 0xa3, 0x1d, 0xec, 0xc3,
2930 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1919 0xf9, 0x1d, 0xfe, 0x1d, 0xed, 0x51, 0xff, 0xae, 0xcd, 0xa0, 0x23, 0xad,
2931 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1920 0x80, 0x16, 0xdb, 0xc8, 0xd0, 0xc8, 0x2c, 0xdf, 0x35, 0x51, 0x8f, 0x68,
2932 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1921 0xca, 0x54, 0x75, 0xf8, 0x7e, 0x68, 0xe3, 0xbb, 0x49, 0x76, 0x91, 0xeb,
2933 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1922 0x4f, 0x23, 0xb8, 0xff, 0x3c, 0xed, 0xbc, 0xc9, 0xf7, 0x9f, 0xe1, 0x3a,
2934 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1923 0x8d, 0xde, 0x70, 0x33, 0x34, 0x8e, 0xf8, 0x5a, 0x6c, 0x68, 0xf0, 0x6f,
2935 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1924 0xbe, 0x3c, 0x39, 0xa7, 0xad, 0xc6, 0x42, 0x99, 0x8e, 0x84, 0x32, 0xad,
2936 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1925 0x34, 0xd6, 0x80, 0xdf, 0x0d, 0xef, 0x8f, 0x43, 0x99, 0xee, 0x3a, 0x47,
2937 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1926 0xda, 0xd5, 0x1c, 0xcb, 0x95, 0x65, 0x19, 0xc8, 0x75, 0x7c, 0xb1, 0x24,
2938 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1927 0x14, 0x21, 0xd3, 0x51, 0x5f, 0xa6, 0x32, 0xc7, 0x05, 0xec, 0x95, 0x83,
2939 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1928 0xfc, 0xd9, 0x8f, 0xe1, 0xe9, 0xb0, 0x8c, 0xb9, 0xde, 0xe0, 0x58, 0x98,
2940 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1929 0xa4, 0x4b, 0x9b, 0xe4, 0x5c, 0xbc, 0xa7, 0x0e, 0xe7, 0xa9, 0xff, 0x9c,
2941 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1930 0x16, 0xde, 0x9b, 0x66, 0x21, 0xc7, 0x76, 0x2e, 0xf6, 0x23, 0x81, 0x8c,
2942 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1931 0xf6, 0x9d, 0x6e, 0xbb, 0xef, 0xe5, 0x4d, 0x7d, 0xed, 0x67, 0x9b, 0x56,
2943 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1932 0xc4, 0xb7, 0x0d, 0xde, 0xf3, 0x1d, 0xe4, 0x9d, 0x7e, 0xc9, 0x1f, 0x53,
2944 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1933 0x31, 0xd6, 0x4b, 0x85, 0x25, 0x83, 0xac, 0x16, 0xcf, 0x91, 0x49, 0x34,
2945 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1934 0xda, 0x72, 0xea, 0xa4, 0xf5, 0x30, 0xc6, 0x2d, 0x34, 0x3c, 0xef, 0xa7,
2946 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1935 0xd0, 0x9d, 0x8b, 0x5c, 0x77, 0x3b, 0xbf, 0xf1, 0xd6, 0x93, 0xc8, 0x21,
2947 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1936 0x37, 0xce, 0xfc, 0xe6, 0xfd, 0xd4, 0xa5, 0xab, 0x88, 0x09, 0x74, 0xc6,
2948 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1937 0x09, 0x51, 0x22, 0x1e, 0xe7, 0x3e, 0xfe, 0x06, 0xef, 0x79, 0x17, 0x8d,
2949 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1938 0x3b, 0x78, 0x75, 0x99, 0xc7, 0x69, 0xdf, 0x39, 0xf6, 0xff, 0x3f, 0xd0,
2950 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1939 0x2e, 0x1a, 0xd6, 0x9e, 0x38, 0xf2, 0xe7, 0xeb, 0xc4, 0xb1, 0x4f, 0x4e,
2951 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1940 0x14, 0x9b, 0xba, 0x7a, 0x09, 0x6b, 0x8b, 0x8e, 0xc2, 0xdf, 0xd6, 0xf9,
2952 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1941 0xfb, 0xa8, 0x76, 0x89, 0xda, 0xf7, 0x65, 0x90, 0xa7, 0xa3, 0xf2, 0x77,
2953 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1942 0x52, 0xb5, 0x8a, 0xd8, 0x52, 0x70, 0x92, 0x98, 0xaf, 0x62, 0x2e, 0xc7,
2954 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1943 0x05, 0x8f, 0x14, 0xd8, 0x50, 0xc1, 0x49, 0x27, 0xc6, 0x9a, 0x9e, 0xa7,
2955 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1944 0x7c, 0x5e, 0xa0, 0x87, 0x32, 0x29, 0x1a, 0x73, 0xf8, 0xfe, 0xf7, 0x9b,
2956 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1945 0xf4, 0x36, 0xec, 0xac, 0x78, 0x9e, 0x6b, 0x26, 0xf6, 0x29, 0x78, 0x77,
2957 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1946 0xf8, 0xbe, 0xea, 0x14, 0x3d, 0xb4, 0x47, 0xcf, 0x5e, 0x22, 0xe0, 0xb3,
2958 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1947 0x42, 0xfd, 0x48, 0x72, 0x53, 0xc7, 0xfd, 0xef, 0x6d, 0x8c, 0x6b, 0x9a,
2959 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1948 0x96, 0xc0, 0x1b, 0xa7, 0x99, 0xa4, 0x95, 0x66, 0x8a, 0x56, 0xa1, 0x1f,
2960 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1949 0xdb, 0xcc, 0x32, 0x7d, 0x03, 0x78, 0x2b, 0x66, 0x95, 0x94, 0x8c, 0xb5,
2961 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1950 0xaf, 0x0b, 0x78, 0x67, 0x05, 0x3d, 0x15, 0x17, 0x18, 0x77, 0x5d, 0x2d,
2962 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1951 0x03, 0x6f, 0xd6, 0xd1, 0x51, 0xa7, 0x9b, 0x8e, 0x61, 0xed, 0x7e, 0xe4,
2963 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1952 0x1f, 0xdf, 0x72, 0xa8, 0x2c, 0x99, 0x29, 0x3a, 0x80, 0xf3, 0x8e, 0x36,
2964 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1953 0x38, 0x57, 0x3b, 0x02, 0x5f, 0x23, 0xd0, 0xa3, 0x19, 0x8f, 0x1e, 0xdd,
2965 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1954 0xa3, 0x5b, 0x71, 0x01, 0x7b, 0xae, 0xb0, 0x9e, 0xa0, 0xdf, 0x09, 0xce,
2966 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1955 0x8d, 0xad, 0xf8, 0xba, 0x08, 0x7f, 0xfa, 0x0c, 0x65, 0xce, 0xad, 0xe5,
2967 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1956 0xa6, 0x90, 0x9f, 0x8f, 0x36, 0xe9, 0x8b, 0x31, 0x9c, 0xf7, 0x36, 0xf8,
2968 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1957 0x34, 0xea, 0xc8, 0x02, 0xf3, 0xe9, 0x58, 0xc0, 0x27, 0x8c, 0xf1, 0xb7,
2969 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1958 0x23, 0xce, 0xd1, 0xf8, 0xec, 0x13, 0x74, 0xb6, 0xc1, 0x77, 0xdd, 0x27,
2970 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1959 0xe8, 0x4a, 0xe3, 0x11, 0xba, 0x98, 0xe3, 0x5c, 0x07, 0xfb, 0xf8, 0x67,
2971 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1960 0xa0, 0xcf, 0x3f, 0xa3, 0x9b, 0x8e, 0xfb, 0x72, 0xfa, 0x3f, 0xc3, 0x06,
2972 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1961 0xd0, 0x70, 0x4c, 0x57, 0x00, 0x00, 0x00 };
2973 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2974 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2975 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2976 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2977 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2978 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2979 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2980 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2981 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2982 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2983 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2984 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2985 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2986 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2987 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2988 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2989 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2990 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2991 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2992 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2993 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2994 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2995 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2996 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2997 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2998 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2999 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3000 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3001 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3002 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3003 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3004 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3005 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3006 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3007 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3008 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3009 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3010 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3011 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3012 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3013 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3014 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3015 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3016 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3017 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3018 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3019 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3020 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3021 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3022 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3023 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3024 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3025 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3026 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3027 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3028 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3029 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3030 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3031 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3032 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3033 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3034 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3035 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3036 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3037 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3038 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3039 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3040 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3041 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3042 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3043 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3044 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3045 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3046 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3047 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3048 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3049 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3050 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3051 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3052 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3053 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3054 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3055 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3056 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3057 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3058 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3059 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3060 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3061 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3062 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3063 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3064 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3065 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3066 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3067 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3068 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3069 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3070 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3071 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3072 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3073 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3074 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3075 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3076 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3077 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3078 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3079 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3080 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3081 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3082 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3083 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3084 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3085 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3086 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3087 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3088 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3089 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3090 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3091 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3092 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3093 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3094 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3095 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3096 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3097 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3098 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3099 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3100 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3101 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3102 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3103 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3104 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3105 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3106 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3107 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3108 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3109 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3110 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3111 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3112 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3113 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3114 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3115 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3116 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3117 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3118 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3119 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3120 0x00000000, 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, 0x3c020800,
3121 0x24425760, 0x3c030800, 0x24635964, 0xac400000, 0x0043202b, 0x1480fffd,
3122 0x24420004, 0x3c1d0800, 0x37bd7ffc, 0x03a0f021, 0x3c100800, 0x261034b0,
3123 0x3c1c0800, 0x279c5760, 0x0e000f5b, 0x00000000, 0x0000000d, 0x8f840014,
3124 0x27bdffe8, 0xafb10014, 0xafb00010, 0x8f460104, 0x8f830008, 0x8c8500ac,
3125 0xaf430080, 0x948200a8, 0xa7420e10, 0x948300aa, 0xa7430e12, 0x8c8200ac,
3126 0xaf420e18, 0x97430e10, 0xa7430e14, 0x97420e12, 0x00008021, 0xa7420e16,
3127 0x8f430e18, 0x00006021, 0x00c53023, 0xaf430e1c, 0x10c001a2, 0x2d820001,
3128 0x3c0e1000, 0x2419fff8, 0x24110010, 0x240f0f00, 0x3c188100, 0x93620008,
3129 0x10400009, 0x00000000, 0x97620010, 0x00c2102b, 0x14400005, 0x00000000,
3130 0x97620010, 0x3042ffff, 0x0a000d6d, 0xaf420e00, 0xaf460e00, 0x8f420000,
3131 0x30420008, 0x1040fffd, 0x00000000, 0x97420e08, 0x8f450e04, 0x3044ffff,
3132 0x30820001, 0x14400005, 0x00000000, 0x14a00005, 0x3083a040, 0x0a000f34,
3133 0x00000000, 0x0000000d, 0x3083a040, 0x24020040, 0x1462004f, 0x3082a000,
3134 0x308a0036, 0x8f88000c, 0x30890008, 0x24020800, 0xaf420178, 0x01001821,
3135 0x9742008a, 0x00431023, 0x2442ffff, 0x30421fff, 0x2c420008, 0x1440fffa,
3136 0x00a06021, 0x8f820018, 0x00cc3023, 0x24070001, 0x8f830008, 0x304b00ff,
3137 0x24420001, 0xaf820018, 0x25024000, 0x106f0005, 0x03422021, 0x93820012,
3138 0x30420007, 0x00021240, 0x34470001, 0x000b1400, 0x3c030100, 0x00431025,
3139 0xac820000, 0x8f830018, 0x00ea3825, 0x1120000f, 0xac830004, 0x97430e0a,
3140 0x8f84000c, 0x00ee3825, 0x2402000e, 0x00781825, 0xaf430160, 0x25830006,
3141 0x24840008, 0x30841fff, 0xa742015a, 0xa7430158, 0xaf84000c, 0x0a000db7,
3142 0x00000000, 0x8f83000c, 0x25820002, 0xa7420158, 0x24630008, 0x30631fff,
3143 0xaf83000c, 0x54c0000f, 0x8f420e14, 0x8f820008, 0x504f0002, 0x24100001,
3144 0x34e70040, 0x97420e10, 0x97430e12, 0x8f850014, 0x00021400, 0x00621825,
3145 0xaca300a8, 0x8f840014, 0x8f420e18, 0xac8200ac, 0x8f420e14, 0x8f430e1c,
3146 0xaf420144, 0xaf430148, 0xa34b0152, 0xaf470154, 0x0a000efb, 0xaf4e0178,
3147 0x10400165, 0x00000000, 0x93620008, 0x50400008, 0xafa60008, 0x97620010,
3148 0x00a2102b, 0x10400003, 0x30820040, 0x1040015c, 0x00000000, 0xafa60008,
3149 0xa7840010, 0xaf850004, 0x93620008, 0x1440005f, 0x27ac0008, 0xaf60000c,
3150 0x97820010, 0x30424000, 0x10400002, 0x2403000e, 0x24030016, 0xa363000a,
3151 0x24034007, 0xaf630014, 0x93820012, 0x8f630014, 0x30420007, 0x00021240,
3152 0x00621825, 0xaf630014, 0x97820010, 0x8f630014, 0x30420010, 0x00621825,
3153 0xaf630014, 0x97820010, 0x30420008, 0x5040000e, 0x00002821, 0x8f620014,
3154 0x004e1025, 0xaf620014, 0x97430e0a, 0x2402000e, 0x00781825, 0xaf630004,
3155 0xa3620002, 0x9363000a, 0x3405fffc, 0x24630004, 0x0a000e06, 0xa363000a,
3156 0xaf600004, 0xa3600002, 0x97820010, 0x9363000a, 0x30421f00, 0x00021182,
3157 0x24420028, 0x00621821, 0xa3630009, 0x97420e0c, 0xa7620010, 0x93630009,
3158 0x24020008, 0x24630002, 0x30630007, 0x00431023, 0x30420007, 0xa362000b,
3159 0x93640009, 0x97620010, 0x8f890004, 0x97830010, 0x00441021, 0x00a21021,
3160 0x30630040, 0x10600007, 0x3045ffff, 0x00a9102b, 0x14400005, 0x0125102b,
3161 0x3c068000, 0x0a000e3a, 0x00005821, 0x0125102b, 0x544000c7, 0x00006021,
3162 0x97420e14, 0xa7420e10, 0x97430e16, 0xa7430e12, 0x8f420e1c, 0xaf420e18,
3163 0xaf450e00, 0x8f420000, 0x30420008, 0x1040fffd, 0x00000000, 0x97420e08,
3164 0x00a04821, 0xa7820010, 0x8f430e04, 0x00003021, 0x240b0001, 0xaf830004,
3165 0x97620010, 0x0a000e4c, 0x304dffff, 0x8f890004, 0x97820010, 0x30420040,
3166 0x10400004, 0x01206821, 0x3c068000, 0x0a000e4c, 0x00005821, 0x97630010,
3167 0x8f820004, 0x10430003, 0x00003021, 0x0a000eee, 0x00006021, 0x240b0001,
3168 0x8d820000, 0x00491023, 0x1440000d, 0xad820000, 0x8f620014, 0x34420040,
3169 0xaf620014, 0x97430e10, 0x97420e12, 0x8f840014, 0x00031c00, 0x00431025,
3170 0xac8200a8, 0x8f830014, 0x8f420e18, 0xac6200ac, 0x93620008, 0x1440003e,
3171 0x00000000, 0x25260002, 0x8f84000c, 0x9743008a, 0x3063ffff, 0xafa30000,
3172 0x8fa20000, 0x00441023, 0x2442ffff, 0x30421fff, 0x2c420010, 0x1440fff7,
3173 0x00000000, 0x8f82000c, 0x8f830018, 0x00021082, 0x00021080, 0x24424000,
3174 0x03422821, 0x00605021, 0x24630001, 0x314200ff, 0x00021400, 0xaf830018,
3175 0x3c033200, 0x00431025, 0xaca20000, 0x93630009, 0x9362000a, 0x00031c00,
3176 0x00431025, 0xaca20004, 0x8f830018, 0xaca30008, 0x97820010, 0x30420008,
3177 0x10400002, 0x00c04021, 0x25280006, 0x97430e14, 0x93640002, 0x8f450e1c,
3178 0x8f660004, 0x8f670014, 0x3063ffff, 0xa7430144, 0x97420e16, 0xa7420146,
3179 0xaf450148, 0xa34a0152, 0x8f82000c, 0x308400ff, 0xa744015a, 0xaf460160,
3180 0xa7480158, 0xaf470154, 0xaf4e0178, 0x00511021, 0x30421fff, 0xaf82000c,
3181 0x0a000ed9, 0x8d820000, 0x93620009, 0x9363000b, 0x8f85000c, 0x2463000a,
3182 0x00435021, 0x25440007, 0x00992024, 0x9743008a, 0x3063ffff, 0xafa30000,
3183 0x8fa20000, 0x00451023, 0x2442ffff, 0x30421fff, 0x0044102b, 0x1440fff7,
3184 0x00000000, 0x8f82000c, 0x8f840018, 0x00021082, 0x00021080, 0x24424000,
3185 0x03422821, 0x00804021, 0x24840001, 0xaf840018, 0x93630009, 0x310200ff,
3186 0x00022400, 0x3c024100, 0x24630002, 0x00621825, 0x00832025, 0xaca40000,
3187 0x8f62000c, 0x00461025, 0xaca20004, 0x97430e14, 0x93640002, 0x8f450e1c,
3188 0x8f660004, 0x8f670014, 0x3063ffff, 0xa7430144, 0x97420e16, 0x308400ff,
3189 0xa7420146, 0xaf450148, 0xa3480152, 0x8f83000c, 0x25420007, 0x00591024,
3190 0xa744015a, 0xaf460160, 0xa7490158, 0xaf470154, 0xaf4e0178, 0x00621821,
3191 0x30631fff, 0xaf83000c, 0x8d820000, 0x14400005, 0x00000000, 0x8f620014,
3192 0x2403ffbf, 0x00431024, 0xaf620014, 0x8f62000c, 0x004d1021, 0xaf62000c,
3193 0x93630008, 0x14600008, 0x00000000, 0x11600006, 0x00000000, 0x8f630014,
3194 0x3c02efff, 0x3442fffe, 0x00621824, 0xaf630014, 0xa36b0008, 0x01206021,
3195 0x1580000c, 0x8fa60008, 0x97420e14, 0x97430e16, 0x8f850014, 0x00021400,
3196 0x00621825, 0xaca300a8, 0x8f840014, 0x8f420e1c, 0xac8200ac, 0x0a000efd,
3197 0x2d820001, 0x14c0fe65, 0x2d820001, 0x00501025, 0x10400058, 0x24020f00,
3198 0x8f830008, 0x14620023, 0x3c048000, 0x11800009, 0x3c038000, 0x97420e08,
3199 0x30420040, 0x14400005, 0x00000000, 0x0000000d, 0x00000000, 0x2400032c,
3200 0x3c038000, 0x8f420178, 0x00431024, 0x1440fffd, 0x00000000, 0x97420e10,
3201 0x3c030500, 0x00431025, 0xaf42014c, 0x97430e14, 0xa7430144, 0x97420e16,
3202 0xa7420146, 0x8f430e1c, 0x24022000, 0xaf430148, 0x3c031000, 0xa3400152,
3203 0xa740015a, 0xaf400160, 0xa7400158, 0xaf420154, 0xaf430178, 0x8f830008,
3204 0x3c048000, 0x8f420178, 0x00441024, 0x1440fffd, 0x24020f00, 0x10620016,
3205 0x00000000, 0x97420e14, 0xa7420144, 0x97430e16, 0xa7430146, 0x8f420e1c,
3206 0x3c031000, 0xaf420148, 0x0a000f51, 0x24020240, 0x97420e14, 0x97430e16,
3207 0x8f840014, 0x00021400, 0x00621825, 0xac8300a8, 0x8f850014, 0x8f420e1c,
3208 0x00006021, 0xaca200ac, 0x0a000efd, 0x2d820001, 0xaf40014c, 0x11800007,
3209 0x00000000, 0x97420e10, 0xa7420144, 0x97430e12, 0xa7430146, 0x0a000f4e,
3210 0x8f420e18, 0x97420e14, 0xa7420144, 0x97430e16, 0xa7430146, 0x8f420e1c,
3211 0xaf420148, 0x24020040, 0x3c031000, 0xa3400152, 0xa740015a, 0xaf400160,
3212 0xa7400158, 0xaf420154, 0xaf430178, 0x8fb10014, 0x8fb00010, 0x03e00008,
3213 0x27bd0018, 0x27bdffd0, 0x3c1a8000, 0x3c0420ff, 0x3484fffd, 0x3c020008,
3214 0x03421821, 0xafbf002c, 0xafb60028, 0xafb50024, 0xafb40020, 0xafb3001c,
3215 0xafb20018, 0xafb10014, 0xafb00010, 0xaf830014, 0xaf440e00, 0x00000000,
3216 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3c0200ff, 0x3442fffd,
3217 0x3c046004, 0xaf420e00, 0x8c835000, 0x24160800, 0x24150d00, 0x3c140800,
3218 0x24130f00, 0x3c120800, 0x3c114000, 0x2402ff7f, 0x00621824, 0x3463380c,
3219 0x24020009, 0xac835000, 0xaf420008, 0xaf800018, 0xaf80000c, 0x0e001559,
3220 0x00000000, 0x0e000ff0, 0x00000000, 0x3c020800, 0x245057c0, 0x8f420000,
3221 0x30420001, 0x1040fffd, 0x00000000, 0x8f440100, 0xaf840008, 0xaf440020,
3222 0xaf560178, 0x93430108, 0xa3830012, 0x93820012, 0x30420001, 0x10400008,
3223 0x00000000, 0x93820012, 0x30420006, 0x00021100, 0x0e000d43, 0x0050d821,
3224 0x0a000fac, 0x00000000, 0x14950005, 0x00000000, 0x0e000d43, 0x269b5840,
3225 0x0a000fac, 0x00000000, 0x14930005, 0x00000000, 0x0e000d43, 0x265b5860,
3226 0x0a000fac, 0x00000000, 0x0e0010ea, 0x00000000, 0xaf510138, 0x0a000f89,
3227 0x00000000, 0x27bdfff8, 0x3084ffff, 0x24820007, 0x3044fff8, 0x8f85000c,
3228 0x9743008a, 0x3063ffff, 0xafa30000, 0x8fa20000, 0x00451023, 0x2442ffff,
3229 0x30421fff, 0x0044102b, 0x1440fff7, 0x00000000, 0x8f82000c, 0x00021082,
3230 0x00021080, 0x24424000, 0x03421021, 0x03e00008, 0x27bd0008, 0x3084ffff,
3231 0x8f82000c, 0x24840007, 0x3084fff8, 0x00441021, 0x30421fff, 0xaf82000c,
3232 0x03e00008, 0x00000000, 0x27bdffe8, 0x3c1a8000, 0x3c0420ff, 0x3484fffd,
3233 0x3c020008, 0x03421821, 0xafbf0010, 0xaf830014, 0xaf440e00, 0x00000000,
3234 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3c0200ff, 0x3442fffd,
3235 0x3c046004, 0xaf420e00, 0x8c825000, 0x2403ff7f, 0x00431024, 0x3442380c,
3236 0x24030009, 0xac825000, 0xaf430008, 0xaf800018, 0xaf80000c, 0x0e001559,
3237 0x00000000, 0x0e000ff0, 0x00000000, 0x8fbf0010, 0x03e00008, 0x27bd0018,
3238 0x27bdffe8, 0x3c02000a, 0x03421821, 0x3c040800, 0x24845880, 0x24050019,
3239 0xafbf0010, 0xaf830024, 0x0e001565, 0x00003021, 0x3c050800, 0x3c020800,
3240 0x24425330, 0xaca258e8, 0x24a558e8, 0x3c020800, 0x244254f8, 0x3c030800,
3241 0x2463550c, 0x3c040800, 0xaca20004, 0x3c020800, 0x24425338, 0xaca30008,
3242 0xac825900, 0x24845900, 0x3c020800, 0x244253c4, 0x3c070800, 0x24e75404,
3243 0x3c060800, 0x24c65520, 0x3c050800, 0x24a55438, 0x3c030800, 0xac820004,
3244 0x3c020800, 0x24425528, 0xac870008, 0xac86000c, 0xac850010, 0xac625920,
3245 0x24635920, 0x8fbf0010, 0x3c020800, 0x24425540, 0xac620004, 0x3c020800,
3246 0xac670008, 0xac66000c, 0xac650010, 0xac400048, 0x03e00008, 0x27bd0018,
3247 0x974309da, 0x00804021, 0xad030000, 0x8f4209dc, 0xad020004, 0x8f4309e0,
3248 0xad030008, 0x934409d9, 0x24020001, 0x30840003, 0x1082001f, 0x30a900ff,
3249 0x28820002, 0x10400005, 0x24020002, 0x10800009, 0x3c0a0800, 0x0a001078,
3250 0x93420934, 0x1082000b, 0x24020003, 0x10820026, 0x3c0a0800, 0x0a001078,
3251 0x93420934, 0x974209e4, 0x00021400, 0x34420800, 0xad02000c, 0x0a001077,
3252 0x25080010, 0x974209e4, 0x00021400, 0x34428100, 0xad02000c, 0x974309e8,
3253 0x3c0a0800, 0x00031c00, 0x34630800, 0xad030010, 0x0a001077, 0x25080014,
3254 0x974409e4, 0x3c050800, 0x24a25880, 0x9443001c, 0x94460014, 0x94470010,
3255 0x00a05021, 0x24020800, 0xad000010, 0xad020014, 0x00042400, 0x00661821,
3256 0x00671823, 0x2463fff2, 0x00832025, 0xad04000c, 0x0a001077, 0x25080018,
3257 0x974209e4, 0x3c050800, 0x00021400, 0x34428100, 0xad02000c, 0x974409e8,
3258 0x24a25880, 0x9443001c, 0x94460014, 0x94470010, 0x00a05021, 0x24020800,
3259 0xad000014, 0xad020018, 0x00042400, 0x00661821, 0x00671823, 0x2463ffee,
3260 0x00832025, 0xad040010, 0x2508001c, 0x93420934, 0x93450921, 0x3c074000,
3261 0x25445880, 0x94830018, 0x94860014, 0x00021082, 0x00021600, 0x00052c00,
3262 0x00a72825, 0x00451025, 0x00661821, 0x00431025, 0xad020000, 0x9783002c,
3263 0x974209ea, 0x00621821, 0x00031c00, 0xad030004, 0x9782002c, 0x24420001,
3264 0x30427fff, 0xa782002c, 0x93430920, 0x3c020006, 0x00031e00, 0x00621825,
3265 0xad030008, 0x8f42092c, 0xad02000c, 0x8f430930, 0xad030010, 0x8f440938,
3266 0x25080014, 0xad040000, 0x8f820020, 0x11200004, 0xad020004, 0x8f420940,
3267 0x0a0010a1, 0x2442ffff, 0x8f420940, 0xad020008, 0x8f440948, 0x8f420940,
3268 0x93430936, 0x00823023, 0x00663006, 0x3402ffff, 0x0046102b, 0x54400001,
3269 0x3406ffff, 0x93420937, 0x25445880, 0x90830024, 0xad000010, 0x00021700,
3270 0x34630010, 0x00031c00, 0x00431025, 0x00461025, 0xad02000c, 0x8c830008,
3271 0x14600031, 0x25080014, 0x3c020800, 0x8c430048, 0x1060002d, 0x00000000,
3272 0x9342010b, 0xad020000, 0x8f830000, 0x8c6200b0, 0xad020004, 0x8f830000,
3273 0x8c6200b4, 0xad020008, 0x8f830000, 0x8c6200c0, 0xad02000c, 0x8f830000,
3274 0x8c6200c4, 0xad020010, 0x8f830000, 0x8c6200c8, 0xad020014, 0x8f830000,
3275 0x8c6200cc, 0xad020018, 0x8f830000, 0x8c6200e0, 0xad02001c, 0x8f830000,
3276 0x8c6200e8, 0xad020020, 0x8f830000, 0x8c6200f0, 0x3c04600e, 0xad020024,
3277 0x8c8200d0, 0xad020028, 0x8c8300d4, 0xad03002c, 0x8f820028, 0x3c046012,
3278 0xad020030, 0x8c8200a8, 0xad020034, 0x8c8300ac, 0x3c026000, 0xad030038,
3279 0x8c434448, 0xad03003c, 0x03e00008, 0x01001021, 0x27bdffa8, 0x3c020008,
3280 0x03423021, 0xafbf0054, 0xafbe0050, 0xafb7004c, 0xafb60048, 0xafb50044,
3281 0xafb40040, 0xafb3003c, 0xafb20038, 0xafb10034, 0xafb00030, 0xaf860000,
3282 0x24020040, 0xaf420814, 0xaf400810, 0x8f420944, 0x8f430950, 0x8f440954,
3283 0x8f45095c, 0xaf820034, 0xaf830020, 0xaf84001c, 0xaf850030, 0x90c20000,
3284 0x24030020, 0x304400ff, 0x10830005, 0x24020030, 0x10820022, 0x3c030800,
3285 0x0a001139, 0x8c62002c, 0x24020088, 0xaf420818, 0x3c020800, 0x244258e8,
3286 0xafa20020, 0x93430109, 0x3c020800, 0x10600009, 0x24575900, 0x3c026000,
3287 0x24030100, 0xac43081c, 0x3c030001, 0xac43081c, 0x0000000d, 0x00000000,
3288 0x24000376, 0x9342010a, 0x30420080, 0x14400021, 0x24020800, 0x3c026000,
3289 0x24030100, 0xac43081c, 0x3c030001, 0xac43081c, 0x0000000d, 0x00000000,
3290 0x2400037d, 0x0a001141, 0x24020800, 0x93430109, 0x3063007f, 0x00031140,
3291 0x000318c0, 0x00431021, 0x24430088, 0xaf430818, 0x0000000d, 0x3c020800,
3292 0x24425940, 0x3c030800, 0x24775950, 0x0a001140, 0xafa20020, 0x24420001,
3293 0xac62002c, 0x0000000d, 0x00000000, 0x24000395, 0x0a0014c1, 0x8fbf0054,
3294 0x24020800, 0xaf420178, 0x8f450104, 0x8f420988, 0x00a21023, 0x58400005,
3295 0x8f4309a0, 0x0000000d, 0x00000000, 0x240003b1, 0x8f4309a0, 0x3c100800,
3296 0xae0358b0, 0x8f4209a4, 0x8f830020, 0x260458b0, 0x2491ffd0, 0xae220034,
3297 0x00a21023, 0xae230028, 0xac82ffd0, 0x8fa30020, 0x8c620000, 0x0040f809,
3298 0x0200b021, 0x00409021, 0x32440010, 0x32420002, 0x10400007, 0xafa40024,
3299 0x8e220020, 0x32530040, 0x2403ffbf, 0x00431024, 0x0a001493, 0xae220020,
3300 0x32420020, 0x10400002, 0x3c020800, 0x24575920, 0x32420001, 0x14400007,
3301 0x00000000, 0x8f820008, 0xaf420080, 0x8ec358b0, 0xaf430e10, 0x8e220034,
3302 0xaf420e18, 0x9343010b, 0x93420905, 0x30420008, 0x1040003c, 0x307400ff,
3303 0x8f820000, 0x8c430074, 0x0460000a, 0x00000000, 0x3c026000, 0x24030100,
3304 0xac43081c, 0x3c030001, 0xac43081c, 0x0000000d, 0x00000000, 0x240003ed,
3305 0x8f820000, 0x9044007b, 0x9343010a, 0x14830027, 0x32530040, 0x00003821,
3306 0x24052000, 0x3c090800, 0x3c038000, 0x8f420178, 0x00431024, 0x1440fffd,
3307 0x8ec258b0, 0x26c458b0, 0x2484ffd0, 0xaf420144, 0x8c820034, 0x3c030100,
3308 0xaf420148, 0x24020047, 0xaf43014c, 0xa3420152, 0x8d230030, 0x3c021000,
3309 0xa7470158, 0xaf450154, 0xaf420178, 0x8c860034, 0x24630001, 0xad230030,
3310 0x9342010a, 0x3c030047, 0xafa50014, 0x00021600, 0x00431025, 0x00471025,
3311 0xafa20010, 0x9343010b, 0xafa30018, 0x8f440100, 0x8f450104, 0x0e00159b,
3312 0x3c070100, 0x3c050800, 0x24a25880, 0x0a001250, 0x8c430020, 0x32820002,
3313 0x10400050, 0x00000000, 0x0e0015b9, 0x32530040, 0x3c039000, 0x34630001,
3314 0x8f820008, 0x3c048000, 0x00431025, 0xaf420020, 0x8f420020, 0x00441024,
3315 0x1440fffd, 0x00000000, 0x8f830000, 0x90620005, 0x34420008, 0xa0620005,
3316 0x8f840000, 0x8c820074, 0x3c038000, 0x00431025, 0xac820074, 0x90830000,
3317 0x24020020, 0x10620004, 0x00000000, 0x0000000d, 0x00000000, 0x2400040b,
3318 0x8f830008, 0x3c028000, 0x34420001, 0x00621825, 0xaf430020, 0x9084007b,
3319 0x9342010a, 0x14820028, 0x3c030800, 0x00003821, 0x24052000, 0x3c090800,
3320 0x3c038000, 0x8f420178, 0x00431024, 0x1440fffd, 0x8ec258b0, 0x26c458b0,
3321 0x2484ffd0, 0xaf420144, 0x8c820034, 0x3c030100, 0xaf420148, 0x24020046,
3322 0xaf43014c, 0xa3420152, 0x8d230030, 0x3c021000, 0xa7470158, 0xaf450154,
3323 0xaf420178, 0x8c860034, 0x24630001, 0xad230030, 0x9342010a, 0x3c030046,
3324 0xafa50014, 0x00021600, 0x00431025, 0x00471025, 0xafa20010, 0x9343010b,
3325 0xafa30018, 0x8f440100, 0x8f450104, 0x0e00159b, 0x3c070100, 0x3c030800,
3326 0x24625880, 0x0a001250, 0x8c430020, 0x93420108, 0x30420010, 0x50400056,
3327 0x9343093f, 0x8f860000, 0x90c2007f, 0x8cc30178, 0x304800ff, 0x15030004,
3328 0x00000000, 0x0000000d, 0x00000000, 0x24000425, 0x90c2007e, 0x90c40080,
3329 0x00081c00, 0x00021600, 0x00431025, 0x00042200, 0x90c3007a, 0x90c5000a,
3330 0x00441025, 0x11050028, 0x00623825, 0xa0c8000a, 0x00004021, 0x24056000,
3331 0x3c090800, 0x3c038000, 0x8f420178, 0x00431024, 0x1440fffd, 0x8ec258b0,
3332 0x26c458b0, 0x2484ffd0, 0xaf420144, 0x8c820034, 0xaf420148, 0x24020052,
3333 0xaf47014c, 0xa3420152, 0x8d230030, 0x3c021000, 0xa7480158, 0xaf450154,
3334 0xaf420178, 0x8c860034, 0x24630001, 0xad230030, 0x9342010a, 0x3c030052,
3335 0xafa50014, 0x00021600, 0x00431025, 0x00481025, 0xafa20010, 0x9343010b,
3336 0xafa30018, 0x8f440100, 0x0e00159b, 0x8f450104, 0x0a00124a, 0x00000000,
3337 0x3c026000, 0x24030100, 0xac43081c, 0x3c030001, 0xac43081c, 0x0000000d,
3338 0x00000000, 0x2400043e, 0x16800009, 0x3c050800, 0x3c040800, 0x24825880,
3339 0x8c430020, 0x32530040, 0x2404ffbf, 0x00641824, 0x0a001493, 0xac430020,
3340 0x8ca25880, 0x10400005, 0x3c030800, 0x8c620034, 0xaca05880, 0x24420001,
3341 0xac620034, 0x9343093f, 0x24020012, 0x5462000e, 0x97420908, 0x32820038,
3342 0x14400009, 0x3c030800, 0x8f830000, 0x8c62004c, 0xac62005c, 0x3c020800,
3343 0x24445880, 0x8c820020, 0x0a001285, 0x32530040, 0xac605880, 0x97420908,
3344 0x5440001c, 0x97420908, 0x3c039000, 0x34630001, 0x8f820008, 0x32530040,
3345 0x3c048000, 0x00431025, 0xaf420020, 0x8f420020, 0x00441024, 0x1440fffd,
3346 0x3c028000, 0x8f840000, 0x8f850008, 0x8c830050, 0x34420001, 0x00a22825,
3347 0xaf830020, 0xac830070, 0xac83005c, 0xaf450020, 0x3c050800, 0x24a45880,
3348 0x8c820020, 0x2403ffbf, 0x00431024, 0x0a001493, 0xac820020, 0x000211c0,
3349 0xaf420024, 0x97420908, 0x3c030080, 0x34630003, 0x000211c0, 0xaf42080c,
3350 0xaf43081c, 0x974209ec, 0x8f4309a4, 0xa782002c, 0x3c020800, 0x24445880,
3351 0xac83002c, 0x93420937, 0x93430934, 0x00021080, 0x00621821, 0xa4830018,
3352 0x934209d8, 0x32850038, 0xafa50028, 0x00621821, 0xa483001a, 0x934209d8,
3353 0x93430934, 0x3c1e0800, 0x00809821, 0x00431021, 0x24420010, 0xa4820016,
3354 0x24020006, 0xae620020, 0x8fa20028, 0x10400003, 0x0000a821, 0x0a0012f0,
3355 0x24120008, 0x8f420958, 0x8f830020, 0x8f840030, 0x00431023, 0x00832023,
3356 0x04800003, 0xae620004, 0x04410003, 0x0082102b, 0x0a0012bc, 0xae600004,
3357 0x54400001, 0xae640004, 0x8ee20000, 0x0040f809, 0x00000000, 0x00409021,
3358 0x32420001, 0x5440001e, 0x8ee20004, 0x8e630008, 0x1060002b, 0x3c02c000,
3359 0x00621025, 0xaf420e00, 0x8f420000, 0x30420008, 0x1040fffd, 0x00000000,
3360 0x97420e08, 0xa7820010, 0x8f430e04, 0x8e620008, 0xaf830004, 0x8f840004,
3361 0x0044102b, 0x1040000b, 0x24150001, 0x24020100, 0x3c016000, 0xac22081c,
3362 0x3c020001, 0x3c016000, 0xac22081c, 0x0000000d, 0x00000000, 0x240004cd,
3363 0x24150001, 0x8ee20004, 0x0040f809, 0x00000000, 0x02429025, 0x32420002,
3364 0x5040001d, 0x8f470940, 0x12a00006, 0x8ec258b0, 0x8f830000, 0xac6200a8,
3365 0x8f840000, 0x8e620034, 0xac8200ac, 0x32420004, 0x50400013, 0x8f470940,
3366 0x3c020800, 0x3283007d, 0x10600110, 0x24575920, 0x32820001, 0x50400006,
3367 0x36520002, 0x8f830034, 0x8f420940, 0x10620109, 0x00000000, 0x36520002,
3368 0x24020008, 0xa6600010, 0xa6620012, 0xae600008, 0xa2600024, 0x8f470940,
3369 0x3c030800, 0x24685880, 0x8d02002c, 0x8d050008, 0x95040010, 0x9506000a,
3370 0x95030026, 0x00451021, 0x00862021, 0x00641821, 0xaf870034, 0xad02002c,
3371 0x32820030, 0x10400008, 0xa5030014, 0x91020024, 0x32910040, 0x34420004,
3372 0xa1020024, 0xaf400048, 0x0a001345, 0x3c040800, 0x93420923, 0x30420002,
3373 0x10400029, 0x32910040, 0x8f830000, 0x8f840020, 0x8c620084, 0x00441023,
3374 0x0442000a, 0x3c039000, 0x95020014, 0x8c630084, 0x00821021, 0x00621823,
3375 0x1c600004, 0x3c039000, 0x91020024, 0x34420001, 0xa1020024, 0x34630001,
3376 0x8f820008, 0x32910040, 0x3c048000, 0x00431025, 0xaf420020, 0x8f420020,
3377 0x00441024, 0x1440fffd, 0x00000000, 0x8f840000, 0x9083003f, 0x2402000a,
3378 0x10620005, 0x2402000c, 0x9083003f, 0x24020008, 0x14620002, 0x24020014,
3379 0xa082003f, 0x8f830008, 0x3c028000, 0x34420001, 0x00621825, 0xaf430020,
3380 0x3c040800, 0x24865880, 0x94c20010, 0x94c3001a, 0x8cc40008, 0x00432821,
3381 0x14800006, 0xa4c5001c, 0x3c020800, 0x8c430048, 0x10600002, 0x24a20040,
3382 0xa4c2001c, 0x27d05880, 0x9604001c, 0x96020012, 0x00822021, 0x24840002,
3383 0x0e000faf, 0x3084ffff, 0x8f850018, 0x00a01821, 0xa2030025, 0x8ee60008,
3384 0x00402021, 0x24a50001, 0xaf850018, 0x00c0f809, 0x00000000, 0x00402021,
3385 0x0e001026, 0x02202821, 0x8ee3000c, 0x0060f809, 0x00402021, 0x9604001c,
3386 0x96020012, 0x00822021, 0x24840002, 0x0e000fc5, 0x3084ffff, 0x8fc25880,
3387 0x8e030008, 0x00431023, 0x14400012, 0xafc25880, 0x54600006, 0x8e020020,
3388 0x3243004a, 0x24020002, 0x14620005, 0x00000000, 0x8e020020, 0x34420040,
3389 0x0a001382, 0xae020020, 0x52a00006, 0x36520002, 0x8e020030, 0xaf420e10,
3390 0x8e030034, 0xaf430e18, 0x36520002, 0x52a00008, 0x96670014, 0x8f830000,
3391 0x8f420e10, 0xac6200a8, 0x8f840000, 0x8f420e18, 0xac8200ac, 0x96670014,
3392 0x92680024, 0x24020040, 0xaf420814, 0x8f830020, 0x8f82001c, 0x00671821,
3393 0x00621023, 0xaf830020, 0x18400008, 0x00000000, 0x8f820000, 0xaf83001c,
3394 0xac430054, 0x54e00005, 0xaf400040, 0x0a0013a0, 0x8f42095c, 0x54e00001,
3395 0xaf400044, 0x8f42095c, 0x31030008, 0xaf820030, 0x1060001a, 0x00000000,
3396 0x8f840000, 0x90820120, 0x90830121, 0x304600ff, 0x00c31823, 0x30630007,
3397 0x24020007, 0x1062000e, 0x00000000, 0x90820122, 0x304200fe, 0xa0820122,
3398 0x8f850000, 0x00061880, 0x8f840020, 0x24a20100, 0x00431021, 0x24c30001,
3399 0x30630007, 0xac440000, 0x0a0013bd, 0xa0a30120, 0x90820122, 0x34420001,
3400 0xa0820122, 0x14e00003, 0x31020001, 0x10400031, 0x32510002, 0x8f820000,
3401 0x8c43000c, 0x30630001, 0x1060002c, 0x32510002, 0x3c029000, 0x8f830008,
3402 0x34420001, 0x3c048000, 0x00621825, 0xaf430020, 0x8f420020, 0x00441024,
3403 0x1440fffd, 0x00000000, 0x8f870000, 0x8ce2000c, 0x30420001, 0x10400018,
3404 0x00000000, 0x94e2006a, 0x00022880, 0x50a00001, 0x24050001, 0x94e30068,
3405 0x90e40081, 0x3c020800, 0x8c460024, 0x00652821, 0x00852804, 0x00c5102b,
3406 0x54400001, 0x00a03021, 0x3c020800, 0x8c440028, 0x00c4182b, 0x54600001,
3407 0x00c02021, 0x8f430074, 0x2402fffe, 0x00822824, 0x00a31821, 0xace3000c,
3408 0x8f830008, 0x3c028000, 0x34420001, 0x00621825, 0xaf430020, 0x8f820020,
3409 0x3c050800, 0x24b05880, 0xae020028, 0x8ee30010, 0x0060f809, 0x00000000,
3410 0x8f820028, 0x24420001, 0xaf820028, 0x12a00005, 0xaf40004c, 0x8f420e10,
3411 0xae020030, 0x8f430e18, 0xae030034, 0x1220fea7, 0x24020006, 0x8f870024,
3412 0x9786002c, 0x8f830000, 0x8f820034, 0x8f840020, 0x8f85001c, 0x32530040,
3413 0xa4e6002c, 0xac620044, 0x32420008, 0xac640050, 0xac650054, 0x1040007a,
3414 0x32820020, 0x10400027, 0x32910010, 0x00003821, 0x24052000, 0x3c090800,
3415 0x3c038000, 0x8f420178, 0x00431024, 0x1440fffd, 0x8ec258b0, 0x26c458b0,
3416 0x2484ffd0, 0xaf420144, 0x8c820034, 0x3c030400, 0xaf420148, 0x24020041,
3417 0xaf43014c, 0xa3420152, 0x8d230030, 0x3c021000, 0xa7470158, 0xaf450154,
3418 0xaf420178, 0x8c860034, 0x24630001, 0xad230030, 0x9342010a, 0x3c030041,
3419 0xafa50014, 0x00021600, 0x00431025, 0x00471025, 0xafa20010, 0x9343010b,
3420 0xafa30018, 0x8f440100, 0x8f450104, 0x0e00159b, 0x3c070400, 0x12200028,
3421 0x00003821, 0x24052000, 0x3c090800, 0x3c038000, 0x8f420178, 0x00431024,
3422 0x1440fffd, 0x8ec258b0, 0x26c458b0, 0x2484ffd0, 0xaf420144, 0x8c820034,
3423 0x3c030300, 0xaf420148, 0x2402004e, 0xaf43014c, 0xa3420152, 0x8d230030,
3424 0x3c021000, 0xa7470158, 0xaf450154, 0xaf420178, 0x8c860034, 0x24630001,
3425 0xad230030, 0x9342010a, 0x3c03004e, 0xafa50014, 0x00021600, 0x00431025,
3426 0x00471025, 0xafa20010, 0x9343010b, 0xafa30018, 0x8f440100, 0x8f450104,
3427 0x0e00159b, 0x3c070300, 0x0a00148b, 0x8fa20024, 0x32820008, 0x10400026,
3428 0x24052000, 0x00003821, 0x3c090800, 0x3c038000, 0x8f420178, 0x00431024,
3429 0x1440fffd, 0x8ec258b0, 0x26c458b0, 0x2484ffd0, 0xaf420144, 0x8c820034,
3430 0x3c030200, 0xaf420148, 0x2402004b, 0xaf43014c, 0xa3420152, 0x8d230030,
3431 0x3c021000, 0xa7470158, 0xaf450154, 0xaf420178, 0x8c860034, 0x24630001,
3432 0xad230030, 0x9342010a, 0x3c03004b, 0xafa50014, 0x00021600, 0x00431025,
3433 0x00471025, 0xafa20010, 0x9343010b, 0xafa30018, 0x8f440100, 0x8f450104,
3434 0x0e00159b, 0x3c070200, 0x8fa20024, 0x14400004, 0x8fa30020, 0x32420010,
3435 0x10400004, 0x00000000, 0x8c620004, 0x0040f809, 0x00000000, 0x12600006,
3436 0x8fa40020, 0x8c820008, 0x0040f809, 0x00000000, 0x0a0014c1, 0x8fbf0054,
3437 0x3c030800, 0x8c6258a0, 0x30420040, 0x14400023, 0x8fbf0054, 0x00002821,
3438 0x24040040, 0x8f870020, 0x3c038000, 0x8f420178, 0x00431024, 0x1440fffd,
3439 0x8ec258b0, 0x26c358b0, 0x2463ffd0, 0xaf420144, 0x8c620034, 0xaf420148,
3440 0x24020049, 0xaf47014c, 0xa3420152, 0x3c021000, 0xa7450158, 0xaf440154,
3441 0xaf420178, 0x8c660034, 0x9342010a, 0x3c030049, 0xafa40014, 0x00021600,
3442 0x00431025, 0x00451025, 0xafa20010, 0x9343010b, 0xafa30018, 0x8f440100,
3443 0x0e00159b, 0x8f450104, 0x8fbf0054, 0x8fbe0050, 0x8fb7004c, 0x8fb60048,
3444 0x8fb50044, 0x8fb40040, 0x8fb3003c, 0x8fb20038, 0x8fb10034, 0x8fb00030,
3445 0x03e00008, 0x27bd0058, 0x03e00008, 0x00001021, 0x3c020800, 0x24435880,
3446 0x8c650004, 0x8c445880, 0x0085182b, 0x10600002, 0x00403021, 0x00802821,
3447 0x9744093c, 0x00a4102b, 0x54400001, 0x00a02021, 0x93420923, 0x0004182b,
3448 0x00021042, 0x30420001, 0x00431024, 0x1040000d, 0x24c25880, 0x8f850000,
3449 0x8f830020, 0x8ca20084, 0x00431023, 0x04420007, 0x24c25880, 0x8ca20084,
3450 0x00641821, 0x00431023, 0x28420001, 0x00822023, 0x24c25880, 0xac440008,
3451 0xa4400026, 0x03e00008, 0x00001021, 0x8f850004, 0x97840010, 0x3c030800,
3452 0x24635880, 0x24020008, 0xa4620012, 0x8f820004, 0xa4600010, 0x000420c2,
3453 0x30840008, 0x2c420001, 0x00021023, 0x30420006, 0xac650008, 0x03e00008,
3454 0xa0640024, 0x3c020800, 0x24425880, 0x90450025, 0x9443001c, 0x3c021100,
3455 0xac800004, 0x00052c00, 0x24630002, 0x00621825, 0x00a32825, 0x24820008,
3456 0x03e00008, 0xac850000, 0x27bdffd8, 0x3c020800, 0x24425880, 0xafbf0020,
3457 0x90480025, 0x8c440008, 0x8c460020, 0x8f870020, 0x3c030800, 0x3c058000,
3458 0x8f420178, 0x00451024, 0x1440fffd, 0x8c6258b0, 0x246358b0, 0x2469ffd0,
3459 0xaf420144, 0x8d220034, 0x30c32000, 0xaf420148, 0x3c021000, 0xaf47014c,
3460 0xa3480152, 0xa7440158, 0xaf460154, 0xaf420178, 0x10600004, 0x3c030800,
3461 0x8c620030, 0x24420001, 0xac620030, 0x9342010a, 0x00081c00, 0x3084ffff,
3462 0xafa60014, 0x00021600, 0x00431025, 0x00441025, 0xafa20010, 0x9343010b,
3463 0xafa30018, 0x8f440100, 0x8f450104, 0x0e00159b, 0x8d260034, 0x8fbf0020,
3464 0x03e00008, 0x27bd0028, 0x0000000d, 0x00000000, 0x2400019d, 0x03e00008,
3465 0x00000000, 0x0000000d, 0x00000000, 0x240001a9, 0x03e00008, 0x00000000,
3466 0x03e00008, 0x00000000, 0x3c020800, 0x24425880, 0xac400008, 0xa4400026,
3467 0x03e00008, 0x24020001, 0x3c020800, 0x24425880, 0x24030008, 0xac400008,
3468 0xa4400010, 0xa4430012, 0xa0400024, 0x03e00008, 0x24020004, 0x03e00008,
3469 0x00001021, 0x10c00007, 0x00000000, 0x8ca20000, 0x24c6ffff, 0x24a50004,
3470 0xac820000, 0x14c0fffb, 0x24840004, 0x03e00008, 0x00000000, 0x0a00156c,
3471 0x00a01021, 0xac860000, 0x00000000, 0x00000000, 0x24840004, 0x00a01021,
3472 0x1440fffa, 0x24a5ffff, 0x03e00008, 0x00000000, 0x3c0a0800, 0x8d490068,
3473 0x3c050800, 0x24a52098, 0x00093140, 0x00c51021, 0xac440000, 0x8f440e04,
3474 0x00a61021, 0xac440004, 0x97430e08, 0x97420e0c, 0x00a62021, 0x00031c00,
3475 0x00431025, 0xac820008, 0x8f430e10, 0x00801021, 0xac43000c, 0x8f440e14,
3476 0xac440010, 0x8f430e18, 0x3c0800ff, 0xac430014, 0x8f470e1c, 0x3508ffff,
3477 0x25290001, 0xac470018, 0x3c070800, 0x8ce3006c, 0x9344010a, 0x3c026000,
3478 0x24630001, 0xace3006c, 0x8c434448, 0x3129007f, 0x00a62821, 0xad490068,
3479 0x00042600, 0x00681824, 0x00832025, 0x03e00008, 0xaca4001c, 0x8fac0010,
3480 0x8fad0014, 0x8fae0018, 0x3c0b0800, 0x8d6a0060, 0x3c080800, 0x25080080,
3481 0x000a4940, 0x01281021, 0x01091821, 0xac440000, 0x00601021, 0xac650004,
3482 0xac460008, 0xac67000c, 0xac4c0010, 0xac6d0014, 0x3c036000, 0xac4e0018,
3483 0x8c654448, 0x3c040800, 0x8c820064, 0x254a0001, 0x314a00ff, 0x01094021,
3484 0xad6a0060, 0x24420001, 0xac820064, 0x03e00008, 0xad05001c, 0x3c030800,
3485 0x3c090800, 0x8d250070, 0x246330b0, 0x8f460100, 0x00053900, 0x00e31021,
3486 0xac460000, 0x8f440104, 0x00671021, 0xac440004, 0x8f460108, 0x8f840014,
3487 0x24a50001, 0xac460008, 0x8c880074, 0x3c060800, 0x8cc20074, 0x30a5003f,
3488 0x00671821, 0xad250070, 0x24420001, 0xacc20074, 0x03e00008, 0xac68000c,
3489 0x00000000 };
3490 1962
3491static u32 bnx2_TXP_b06FwData[(0x0/4) + 1] = { 0x0 }; 1963static u32 bnx2_TXP_b06FwData[(0x0/4) + 1] = { 0x0 };
3492static u32 bnx2_TXP_b06FwRodata[(0x0/4) + 1] = { 0x0 }; 1964static u32 bnx2_TXP_b06FwRodata[(0x0/4) + 1] = { 0x0 };
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 55d236726d11..8171cae06688 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1199,8 +1199,7 @@ int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev)
1199} 1199}
1200 1200
1201#define BOND_INTERSECT_FEATURES \ 1201#define BOND_INTERSECT_FEATURES \
1202 (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM|\ 1202 (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO)
1203 NETIF_F_TSO|NETIF_F_UFO)
1204 1203
1205/* 1204/*
1206 * Compute the common dev->feature set available to all slaves. Some 1205 * Compute the common dev->feature set available to all slaves. Some
@@ -1218,9 +1217,7 @@ static int bond_compute_features(struct bonding *bond)
1218 features &= (slave->dev->features & BOND_INTERSECT_FEATURES); 1217 features &= (slave->dev->features & BOND_INTERSECT_FEATURES);
1219 1218
1220 if ((features & NETIF_F_SG) && 1219 if ((features & NETIF_F_SG) &&
1221 !(features & (NETIF_F_IP_CSUM | 1220 !(features & NETIF_F_ALL_CSUM))
1222 NETIF_F_NO_CSUM |
1223 NETIF_F_HW_CSUM)))
1224 features &= ~NETIF_F_SG; 1221 features &= ~NETIF_F_SG;
1225 1222
1226 /* 1223 /*
@@ -4191,7 +4188,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4191 */ 4188 */
4192 bond_dev->features |= NETIF_F_VLAN_CHALLENGED; 4189 bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
4193 4190
4194 /* don't acquire bond device's xmit_lock when 4191 /* don't acquire bond device's netif_tx_lock when
4195 * transmitting */ 4192 * transmitting */
4196 bond_dev->features |= NETIF_F_LLTX; 4193 bond_dev->features |= NETIF_F_LLTX;
4197 4194
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 5669b95162b3..04a53f1dfdbd 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -108,6 +108,7 @@
108 * 0.53: 19 Mar 2006: Fix init from low power mode and add hw reset. 108 * 0.53: 19 Mar 2006: Fix init from low power mode and add hw reset.
109 * 0.54: 21 Mar 2006: Fix spin locks for multi irqs and cleanup. 109 * 0.54: 21 Mar 2006: Fix spin locks for multi irqs and cleanup.
110 * 0.55: 22 Mar 2006: Add flow control (pause frame). 110 * 0.55: 22 Mar 2006: Add flow control (pause frame).
111 * 0.56: 22 Mar 2006: Additional ethtool config and moduleparam support.
111 * 112 *
112 * Known bugs: 113 * Known bugs:
113 * We suspect that on some hardware no TX done interrupts are generated. 114 * We suspect that on some hardware no TX done interrupts are generated.
@@ -119,7 +120,7 @@
119 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few 120 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
120 * superfluous timer interrupts from the nic. 121 * superfluous timer interrupts from the nic.
121 */ 122 */
122#define FORCEDETH_VERSION "0.55" 123#define FORCEDETH_VERSION "0.56"
123#define DRV_NAME "forcedeth" 124#define DRV_NAME "forcedeth"
124 125
125#include <linux/module.h> 126#include <linux/module.h>
@@ -165,6 +166,8 @@
165#define DEV_HAS_MSI_X 0x0080 /* device supports MSI-X */ 166#define DEV_HAS_MSI_X 0x0080 /* device supports MSI-X */
166#define DEV_HAS_POWER_CNTRL 0x0100 /* device supports power savings */ 167#define DEV_HAS_POWER_CNTRL 0x0100 /* device supports power savings */
167#define DEV_HAS_PAUSEFRAME_TX 0x0200 /* device supports tx pause frames */ 168#define DEV_HAS_PAUSEFRAME_TX 0x0200 /* device supports tx pause frames */
169#define DEV_HAS_STATISTICS 0x0400 /* device supports hw statistics */
170#define DEV_HAS_TEST_EXTENDED 0x0800 /* device supports extended diagnostic test */
168 171
169enum { 172enum {
170 NvRegIrqStatus = 0x000, 173 NvRegIrqStatus = 0x000,
@@ -221,6 +224,7 @@ enum {
221#define NVREG_PFF_ALWAYS 0x7F0000 224#define NVREG_PFF_ALWAYS 0x7F0000
222#define NVREG_PFF_PROMISC 0x80 225#define NVREG_PFF_PROMISC 0x80
223#define NVREG_PFF_MYADDR 0x20 226#define NVREG_PFF_MYADDR 0x20
227#define NVREG_PFF_LOOPBACK 0x10
224 228
225 NvRegOffloadConfig = 0x90, 229 NvRegOffloadConfig = 0x90,
226#define NVREG_OFFLOAD_HOMEPHY 0x601 230#define NVREG_OFFLOAD_HOMEPHY 0x601
@@ -333,6 +337,33 @@ enum {
333#define NVREG_POWERSTATE_D1 0x0001 337#define NVREG_POWERSTATE_D1 0x0001
334#define NVREG_POWERSTATE_D2 0x0002 338#define NVREG_POWERSTATE_D2 0x0002
335#define NVREG_POWERSTATE_D3 0x0003 339#define NVREG_POWERSTATE_D3 0x0003
340 NvRegTxCnt = 0x280,
341 NvRegTxZeroReXmt = 0x284,
342 NvRegTxOneReXmt = 0x288,
343 NvRegTxManyReXmt = 0x28c,
344 NvRegTxLateCol = 0x290,
345 NvRegTxUnderflow = 0x294,
346 NvRegTxLossCarrier = 0x298,
347 NvRegTxExcessDef = 0x29c,
348 NvRegTxRetryErr = 0x2a0,
349 NvRegRxFrameErr = 0x2a4,
350 NvRegRxExtraByte = 0x2a8,
351 NvRegRxLateCol = 0x2ac,
352 NvRegRxRunt = 0x2b0,
353 NvRegRxFrameTooLong = 0x2b4,
354 NvRegRxOverflow = 0x2b8,
355 NvRegRxFCSErr = 0x2bc,
356 NvRegRxFrameAlignErr = 0x2c0,
357 NvRegRxLenErr = 0x2c4,
358 NvRegRxUnicast = 0x2c8,
359 NvRegRxMulticast = 0x2cc,
360 NvRegRxBroadcast = 0x2d0,
361 NvRegTxDef = 0x2d4,
362 NvRegTxFrame = 0x2d8,
363 NvRegRxCnt = 0x2dc,
364 NvRegTxPause = 0x2e0,
365 NvRegRxPause = 0x2e4,
366 NvRegRxDropFrame = 0x2e8,
336 NvRegVlanControl = 0x300, 367 NvRegVlanControl = 0x300,
337#define NVREG_VLANCONTROL_ENABLE 0x2000 368#define NVREG_VLANCONTROL_ENABLE 0x2000
338 NvRegMSIXMap0 = 0x3e0, 369 NvRegMSIXMap0 = 0x3e0,
@@ -456,16 +487,18 @@ typedef union _ring_type {
456/* General driver defaults */ 487/* General driver defaults */
457#define NV_WATCHDOG_TIMEO (5*HZ) 488#define NV_WATCHDOG_TIMEO (5*HZ)
458 489
459#define RX_RING 128 490#define RX_RING_DEFAULT 128
460#define TX_RING 256 491#define TX_RING_DEFAULT 256
492#define RX_RING_MIN 128
493#define TX_RING_MIN 64
494#define RING_MAX_DESC_VER_1 1024
495#define RING_MAX_DESC_VER_2_3 16384
461/* 496/*
462 * If your nic mysteriously hangs then try to reduce the limits 497 * Difference between the get and put pointers for the tx ring.
463 * to 1/0: It might be required to set NV_TX_LASTPACKET in the 498 * This is used to throttle the amount of data outstanding in the
464 * last valid ring entry. But this would be impossible to 499 * tx ring.
465 * implement - probably a disassembly error.
466 */ 500 */
467#define TX_LIMIT_STOP 255 501#define TX_LIMIT_DIFFERENCE 1
468#define TX_LIMIT_START 254
469 502
470/* rx/tx mac addr + type + vlan + align + slack*/ 503/* rx/tx mac addr + type + vlan + align + slack*/
471#define NV_RX_HEADERS (64) 504#define NV_RX_HEADERS (64)
@@ -479,6 +512,7 @@ typedef union _ring_type {
479#define OOM_REFILL (1+HZ/20) 512#define OOM_REFILL (1+HZ/20)
480#define POLL_WAIT (1+HZ/100) 513#define POLL_WAIT (1+HZ/100)
481#define LINK_TIMEOUT (3*HZ) 514#define LINK_TIMEOUT (3*HZ)
515#define STATS_INTERVAL (10*HZ)
482 516
483/* 517/*
484 * desc_ver values: 518 * desc_ver values:
@@ -517,6 +551,9 @@ typedef union _ring_type {
517#define NV_PAUSEFRAME_TX_CAPABLE 0x0002 551#define NV_PAUSEFRAME_TX_CAPABLE 0x0002
518#define NV_PAUSEFRAME_RX_ENABLE 0x0004 552#define NV_PAUSEFRAME_RX_ENABLE 0x0004
519#define NV_PAUSEFRAME_TX_ENABLE 0x0008 553#define NV_PAUSEFRAME_TX_ENABLE 0x0008
554#define NV_PAUSEFRAME_RX_REQ 0x0010
555#define NV_PAUSEFRAME_TX_REQ 0x0020
556#define NV_PAUSEFRAME_AUTONEG 0x0040
520 557
521/* MSI/MSI-X defines */ 558/* MSI/MSI-X defines */
522#define NV_MSI_X_MAX_VECTORS 8 559#define NV_MSI_X_MAX_VECTORS 8
@@ -531,15 +568,110 @@ typedef union _ring_type {
531#define NV_MSI_X_VECTOR_TX 0x1 568#define NV_MSI_X_VECTOR_TX 0x1
532#define NV_MSI_X_VECTOR_OTHER 0x2 569#define NV_MSI_X_VECTOR_OTHER 0x2
533 570
571/* statistics */
572struct nv_ethtool_str {
573 char name[ETH_GSTRING_LEN];
574};
575
576static const struct nv_ethtool_str nv_estats_str[] = {
577 { "tx_bytes" },
578 { "tx_zero_rexmt" },
579 { "tx_one_rexmt" },
580 { "tx_many_rexmt" },
581 { "tx_late_collision" },
582 { "tx_fifo_errors" },
583 { "tx_carrier_errors" },
584 { "tx_excess_deferral" },
585 { "tx_retry_error" },
586 { "tx_deferral" },
587 { "tx_packets" },
588 { "tx_pause" },
589 { "rx_frame_error" },
590 { "rx_extra_byte" },
591 { "rx_late_collision" },
592 { "rx_runt" },
593 { "rx_frame_too_long" },
594 { "rx_over_errors" },
595 { "rx_crc_errors" },
596 { "rx_frame_align_error" },
597 { "rx_length_error" },
598 { "rx_unicast" },
599 { "rx_multicast" },
600 { "rx_broadcast" },
601 { "rx_bytes" },
602 { "rx_pause" },
603 { "rx_drop_frame" },
604 { "rx_packets" },
605 { "rx_errors_total" }
606};
607
608struct nv_ethtool_stats {
609 u64 tx_bytes;
610 u64 tx_zero_rexmt;
611 u64 tx_one_rexmt;
612 u64 tx_many_rexmt;
613 u64 tx_late_collision;
614 u64 tx_fifo_errors;
615 u64 tx_carrier_errors;
616 u64 tx_excess_deferral;
617 u64 tx_retry_error;
618 u64 tx_deferral;
619 u64 tx_packets;
620 u64 tx_pause;
621 u64 rx_frame_error;
622 u64 rx_extra_byte;
623 u64 rx_late_collision;
624 u64 rx_runt;
625 u64 rx_frame_too_long;
626 u64 rx_over_errors;
627 u64 rx_crc_errors;
628 u64 rx_frame_align_error;
629 u64 rx_length_error;
630 u64 rx_unicast;
631 u64 rx_multicast;
632 u64 rx_broadcast;
633 u64 rx_bytes;
634 u64 rx_pause;
635 u64 rx_drop_frame;
636 u64 rx_packets;
637 u64 rx_errors_total;
638};
639
640/* diagnostics */
641#define NV_TEST_COUNT_BASE 3
642#define NV_TEST_COUNT_EXTENDED 4
643
644static const struct nv_ethtool_str nv_etests_str[] = {
645 { "link (online/offline)" },
646 { "register (offline) " },
647 { "interrupt (offline) " },
648 { "loopback (offline) " }
649};
650
651struct register_test {
652 u32 reg;
653 u32 mask;
654};
655
656static const struct register_test nv_registers_test[] = {
657 { NvRegUnknownSetupReg6, 0x01 },
658 { NvRegMisc1, 0x03c },
659 { NvRegOffloadConfig, 0x03ff },
660 { NvRegMulticastAddrA, 0xffffffff },
661 { NvRegUnknownSetupReg3, 0x0ff },
662 { NvRegWakeUpFlags, 0x07777 },
663 { 0,0 }
664};
665
534/* 666/*
535 * SMP locking: 667 * SMP locking:
536 * All hardware access under dev->priv->lock, except the performance 668 * All hardware access under dev->priv->lock, except the performance
537 * critical parts: 669 * critical parts:
538 * - rx is (pseudo-) lockless: it relies on the single-threading provided 670 * - rx is (pseudo-) lockless: it relies on the single-threading provided
539 * by the arch code for interrupts. 671 * by the arch code for interrupts.
540 * - tx setup is lockless: it relies on dev->xmit_lock. Actual submission 672 * - tx setup is lockless: it relies on netif_tx_lock. Actual submission
541 * needs dev->priv->lock :-( 673 * needs dev->priv->lock :-(
542 * - set_multicast_list: preparation lockless, relies on dev->xmit_lock. 674 * - set_multicast_list: preparation lockless, relies on netif_tx_lock.
543 */ 675 */
544 676
545/* in dev: base, irq */ 677/* in dev: base, irq */
@@ -549,6 +681,7 @@ struct fe_priv {
549 /* General data: 681 /* General data:
550 * Locking: spin_lock(&np->lock); */ 682 * Locking: spin_lock(&np->lock); */
551 struct net_device_stats stats; 683 struct net_device_stats stats;
684 struct nv_ethtool_stats estats;
552 int in_shutdown; 685 int in_shutdown;
553 u32 linkspeed; 686 u32 linkspeed;
554 int duplex; 687 int duplex;
@@ -558,6 +691,7 @@ struct fe_priv {
558 int wolenabled; 691 int wolenabled;
559 unsigned int phy_oui; 692 unsigned int phy_oui;
560 u16 gigabit; 693 u16 gigabit;
694 int intr_test;
561 695
562 /* General data: RO fields */ 696 /* General data: RO fields */
563 dma_addr_t ring_addr; 697 dma_addr_t ring_addr;
@@ -577,13 +711,15 @@ struct fe_priv {
577 */ 711 */
578 ring_type rx_ring; 712 ring_type rx_ring;
579 unsigned int cur_rx, refill_rx; 713 unsigned int cur_rx, refill_rx;
580 struct sk_buff *rx_skbuff[RX_RING]; 714 struct sk_buff **rx_skbuff;
581 dma_addr_t rx_dma[RX_RING]; 715 dma_addr_t *rx_dma;
582 unsigned int rx_buf_sz; 716 unsigned int rx_buf_sz;
583 unsigned int pkt_limit; 717 unsigned int pkt_limit;
584 struct timer_list oom_kick; 718 struct timer_list oom_kick;
585 struct timer_list nic_poll; 719 struct timer_list nic_poll;
720 struct timer_list stats_poll;
586 u32 nic_poll_irq; 721 u32 nic_poll_irq;
722 int rx_ring_size;
587 723
588 /* media detection workaround. 724 /* media detection workaround.
589 * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); 725 * Locking: Within irq hander or disable_irq+spin_lock(&np->lock);
@@ -595,10 +731,13 @@ struct fe_priv {
595 */ 731 */
596 ring_type tx_ring; 732 ring_type tx_ring;
597 unsigned int next_tx, nic_tx; 733 unsigned int next_tx, nic_tx;
598 struct sk_buff *tx_skbuff[TX_RING]; 734 struct sk_buff **tx_skbuff;
599 dma_addr_t tx_dma[TX_RING]; 735 dma_addr_t *tx_dma;
600 unsigned int tx_dma_len[TX_RING]; 736 unsigned int *tx_dma_len;
601 u32 tx_flags; 737 u32 tx_flags;
738 int tx_ring_size;
739 int tx_limit_start;
740 int tx_limit_stop;
602 741
603 /* vlan fields */ 742 /* vlan fields */
604 struct vlan_group *vlangrp; 743 struct vlan_group *vlangrp;
@@ -623,8 +762,10 @@ static int max_interrupt_work = 5;
623 * Throughput Mode: Every tx and rx packet will generate an interrupt. 762 * Throughput Mode: Every tx and rx packet will generate an interrupt.
624 * CPU Mode: Interrupts are controlled by a timer. 763 * CPU Mode: Interrupts are controlled by a timer.
625 */ 764 */
626#define NV_OPTIMIZATION_MODE_THROUGHPUT 0 765enum {
627#define NV_OPTIMIZATION_MODE_CPU 1 766 NV_OPTIMIZATION_MODE_THROUGHPUT,
767 NV_OPTIMIZATION_MODE_CPU
768};
628static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT; 769static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT;
629 770
630/* 771/*
@@ -637,14 +778,31 @@ static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT;
637static int poll_interval = -1; 778static int poll_interval = -1;
638 779
639/* 780/*
640 * Disable MSI interrupts 781 * MSI interrupts
782 */
783enum {
784 NV_MSI_INT_DISABLED,
785 NV_MSI_INT_ENABLED
786};
787static int msi = NV_MSI_INT_ENABLED;
788
789/*
790 * MSIX interrupts
641 */ 791 */
642static int disable_msi = 0; 792enum {
793 NV_MSIX_INT_DISABLED,
794 NV_MSIX_INT_ENABLED
795};
796static int msix = NV_MSIX_INT_ENABLED;
643 797
644/* 798/*
645 * Disable MSIX interrupts 799 * DMA 64bit
646 */ 800 */
647static int disable_msix = 0; 801enum {
802 NV_DMA_64BIT_DISABLED,
803 NV_DMA_64BIT_ENABLED
804};
805static int dma_64bit = NV_DMA_64BIT_ENABLED;
648 806
649static inline struct fe_priv *get_nvpriv(struct net_device *dev) 807static inline struct fe_priv *get_nvpriv(struct net_device *dev)
650{ 808{
@@ -704,7 +862,7 @@ static void setup_hw_rings(struct net_device *dev, int rxtx_flags)
704 writel((u32) cpu_to_le64(np->ring_addr), base + NvRegRxRingPhysAddr); 862 writel((u32) cpu_to_le64(np->ring_addr), base + NvRegRxRingPhysAddr);
705 } 863 }
706 if (rxtx_flags & NV_SETUP_TX_RING) { 864 if (rxtx_flags & NV_SETUP_TX_RING) {
707 writel((u32) cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr); 865 writel((u32) cpu_to_le64(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr);
708 } 866 }
709 } else { 867 } else {
710 if (rxtx_flags & NV_SETUP_RX_RING) { 868 if (rxtx_flags & NV_SETUP_RX_RING) {
@@ -712,12 +870,37 @@ static void setup_hw_rings(struct net_device *dev, int rxtx_flags)
712 writel((u32) (cpu_to_le64(np->ring_addr) >> 32), base + NvRegRxRingPhysAddrHigh); 870 writel((u32) (cpu_to_le64(np->ring_addr) >> 32), base + NvRegRxRingPhysAddrHigh);
713 } 871 }
714 if (rxtx_flags & NV_SETUP_TX_RING) { 872 if (rxtx_flags & NV_SETUP_TX_RING) {
715 writel((u32) cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr); 873 writel((u32) cpu_to_le64(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr);
716 writel((u32) (cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)) >> 32), base + NvRegTxRingPhysAddrHigh); 874 writel((u32) (cpu_to_le64(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc_ex)) >> 32), base + NvRegTxRingPhysAddrHigh);
717 } 875 }
718 } 876 }
719} 877}
720 878
879static void free_rings(struct net_device *dev)
880{
881 struct fe_priv *np = get_nvpriv(dev);
882
883 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
884 if(np->rx_ring.orig)
885 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (np->rx_ring_size + np->tx_ring_size),
886 np->rx_ring.orig, np->ring_addr);
887 } else {
888 if (np->rx_ring.ex)
889 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (np->rx_ring_size + np->tx_ring_size),
890 np->rx_ring.ex, np->ring_addr);
891 }
892 if (np->rx_skbuff)
893 kfree(np->rx_skbuff);
894 if (np->rx_dma)
895 kfree(np->rx_dma);
896 if (np->tx_skbuff)
897 kfree(np->tx_skbuff);
898 if (np->tx_dma)
899 kfree(np->tx_dma);
900 if (np->tx_dma_len)
901 kfree(np->tx_dma_len);
902}
903
721static int using_multi_irqs(struct net_device *dev) 904static int using_multi_irqs(struct net_device *dev)
722{ 905{
723 struct fe_priv *np = get_nvpriv(dev); 906 struct fe_priv *np = get_nvpriv(dev);
@@ -1056,7 +1239,7 @@ static int nv_alloc_rx(struct net_device *dev)
1056 while (np->cur_rx != refill_rx) { 1239 while (np->cur_rx != refill_rx) {
1057 struct sk_buff *skb; 1240 struct sk_buff *skb;
1058 1241
1059 nr = refill_rx % RX_RING; 1242 nr = refill_rx % np->rx_ring_size;
1060 if (np->rx_skbuff[nr] == NULL) { 1243 if (np->rx_skbuff[nr] == NULL) {
1061 1244
1062 skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); 1245 skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD);
@@ -1085,7 +1268,7 @@ static int nv_alloc_rx(struct net_device *dev)
1085 refill_rx++; 1268 refill_rx++;
1086 } 1269 }
1087 np->refill_rx = refill_rx; 1270 np->refill_rx = refill_rx;
1088 if (np->cur_rx - refill_rx == RX_RING) 1271 if (np->cur_rx - refill_rx == np->rx_ring_size)
1089 return 1; 1272 return 1;
1090 return 0; 1273 return 0;
1091} 1274}
@@ -1124,9 +1307,9 @@ static void nv_init_rx(struct net_device *dev)
1124 struct fe_priv *np = netdev_priv(dev); 1307 struct fe_priv *np = netdev_priv(dev);
1125 int i; 1308 int i;
1126 1309
1127 np->cur_rx = RX_RING; 1310 np->cur_rx = np->rx_ring_size;
1128 np->refill_rx = 0; 1311 np->refill_rx = 0;
1129 for (i = 0; i < RX_RING; i++) 1312 for (i = 0; i < np->rx_ring_size; i++)
1130 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) 1313 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
1131 np->rx_ring.orig[i].FlagLen = 0; 1314 np->rx_ring.orig[i].FlagLen = 0;
1132 else 1315 else
@@ -1139,7 +1322,7 @@ static void nv_init_tx(struct net_device *dev)
1139 int i; 1322 int i;
1140 1323
1141 np->next_tx = np->nic_tx = 0; 1324 np->next_tx = np->nic_tx = 0;
1142 for (i = 0; i < TX_RING; i++) { 1325 for (i = 0; i < np->tx_ring_size; i++) {
1143 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) 1326 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
1144 np->tx_ring.orig[i].FlagLen = 0; 1327 np->tx_ring.orig[i].FlagLen = 0;
1145 else 1328 else
@@ -1184,7 +1367,7 @@ static void nv_drain_tx(struct net_device *dev)
1184 struct fe_priv *np = netdev_priv(dev); 1367 struct fe_priv *np = netdev_priv(dev);
1185 unsigned int i; 1368 unsigned int i;
1186 1369
1187 for (i = 0; i < TX_RING; i++) { 1370 for (i = 0; i < np->tx_ring_size; i++) {
1188 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) 1371 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
1189 np->tx_ring.orig[i].FlagLen = 0; 1372 np->tx_ring.orig[i].FlagLen = 0;
1190 else 1373 else
@@ -1198,7 +1381,7 @@ static void nv_drain_rx(struct net_device *dev)
1198{ 1381{
1199 struct fe_priv *np = netdev_priv(dev); 1382 struct fe_priv *np = netdev_priv(dev);
1200 int i; 1383 int i;
1201 for (i = 0; i < RX_RING; i++) { 1384 for (i = 0; i < np->rx_ring_size; i++) {
1202 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) 1385 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
1203 np->rx_ring.orig[i].FlagLen = 0; 1386 np->rx_ring.orig[i].FlagLen = 0;
1204 else 1387 else
@@ -1222,7 +1405,7 @@ static void drain_ring(struct net_device *dev)
1222 1405
1223/* 1406/*
1224 * nv_start_xmit: dev->hard_start_xmit function 1407 * nv_start_xmit: dev->hard_start_xmit function
1225 * Called with dev->xmit_lock held. 1408 * Called with netif_tx_lock held.
1226 */ 1409 */
1227static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) 1410static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1228{ 1411{
@@ -1230,8 +1413,8 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1230 u32 tx_flags = 0; 1413 u32 tx_flags = 0;
1231 u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); 1414 u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET);
1232 unsigned int fragments = skb_shinfo(skb)->nr_frags; 1415 unsigned int fragments = skb_shinfo(skb)->nr_frags;
1233 unsigned int nr = (np->next_tx - 1) % TX_RING; 1416 unsigned int nr = (np->next_tx - 1) % np->tx_ring_size;
1234 unsigned int start_nr = np->next_tx % TX_RING; 1417 unsigned int start_nr = np->next_tx % np->tx_ring_size;
1235 unsigned int i; 1418 unsigned int i;
1236 u32 offset = 0; 1419 u32 offset = 0;
1237 u32 bcnt; 1420 u32 bcnt;
@@ -1247,7 +1430,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1247 1430
1248 spin_lock_irq(&np->lock); 1431 spin_lock_irq(&np->lock);
1249 1432
1250 if ((np->next_tx - np->nic_tx + entries - 1) > TX_LIMIT_STOP) { 1433 if ((np->next_tx - np->nic_tx + entries - 1) > np->tx_limit_stop) {
1251 spin_unlock_irq(&np->lock); 1434 spin_unlock_irq(&np->lock);
1252 netif_stop_queue(dev); 1435 netif_stop_queue(dev);
1253 return NETDEV_TX_BUSY; 1436 return NETDEV_TX_BUSY;
@@ -1256,7 +1439,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1256 /* setup the header buffer */ 1439 /* setup the header buffer */
1257 do { 1440 do {
1258 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 1441 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size;
1259 nr = (nr + 1) % TX_RING; 1442 nr = (nr + 1) % np->tx_ring_size;
1260 1443
1261 np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 1444 np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
1262 PCI_DMA_TODEVICE); 1445 PCI_DMA_TODEVICE);
@@ -1283,7 +1466,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1283 1466
1284 do { 1467 do {
1285 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 1468 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size;
1286 nr = (nr + 1) % TX_RING; 1469 nr = (nr + 1) % np->tx_ring_size;
1287 1470
1288 np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, 1471 np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt,
1289 PCI_DMA_TODEVICE); 1472 PCI_DMA_TODEVICE);
@@ -1365,7 +1548,7 @@ static void nv_tx_done(struct net_device *dev)
1365 struct sk_buff *skb; 1548 struct sk_buff *skb;
1366 1549
1367 while (np->nic_tx != np->next_tx) { 1550 while (np->nic_tx != np->next_tx) {
1368 i = np->nic_tx % TX_RING; 1551 i = np->nic_tx % np->tx_ring_size;
1369 1552
1370 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) 1553 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
1371 Flags = le32_to_cpu(np->tx_ring.orig[i].FlagLen); 1554 Flags = le32_to_cpu(np->tx_ring.orig[i].FlagLen);
@@ -1410,13 +1593,13 @@ static void nv_tx_done(struct net_device *dev)
1410 nv_release_txskb(dev, i); 1593 nv_release_txskb(dev, i);
1411 np->nic_tx++; 1594 np->nic_tx++;
1412 } 1595 }
1413 if (np->next_tx - np->nic_tx < TX_LIMIT_START) 1596 if (np->next_tx - np->nic_tx < np->tx_limit_start)
1414 netif_wake_queue(dev); 1597 netif_wake_queue(dev);
1415} 1598}
1416 1599
1417/* 1600/*
1418 * nv_tx_timeout: dev->tx_timeout function 1601 * nv_tx_timeout: dev->tx_timeout function
1419 * Called with dev->xmit_lock held. 1602 * Called with netif_tx_lock held.
1420 */ 1603 */
1421static void nv_tx_timeout(struct net_device *dev) 1604static void nv_tx_timeout(struct net_device *dev)
1422{ 1605{
@@ -1447,7 +1630,7 @@ static void nv_tx_timeout(struct net_device *dev)
1447 readl(base + i + 24), readl(base + i + 28)); 1630 readl(base + i + 24), readl(base + i + 28));
1448 } 1631 }
1449 printk(KERN_INFO "%s: Dumping tx ring\n", dev->name); 1632 printk(KERN_INFO "%s: Dumping tx ring\n", dev->name);
1450 for (i=0;i<TX_RING;i+= 4) { 1633 for (i=0;i<np->tx_ring_size;i+= 4) {
1451 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { 1634 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
1452 printk(KERN_INFO "%03x: %08x %08x // %08x %08x // %08x %08x // %08x %08x\n", 1635 printk(KERN_INFO "%03x: %08x %08x // %08x %08x // %08x %08x // %08x %08x\n",
1453 i, 1636 i,
@@ -1563,10 +1746,10 @@ static void nv_rx_process(struct net_device *dev)
1563 struct sk_buff *skb; 1746 struct sk_buff *skb;
1564 int len; 1747 int len;
1565 int i; 1748 int i;
1566 if (np->cur_rx - np->refill_rx >= RX_RING) 1749 if (np->cur_rx - np->refill_rx >= np->rx_ring_size)
1567 break; /* we scanned the whole ring - do not continue */ 1750 break; /* we scanned the whole ring - do not continue */
1568 1751
1569 i = np->cur_rx % RX_RING; 1752 i = np->cur_rx % np->rx_ring_size;
1570 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { 1753 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
1571 Flags = le32_to_cpu(np->rx_ring.orig[i].FlagLen); 1754 Flags = le32_to_cpu(np->rx_ring.orig[i].FlagLen);
1572 len = nv_descr_getlength(&np->rx_ring.orig[i], np->desc_ver); 1755 len = nv_descr_getlength(&np->rx_ring.orig[i], np->desc_ver);
@@ -1673,14 +1856,16 @@ static void nv_rx_process(struct net_device *dev)
1673 } 1856 }
1674 } 1857 }
1675 } 1858 }
1676 Flags &= NV_RX2_CHECKSUMMASK; 1859 if (np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) {
1677 if (Flags == NV_RX2_CHECKSUMOK1 || 1860 Flags &= NV_RX2_CHECKSUMMASK;
1678 Flags == NV_RX2_CHECKSUMOK2 || 1861 if (Flags == NV_RX2_CHECKSUMOK1 ||
1679 Flags == NV_RX2_CHECKSUMOK3) { 1862 Flags == NV_RX2_CHECKSUMOK2 ||
1680 dprintk(KERN_DEBUG "%s: hw checksum hit!.\n", dev->name); 1863 Flags == NV_RX2_CHECKSUMOK3) {
1681 np->rx_skbuff[i]->ip_summed = CHECKSUM_UNNECESSARY; 1864 dprintk(KERN_DEBUG "%s: hw checksum hit!.\n", dev->name);
1682 } else { 1865 np->rx_skbuff[i]->ip_summed = CHECKSUM_UNNECESSARY;
1683 dprintk(KERN_DEBUG "%s: hwchecksum miss!.\n", dev->name); 1866 } else {
1867 dprintk(KERN_DEBUG "%s: hwchecksum miss!.\n", dev->name);
1868 }
1684 } 1869 }
1685 } 1870 }
1686 /* got a valid packet - forward it to the network core */ 1871 /* got a valid packet - forward it to the network core */
@@ -1745,7 +1930,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu)
1745 * Changing the MTU is a rare event, it shouldn't matter. 1930 * Changing the MTU is a rare event, it shouldn't matter.
1746 */ 1931 */
1747 nv_disable_irq(dev); 1932 nv_disable_irq(dev);
1748 spin_lock_bh(&dev->xmit_lock); 1933 netif_tx_lock_bh(dev);
1749 spin_lock(&np->lock); 1934 spin_lock(&np->lock);
1750 /* stop engines */ 1935 /* stop engines */
1751 nv_stop_rx(dev); 1936 nv_stop_rx(dev);
@@ -1755,18 +1940,15 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu)
1755 nv_drain_rx(dev); 1940 nv_drain_rx(dev);
1756 nv_drain_tx(dev); 1941 nv_drain_tx(dev);
1757 /* reinit driver view of the rx queue */ 1942 /* reinit driver view of the rx queue */
1758 nv_init_rx(dev);
1759 nv_init_tx(dev);
1760 /* alloc new rx buffers */
1761 set_bufsize(dev); 1943 set_bufsize(dev);
1762 if (nv_alloc_rx(dev)) { 1944 if (nv_init_ring(dev)) {
1763 if (!np->in_shutdown) 1945 if (!np->in_shutdown)
1764 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); 1946 mod_timer(&np->oom_kick, jiffies + OOM_REFILL);
1765 } 1947 }
1766 /* reinit nic view of the rx queue */ 1948 /* reinit nic view of the rx queue */
1767 writel(np->rx_buf_sz, base + NvRegOffloadConfig); 1949 writel(np->rx_buf_sz, base + NvRegOffloadConfig);
1768 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); 1950 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING);
1769 writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), 1951 writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT),
1770 base + NvRegRingSizes); 1952 base + NvRegRingSizes);
1771 pci_push(base); 1953 pci_push(base);
1772 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); 1954 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
@@ -1776,7 +1958,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu)
1776 nv_start_rx(dev); 1958 nv_start_rx(dev);
1777 nv_start_tx(dev); 1959 nv_start_tx(dev);
1778 spin_unlock(&np->lock); 1960 spin_unlock(&np->lock);
1779 spin_unlock_bh(&dev->xmit_lock); 1961 netif_tx_unlock_bh(dev);
1780 nv_enable_irq(dev); 1962 nv_enable_irq(dev);
1781 } 1963 }
1782 return 0; 1964 return 0;
@@ -1811,7 +1993,7 @@ static int nv_set_mac_address(struct net_device *dev, void *addr)
1811 memcpy(dev->dev_addr, macaddr->sa_data, ETH_ALEN); 1993 memcpy(dev->dev_addr, macaddr->sa_data, ETH_ALEN);
1812 1994
1813 if (netif_running(dev)) { 1995 if (netif_running(dev)) {
1814 spin_lock_bh(&dev->xmit_lock); 1996 netif_tx_lock_bh(dev);
1815 spin_lock_irq(&np->lock); 1997 spin_lock_irq(&np->lock);
1816 1998
1817 /* stop rx engine */ 1999 /* stop rx engine */
@@ -1823,7 +2005,7 @@ static int nv_set_mac_address(struct net_device *dev, void *addr)
1823 /* restart rx engine */ 2005 /* restart rx engine */
1824 nv_start_rx(dev); 2006 nv_start_rx(dev);
1825 spin_unlock_irq(&np->lock); 2007 spin_unlock_irq(&np->lock);
1826 spin_unlock_bh(&dev->xmit_lock); 2008 netif_tx_unlock_bh(dev);
1827 } else { 2009 } else {
1828 nv_copy_mac_to_hw(dev); 2010 nv_copy_mac_to_hw(dev);
1829 } 2011 }
@@ -1832,7 +2014,7 @@ static int nv_set_mac_address(struct net_device *dev, void *addr)
1832 2014
1833/* 2015/*
1834 * nv_set_multicast: dev->set_multicast function 2016 * nv_set_multicast: dev->set_multicast function
1835 * Called with dev->xmit_lock held. 2017 * Called with netif_tx_lock held.
1836 */ 2018 */
1837static void nv_set_multicast(struct net_device *dev) 2019static void nv_set_multicast(struct net_device *dev)
1838{ 2020{
@@ -1840,16 +2022,16 @@ static void nv_set_multicast(struct net_device *dev)
1840 u8 __iomem *base = get_hwbase(dev); 2022 u8 __iomem *base = get_hwbase(dev);
1841 u32 addr[2]; 2023 u32 addr[2];
1842 u32 mask[2]; 2024 u32 mask[2];
1843 u32 pff; 2025 u32 pff = readl(base + NvRegPacketFilterFlags) & NVREG_PFF_PAUSE_RX;
1844 2026
1845 memset(addr, 0, sizeof(addr)); 2027 memset(addr, 0, sizeof(addr));
1846 memset(mask, 0, sizeof(mask)); 2028 memset(mask, 0, sizeof(mask));
1847 2029
1848 if (dev->flags & IFF_PROMISC) { 2030 if (dev->flags & IFF_PROMISC) {
1849 printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); 2031 printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
1850 pff = NVREG_PFF_PROMISC; 2032 pff |= NVREG_PFF_PROMISC;
1851 } else { 2033 } else {
1852 pff = NVREG_PFF_MYADDR; 2034 pff |= NVREG_PFF_MYADDR;
1853 2035
1854 if (dev->flags & IFF_ALLMULTI || dev->mc_list) { 2036 if (dev->flags & IFF_ALLMULTI || dev->mc_list) {
1855 u32 alwaysOff[2]; 2037 u32 alwaysOff[2];
@@ -1894,6 +2076,35 @@ static void nv_set_multicast(struct net_device *dev)
1894 spin_unlock_irq(&np->lock); 2076 spin_unlock_irq(&np->lock);
1895} 2077}
1896 2078
2079void nv_update_pause(struct net_device *dev, u32 pause_flags)
2080{
2081 struct fe_priv *np = netdev_priv(dev);
2082 u8 __iomem *base = get_hwbase(dev);
2083
2084 np->pause_flags &= ~(NV_PAUSEFRAME_TX_ENABLE | NV_PAUSEFRAME_RX_ENABLE);
2085
2086 if (np->pause_flags & NV_PAUSEFRAME_RX_CAPABLE) {
2087 u32 pff = readl(base + NvRegPacketFilterFlags) & ~NVREG_PFF_PAUSE_RX;
2088 if (pause_flags & NV_PAUSEFRAME_RX_ENABLE) {
2089 writel(pff|NVREG_PFF_PAUSE_RX, base + NvRegPacketFilterFlags);
2090 np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE;
2091 } else {
2092 writel(pff, base + NvRegPacketFilterFlags);
2093 }
2094 }
2095 if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) {
2096 u32 regmisc = readl(base + NvRegMisc1) & ~NVREG_MISC1_PAUSE_TX;
2097 if (pause_flags & NV_PAUSEFRAME_TX_ENABLE) {
2098 writel(NVREG_TX_PAUSEFRAME_ENABLE, base + NvRegTxPauseFrame);
2099 writel(regmisc|NVREG_MISC1_PAUSE_TX, base + NvRegMisc1);
2100 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE;
2101 } else {
2102 writel(NVREG_TX_PAUSEFRAME_DISABLE, base + NvRegTxPauseFrame);
2103 writel(regmisc, base + NvRegMisc1);
2104 }
2105 }
2106}
2107
1897/** 2108/**
1898 * nv_update_linkspeed: Setup the MAC according to the link partner 2109 * nv_update_linkspeed: Setup the MAC according to the link partner
1899 * @dev: Network device to be configured 2110 * @dev: Network device to be configured
@@ -1916,7 +2127,7 @@ static int nv_update_linkspeed(struct net_device *dev)
1916 int newdup = np->duplex; 2127 int newdup = np->duplex;
1917 int mii_status; 2128 int mii_status;
1918 int retval = 0; 2129 int retval = 0;
1919 u32 control_1000, status_1000, phyreg; 2130 u32 control_1000, status_1000, phyreg, pause_flags;
1920 2131
1921 /* BMSR_LSTATUS is latched, read it twice: 2132 /* BMSR_LSTATUS is latched, read it twice:
1922 * we want the current value. 2133 * we want the current value.
@@ -1962,6 +2173,11 @@ static int nv_update_linkspeed(struct net_device *dev)
1962 goto set_speed; 2173 goto set_speed;
1963 } 2174 }
1964 2175
2176 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
2177 lpa = mii_rw(dev, np->phyaddr, MII_LPA, MII_READ);
2178 dprintk(KERN_DEBUG "%s: nv_update_linkspeed: PHY advertises 0x%04x, lpa 0x%04x.\n",
2179 dev->name, adv, lpa);
2180
1965 retval = 1; 2181 retval = 1;
1966 if (np->gigabit == PHY_GIGABIT) { 2182 if (np->gigabit == PHY_GIGABIT) {
1967 control_1000 = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); 2183 control_1000 = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ);
@@ -1977,11 +2193,6 @@ static int nv_update_linkspeed(struct net_device *dev)
1977 } 2193 }
1978 } 2194 }
1979 2195
1980 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
1981 lpa = mii_rw(dev, np->phyaddr, MII_LPA, MII_READ);
1982 dprintk(KERN_DEBUG "%s: nv_update_linkspeed: PHY advertises 0x%04x, lpa 0x%04x.\n",
1983 dev->name, adv, lpa);
1984
1985 /* FIXME: handle parallel detection properly */ 2196 /* FIXME: handle parallel detection properly */
1986 adv_lpa = lpa & adv; 2197 adv_lpa = lpa & adv;
1987 if (adv_lpa & LPA_100FULL) { 2198 if (adv_lpa & LPA_100FULL) {
@@ -2040,55 +2251,45 @@ set_speed:
2040 writel(np->linkspeed, base + NvRegLinkSpeed); 2251 writel(np->linkspeed, base + NvRegLinkSpeed);
2041 pci_push(base); 2252 pci_push(base);
2042 2253
2043 /* setup pause frame based on advertisement and link partner */ 2254 pause_flags = 0;
2044 np->pause_flags &= ~(NV_PAUSEFRAME_TX_ENABLE | NV_PAUSEFRAME_RX_ENABLE); 2255 /* setup pause frame */
2045
2046 if (np->duplex != 0) { 2256 if (np->duplex != 0) {
2047 adv_pause = adv & (ADVERTISE_PAUSE_CAP| ADVERTISE_PAUSE_ASYM); 2257 if (np->autoneg && np->pause_flags & NV_PAUSEFRAME_AUTONEG) {
2048 lpa_pause = lpa & (LPA_PAUSE_CAP| LPA_PAUSE_ASYM); 2258 adv_pause = adv & (ADVERTISE_PAUSE_CAP| ADVERTISE_PAUSE_ASYM);
2049 2259 lpa_pause = lpa & (LPA_PAUSE_CAP| LPA_PAUSE_ASYM);
2050 switch (adv_pause) { 2260
2051 case (ADVERTISE_PAUSE_CAP): 2261 switch (adv_pause) {
2052 if (lpa_pause & LPA_PAUSE_CAP) { 2262 case (ADVERTISE_PAUSE_CAP):
2053 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE | NV_PAUSEFRAME_RX_ENABLE; 2263 if (lpa_pause & LPA_PAUSE_CAP) {
2054 } 2264 pause_flags |= NV_PAUSEFRAME_RX_ENABLE;
2055 break; 2265 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ)
2056 case (ADVERTISE_PAUSE_ASYM): 2266 pause_flags |= NV_PAUSEFRAME_TX_ENABLE;
2057 if (lpa_pause == (LPA_PAUSE_CAP| LPA_PAUSE_ASYM)) 2267 }
2058 { 2268 break;
2059 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE; 2269 case (ADVERTISE_PAUSE_ASYM):
2060 } 2270 if (lpa_pause == (LPA_PAUSE_CAP| LPA_PAUSE_ASYM))
2061 break; 2271 {
2062 case (ADVERTISE_PAUSE_CAP| ADVERTISE_PAUSE_ASYM): 2272 pause_flags |= NV_PAUSEFRAME_TX_ENABLE;
2063 if (lpa_pause & LPA_PAUSE_CAP) 2273 }
2064 { 2274 break;
2065 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE | NV_PAUSEFRAME_RX_ENABLE; 2275 case (ADVERTISE_PAUSE_CAP| ADVERTISE_PAUSE_ASYM):
2066 } 2276 if (lpa_pause & LPA_PAUSE_CAP)
2067 if (lpa_pause == LPA_PAUSE_ASYM) 2277 {
2068 { 2278 pause_flags |= NV_PAUSEFRAME_RX_ENABLE;
2069 np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE; 2279 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ)
2280 pause_flags |= NV_PAUSEFRAME_TX_ENABLE;
2281 }
2282 if (lpa_pause == LPA_PAUSE_ASYM)
2283 {
2284 pause_flags |= NV_PAUSEFRAME_RX_ENABLE;
2285 }
2286 break;
2070 } 2287 }
2071 break;
2072 }
2073 }
2074
2075 if (np->pause_flags & NV_PAUSEFRAME_RX_CAPABLE) {
2076 u32 pff = readl(base + NvRegPacketFilterFlags) & ~NVREG_PFF_PAUSE_RX;
2077 if (np->pause_flags & NV_PAUSEFRAME_RX_ENABLE)
2078 writel(pff|NVREG_PFF_PAUSE_RX, base + NvRegPacketFilterFlags);
2079 else
2080 writel(pff, base + NvRegPacketFilterFlags);
2081 }
2082 if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) {
2083 u32 regmisc = readl(base + NvRegMisc1) & ~NVREG_MISC1_PAUSE_TX;
2084 if (np->pause_flags & NV_PAUSEFRAME_TX_ENABLE) {
2085 writel(NVREG_TX_PAUSEFRAME_ENABLE, base + NvRegTxPauseFrame);
2086 writel(regmisc|NVREG_MISC1_PAUSE_TX, base + NvRegMisc1);
2087 } else { 2288 } else {
2088 writel(NVREG_TX_PAUSEFRAME_DISABLE, base + NvRegTxPauseFrame); 2289 pause_flags = np->pause_flags;
2089 writel(regmisc, base + NvRegMisc1);
2090 } 2290 }
2091 } 2291 }
2292 nv_update_pause(dev, pause_flags);
2092 2293
2093 return retval; 2294 return retval;
2094} 2295}
@@ -2350,6 +2551,175 @@ static irqreturn_t nv_nic_irq_other(int foo, void *data, struct pt_regs *regs)
2350 return IRQ_RETVAL(i); 2551 return IRQ_RETVAL(i);
2351} 2552}
2352 2553
2554static irqreturn_t nv_nic_irq_test(int foo, void *data, struct pt_regs *regs)
2555{
2556 struct net_device *dev = (struct net_device *) data;
2557 struct fe_priv *np = netdev_priv(dev);
2558 u8 __iomem *base = get_hwbase(dev);
2559 u32 events;
2560
2561 dprintk(KERN_DEBUG "%s: nv_nic_irq_test\n", dev->name);
2562
2563 if (!(np->msi_flags & NV_MSI_X_ENABLED)) {
2564 events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK;
2565 writel(NVREG_IRQ_TIMER, base + NvRegIrqStatus);
2566 } else {
2567 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
2568 writel(NVREG_IRQ_TIMER, base + NvRegMSIXIrqStatus);
2569 }
2570 pci_push(base);
2571 dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events);
2572 if (!(events & NVREG_IRQ_TIMER))
2573 return IRQ_RETVAL(0);
2574
2575 spin_lock(&np->lock);
2576 np->intr_test = 1;
2577 spin_unlock(&np->lock);
2578
2579 dprintk(KERN_DEBUG "%s: nv_nic_irq_test completed\n", dev->name);
2580
2581 return IRQ_RETVAL(1);
2582}
2583
2584static void set_msix_vector_map(struct net_device *dev, u32 vector, u32 irqmask)
2585{
2586 u8 __iomem *base = get_hwbase(dev);
2587 int i;
2588 u32 msixmap = 0;
2589
2590 /* Each interrupt bit can be mapped to a MSIX vector (4 bits).
2591 * MSIXMap0 represents the first 8 interrupts and MSIXMap1 represents
2592 * the remaining 8 interrupts.
2593 */
2594 for (i = 0; i < 8; i++) {
2595 if ((irqmask >> i) & 0x1) {
2596 msixmap |= vector << (i << 2);
2597 }
2598 }
2599 writel(readl(base + NvRegMSIXMap0) | msixmap, base + NvRegMSIXMap0);
2600
2601 msixmap = 0;
2602 for (i = 0; i < 8; i++) {
2603 if ((irqmask >> (i + 8)) & 0x1) {
2604 msixmap |= vector << (i << 2);
2605 }
2606 }
2607 writel(readl(base + NvRegMSIXMap1) | msixmap, base + NvRegMSIXMap1);
2608}
2609
2610static int nv_request_irq(struct net_device *dev, int intr_test)
2611{
2612 struct fe_priv *np = get_nvpriv(dev);
2613 u8 __iomem *base = get_hwbase(dev);
2614 int ret = 1;
2615 int i;
2616
2617 if (np->msi_flags & NV_MSI_X_CAPABLE) {
2618 for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) {
2619 np->msi_x_entry[i].entry = i;
2620 }
2621 if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) {
2622 np->msi_flags |= NV_MSI_X_ENABLED;
2623 if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT && !intr_test) {
2624 /* Request irq for rx handling */
2625 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) {
2626 printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret);
2627 pci_disable_msix(np->pci_dev);
2628 np->msi_flags &= ~NV_MSI_X_ENABLED;
2629 goto out_err;
2630 }
2631 /* Request irq for tx handling */
2632 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) {
2633 printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret);
2634 pci_disable_msix(np->pci_dev);
2635 np->msi_flags &= ~NV_MSI_X_ENABLED;
2636 goto out_free_rx;
2637 }
2638 /* Request irq for link and timer handling */
2639 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) {
2640 printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret);
2641 pci_disable_msix(np->pci_dev);
2642 np->msi_flags &= ~NV_MSI_X_ENABLED;
2643 goto out_free_tx;
2644 }
2645 /* map interrupts to their respective vector */
2646 writel(0, base + NvRegMSIXMap0);
2647 writel(0, base + NvRegMSIXMap1);
2648 set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL);
2649 set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL);
2650 set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER);
2651 } else {
2652 /* Request irq for all interrupts */
2653 if ((!intr_test &&
2654 request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) ||
2655 (intr_test &&
2656 request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0)) {
2657 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
2658 pci_disable_msix(np->pci_dev);
2659 np->msi_flags &= ~NV_MSI_X_ENABLED;
2660 goto out_err;
2661 }
2662
2663 /* map interrupts to vector 0 */
2664 writel(0, base + NvRegMSIXMap0);
2665 writel(0, base + NvRegMSIXMap1);
2666 }
2667 }
2668 }
2669 if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) {
2670 if ((ret = pci_enable_msi(np->pci_dev)) == 0) {
2671 np->msi_flags |= NV_MSI_ENABLED;
2672 if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) ||
2673 (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0)) {
2674 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
2675 pci_disable_msi(np->pci_dev);
2676 np->msi_flags &= ~NV_MSI_ENABLED;
2677 goto out_err;
2678 }
2679
2680 /* map interrupts to vector 0 */
2681 writel(0, base + NvRegMSIMap0);
2682 writel(0, base + NvRegMSIMap1);
2683 /* enable msi vector 0 */
2684 writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask);
2685 }
2686 }
2687 if (ret != 0) {
2688 if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) ||
2689 (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0))
2690 goto out_err;
2691
2692 }
2693
2694 return 0;
2695out_free_tx:
2696 free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, dev);
2697out_free_rx:
2698 free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, dev);
2699out_err:
2700 return 1;
2701}
2702
2703static void nv_free_irq(struct net_device *dev)
2704{
2705 struct fe_priv *np = get_nvpriv(dev);
2706 int i;
2707
2708 if (np->msi_flags & NV_MSI_X_ENABLED) {
2709 for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) {
2710 free_irq(np->msi_x_entry[i].vector, dev);
2711 }
2712 pci_disable_msix(np->pci_dev);
2713 np->msi_flags &= ~NV_MSI_X_ENABLED;
2714 } else {
2715 free_irq(np->pci_dev->irq, dev);
2716 if (np->msi_flags & NV_MSI_ENABLED) {
2717 pci_disable_msi(np->pci_dev);
2718 np->msi_flags &= ~NV_MSI_ENABLED;
2719 }
2720 }
2721}
2722
2353static void nv_do_nic_poll(unsigned long data) 2723static void nv_do_nic_poll(unsigned long data)
2354{ 2724{
2355 struct net_device *dev = (struct net_device *) data; 2725 struct net_device *dev = (struct net_device *) data;
@@ -2419,6 +2789,56 @@ static void nv_poll_controller(struct net_device *dev)
2419} 2789}
2420#endif 2790#endif
2421 2791
2792static void nv_do_stats_poll(unsigned long data)
2793{
2794 struct net_device *dev = (struct net_device *) data;
2795 struct fe_priv *np = netdev_priv(dev);
2796 u8 __iomem *base = get_hwbase(dev);
2797
2798 np->estats.tx_bytes += readl(base + NvRegTxCnt);
2799 np->estats.tx_zero_rexmt += readl(base + NvRegTxZeroReXmt);
2800 np->estats.tx_one_rexmt += readl(base + NvRegTxOneReXmt);
2801 np->estats.tx_many_rexmt += readl(base + NvRegTxManyReXmt);
2802 np->estats.tx_late_collision += readl(base + NvRegTxLateCol);
2803 np->estats.tx_fifo_errors += readl(base + NvRegTxUnderflow);
2804 np->estats.tx_carrier_errors += readl(base + NvRegTxLossCarrier);
2805 np->estats.tx_excess_deferral += readl(base + NvRegTxExcessDef);
2806 np->estats.tx_retry_error += readl(base + NvRegTxRetryErr);
2807 np->estats.tx_deferral += readl(base + NvRegTxDef);
2808 np->estats.tx_packets += readl(base + NvRegTxFrame);
2809 np->estats.tx_pause += readl(base + NvRegTxPause);
2810 np->estats.rx_frame_error += readl(base + NvRegRxFrameErr);
2811 np->estats.rx_extra_byte += readl(base + NvRegRxExtraByte);
2812 np->estats.rx_late_collision += readl(base + NvRegRxLateCol);
2813 np->estats.rx_runt += readl(base + NvRegRxRunt);
2814 np->estats.rx_frame_too_long += readl(base + NvRegRxFrameTooLong);
2815 np->estats.rx_over_errors += readl(base + NvRegRxOverflow);
2816 np->estats.rx_crc_errors += readl(base + NvRegRxFCSErr);
2817 np->estats.rx_frame_align_error += readl(base + NvRegRxFrameAlignErr);
2818 np->estats.rx_length_error += readl(base + NvRegRxLenErr);
2819 np->estats.rx_unicast += readl(base + NvRegRxUnicast);
2820 np->estats.rx_multicast += readl(base + NvRegRxMulticast);
2821 np->estats.rx_broadcast += readl(base + NvRegRxBroadcast);
2822 np->estats.rx_bytes += readl(base + NvRegRxCnt);
2823 np->estats.rx_pause += readl(base + NvRegRxPause);
2824 np->estats.rx_drop_frame += readl(base + NvRegRxDropFrame);
2825 np->estats.rx_packets =
2826 np->estats.rx_unicast +
2827 np->estats.rx_multicast +
2828 np->estats.rx_broadcast;
2829 np->estats.rx_errors_total =
2830 np->estats.rx_crc_errors +
2831 np->estats.rx_over_errors +
2832 np->estats.rx_frame_error +
2833 (np->estats.rx_frame_align_error - np->estats.rx_extra_byte) +
2834 np->estats.rx_late_collision +
2835 np->estats.rx_runt +
2836 np->estats.rx_frame_too_long;
2837
2838 if (!np->in_shutdown)
2839 mod_timer(&np->stats_poll, jiffies + STATS_INTERVAL);
2840}
2841
2422static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 2842static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
2423{ 2843{
2424 struct fe_priv *np = netdev_priv(dev); 2844 struct fe_priv *np = netdev_priv(dev);
@@ -2442,17 +2862,19 @@ static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
2442{ 2862{
2443 struct fe_priv *np = netdev_priv(dev); 2863 struct fe_priv *np = netdev_priv(dev);
2444 u8 __iomem *base = get_hwbase(dev); 2864 u8 __iomem *base = get_hwbase(dev);
2865 u32 flags = 0;
2445 2866
2446 spin_lock_irq(&np->lock);
2447 if (wolinfo->wolopts == 0) { 2867 if (wolinfo->wolopts == 0) {
2448 writel(0, base + NvRegWakeUpFlags);
2449 np->wolenabled = 0; 2868 np->wolenabled = 0;
2450 } 2869 } else if (wolinfo->wolopts & WAKE_MAGIC) {
2451 if (wolinfo->wolopts & WAKE_MAGIC) {
2452 writel(NVREG_WAKEUPFLAGS_ENABLE, base + NvRegWakeUpFlags);
2453 np->wolenabled = 1; 2870 np->wolenabled = 1;
2871 flags = NVREG_WAKEUPFLAGS_ENABLE;
2872 }
2873 if (netif_running(dev)) {
2874 spin_lock_irq(&np->lock);
2875 writel(flags, base + NvRegWakeUpFlags);
2876 spin_unlock_irq(&np->lock);
2454 } 2877 }
2455 spin_unlock_irq(&np->lock);
2456 return 0; 2878 return 0;
2457} 2879}
2458 2880
@@ -2466,9 +2888,17 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2466 if (!netif_running(dev)) { 2888 if (!netif_running(dev)) {
2467 /* We do not track link speed / duplex setting if the 2889 /* We do not track link speed / duplex setting if the
2468 * interface is disabled. Force a link check */ 2890 * interface is disabled. Force a link check */
2469 nv_update_linkspeed(dev); 2891 if (nv_update_linkspeed(dev)) {
2892 if (!netif_carrier_ok(dev))
2893 netif_carrier_on(dev);
2894 } else {
2895 if (netif_carrier_ok(dev))
2896 netif_carrier_off(dev);
2897 }
2470 } 2898 }
2471 switch(np->linkspeed & (NVREG_LINKSPEED_MASK)) { 2899
2900 if (netif_carrier_ok(dev)) {
2901 switch(np->linkspeed & (NVREG_LINKSPEED_MASK)) {
2472 case NVREG_LINKSPEED_10: 2902 case NVREG_LINKSPEED_10:
2473 ecmd->speed = SPEED_10; 2903 ecmd->speed = SPEED_10;
2474 break; 2904 break;
@@ -2478,10 +2908,14 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2478 case NVREG_LINKSPEED_1000: 2908 case NVREG_LINKSPEED_1000:
2479 ecmd->speed = SPEED_1000; 2909 ecmd->speed = SPEED_1000;
2480 break; 2910 break;
2911 }
2912 ecmd->duplex = DUPLEX_HALF;
2913 if (np->duplex)
2914 ecmd->duplex = DUPLEX_FULL;
2915 } else {
2916 ecmd->speed = -1;
2917 ecmd->duplex = -1;
2481 } 2918 }
2482 ecmd->duplex = DUPLEX_HALF;
2483 if (np->duplex)
2484 ecmd->duplex = DUPLEX_FULL;
2485 2919
2486 ecmd->autoneg = np->autoneg; 2920 ecmd->autoneg = np->autoneg;
2487 2921
@@ -2489,23 +2923,20 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2489 if (np->autoneg) { 2923 if (np->autoneg) {
2490 ecmd->advertising |= ADVERTISED_Autoneg; 2924 ecmd->advertising |= ADVERTISED_Autoneg;
2491 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); 2925 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
2492 } else { 2926 if (adv & ADVERTISE_10HALF)
2493 adv = np->fixed_mode; 2927 ecmd->advertising |= ADVERTISED_10baseT_Half;
2494 } 2928 if (adv & ADVERTISE_10FULL)
2495 if (adv & ADVERTISE_10HALF) 2929 ecmd->advertising |= ADVERTISED_10baseT_Full;
2496 ecmd->advertising |= ADVERTISED_10baseT_Half; 2930 if (adv & ADVERTISE_100HALF)
2497 if (adv & ADVERTISE_10FULL) 2931 ecmd->advertising |= ADVERTISED_100baseT_Half;
2498 ecmd->advertising |= ADVERTISED_10baseT_Full; 2932 if (adv & ADVERTISE_100FULL)
2499 if (adv & ADVERTISE_100HALF) 2933 ecmd->advertising |= ADVERTISED_100baseT_Full;
2500 ecmd->advertising |= ADVERTISED_100baseT_Half; 2934 if (np->gigabit == PHY_GIGABIT) {
2501 if (adv & ADVERTISE_100FULL) 2935 adv = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ);
2502 ecmd->advertising |= ADVERTISED_100baseT_Full; 2936 if (adv & ADVERTISE_1000FULL)
2503 if (np->autoneg && np->gigabit == PHY_GIGABIT) { 2937 ecmd->advertising |= ADVERTISED_1000baseT_Full;
2504 adv = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); 2938 }
2505 if (adv & ADVERTISE_1000FULL)
2506 ecmd->advertising |= ADVERTISED_1000baseT_Full;
2507 } 2939 }
2508
2509 ecmd->supported = (SUPPORTED_Autoneg | 2940 ecmd->supported = (SUPPORTED_Autoneg |
2510 SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | 2941 SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
2511 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | 2942 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
@@ -2557,7 +2988,18 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2557 return -EINVAL; 2988 return -EINVAL;
2558 } 2989 }
2559 2990
2560 spin_lock_irq(&np->lock); 2991 netif_carrier_off(dev);
2992 if (netif_running(dev)) {
2993 nv_disable_irq(dev);
2994 spin_lock_bh(&dev->xmit_lock);
2995 spin_lock(&np->lock);
2996 /* stop engines */
2997 nv_stop_rx(dev);
2998 nv_stop_tx(dev);
2999 spin_unlock(&np->lock);
3000 spin_unlock_bh(&dev->xmit_lock);
3001 }
3002
2561 if (ecmd->autoneg == AUTONEG_ENABLE) { 3003 if (ecmd->autoneg == AUTONEG_ENABLE) {
2562 int adv, bmcr; 3004 int adv, bmcr;
2563 3005
@@ -2569,11 +3011,15 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2569 if (ecmd->advertising & ADVERTISED_10baseT_Half) 3011 if (ecmd->advertising & ADVERTISED_10baseT_Half)
2570 adv |= ADVERTISE_10HALF; 3012 adv |= ADVERTISE_10HALF;
2571 if (ecmd->advertising & ADVERTISED_10baseT_Full) 3013 if (ecmd->advertising & ADVERTISED_10baseT_Full)
2572 adv |= ADVERTISE_10FULL | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; 3014 adv |= ADVERTISE_10FULL;
2573 if (ecmd->advertising & ADVERTISED_100baseT_Half) 3015 if (ecmd->advertising & ADVERTISED_100baseT_Half)
2574 adv |= ADVERTISE_100HALF; 3016 adv |= ADVERTISE_100HALF;
2575 if (ecmd->advertising & ADVERTISED_100baseT_Full) 3017 if (ecmd->advertising & ADVERTISED_100baseT_Full)
2576 adv |= ADVERTISE_100FULL | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; 3018 adv |= ADVERTISE_100FULL;
3019 if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) /* for rx we set both advertisments but disable tx pause */
3020 adv |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
3021 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ)
3022 adv |= ADVERTISE_PAUSE_ASYM;
2577 mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); 3023 mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv);
2578 3024
2579 if (np->gigabit == PHY_GIGABIT) { 3025 if (np->gigabit == PHY_GIGABIT) {
@@ -2584,6 +3030,8 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2584 mii_rw(dev, np->phyaddr, MII_CTRL1000, adv); 3030 mii_rw(dev, np->phyaddr, MII_CTRL1000, adv);
2585 } 3031 }
2586 3032
3033 if (netif_running(dev))
3034 printk(KERN_INFO "%s: link down.\n", dev->name);
2587 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); 3035 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
2588 bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); 3036 bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
2589 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); 3037 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr);
@@ -2598,11 +3046,20 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2598 if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_HALF) 3046 if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_HALF)
2599 adv |= ADVERTISE_10HALF; 3047 adv |= ADVERTISE_10HALF;
2600 if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_FULL) 3048 if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_FULL)
2601 adv |= ADVERTISE_10FULL | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; 3049 adv |= ADVERTISE_10FULL;
2602 if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_HALF) 3050 if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_HALF)
2603 adv |= ADVERTISE_100HALF; 3051 adv |= ADVERTISE_100HALF;
2604 if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_FULL) 3052 if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_FULL)
2605 adv |= ADVERTISE_100FULL | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; 3053 adv |= ADVERTISE_100FULL;
3054 np->pause_flags &= ~(NV_PAUSEFRAME_AUTONEG|NV_PAUSEFRAME_RX_ENABLE|NV_PAUSEFRAME_TX_ENABLE);
3055 if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) {/* for rx we set both advertisments but disable tx pause */
3056 adv |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
3057 np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE;
3058 }
3059 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) {
3060 adv |= ADVERTISE_PAUSE_ASYM;
3061 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE;
3062 }
2606 mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); 3063 mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv);
2607 np->fixed_mode = adv; 3064 np->fixed_mode = adv;
2608 3065
@@ -2613,20 +3070,30 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2613 } 3070 }
2614 3071
2615 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); 3072 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
2616 bmcr |= ~(BMCR_ANENABLE|BMCR_SPEED100|BMCR_FULLDPLX); 3073 bmcr &= ~(BMCR_ANENABLE|BMCR_SPEED100|BMCR_SPEED1000|BMCR_FULLDPLX);
2617 if (adv & (ADVERTISE_10FULL|ADVERTISE_100FULL)) 3074 if (np->fixed_mode & (ADVERTISE_10FULL|ADVERTISE_100FULL))
2618 bmcr |= BMCR_FULLDPLX; 3075 bmcr |= BMCR_FULLDPLX;
2619 if (adv & (ADVERTISE_100HALF|ADVERTISE_100FULL)) 3076 if (np->fixed_mode & (ADVERTISE_100HALF|ADVERTISE_100FULL))
2620 bmcr |= BMCR_SPEED100; 3077 bmcr |= BMCR_SPEED100;
2621 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); 3078 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr);
2622 3079 if (np->phy_oui == PHY_OUI_MARVELL) {
2623 if (netif_running(dev)) { 3080 /* reset the phy */
3081 if (phy_reset(dev)) {
3082 printk(KERN_INFO "%s: phy reset failed\n", dev->name);
3083 return -EINVAL;
3084 }
3085 } else if (netif_running(dev)) {
2624 /* Wait a bit and then reconfigure the nic. */ 3086 /* Wait a bit and then reconfigure the nic. */
2625 udelay(10); 3087 udelay(10);
2626 nv_linkchange(dev); 3088 nv_linkchange(dev);
2627 } 3089 }
2628 } 3090 }
2629 spin_unlock_irq(&np->lock); 3091
3092 if (netif_running(dev)) {
3093 nv_start_rx(dev);
3094 nv_start_tx(dev);
3095 nv_enable_irq(dev);
3096 }
2630 3097
2631 return 0; 3098 return 0;
2632} 3099}
@@ -2658,24 +3125,39 @@ static int nv_nway_reset(struct net_device *dev)
2658 struct fe_priv *np = netdev_priv(dev); 3125 struct fe_priv *np = netdev_priv(dev);
2659 int ret; 3126 int ret;
2660 3127
2661 spin_lock_irq(&np->lock);
2662 if (np->autoneg) { 3128 if (np->autoneg) {
2663 int bmcr; 3129 int bmcr;
2664 3130
3131 netif_carrier_off(dev);
3132 if (netif_running(dev)) {
3133 nv_disable_irq(dev);
3134 spin_lock_bh(&dev->xmit_lock);
3135 spin_lock(&np->lock);
3136 /* stop engines */
3137 nv_stop_rx(dev);
3138 nv_stop_tx(dev);
3139 spin_unlock(&np->lock);
3140 spin_unlock_bh(&dev->xmit_lock);
3141 printk(KERN_INFO "%s: link down.\n", dev->name);
3142 }
3143
2665 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); 3144 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
2666 bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); 3145 bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
2667 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); 3146 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr);
2668 3147
3148 if (netif_running(dev)) {
3149 nv_start_rx(dev);
3150 nv_start_tx(dev);
3151 nv_enable_irq(dev);
3152 }
2669 ret = 0; 3153 ret = 0;
2670 } else { 3154 } else {
2671 ret = -EINVAL; 3155 ret = -EINVAL;
2672 } 3156 }
2673 spin_unlock_irq(&np->lock);
2674 3157
2675 return ret; 3158 return ret;
2676} 3159}
2677 3160
2678#ifdef NETIF_F_TSO
2679static int nv_set_tso(struct net_device *dev, u32 value) 3161static int nv_set_tso(struct net_device *dev, u32 value)
2680{ 3162{
2681 struct fe_priv *np = netdev_priv(dev); 3163 struct fe_priv *np = netdev_priv(dev);
@@ -2683,187 +3165,702 @@ static int nv_set_tso(struct net_device *dev, u32 value)
2683 if ((np->driver_data & DEV_HAS_CHECKSUM)) 3165 if ((np->driver_data & DEV_HAS_CHECKSUM))
2684 return ethtool_op_set_tso(dev, value); 3166 return ethtool_op_set_tso(dev, value);
2685 else 3167 else
2686 return value ? -EOPNOTSUPP : 0; 3168 return -EOPNOTSUPP;
2687} 3169}
2688#endif
2689 3170
2690static struct ethtool_ops ops = { 3171static void nv_get_ringparam(struct net_device *dev, struct ethtool_ringparam* ring)
2691 .get_drvinfo = nv_get_drvinfo, 3172{
2692 .get_link = ethtool_op_get_link, 3173 struct fe_priv *np = netdev_priv(dev);
2693 .get_wol = nv_get_wol,
2694 .set_wol = nv_set_wol,
2695 .get_settings = nv_get_settings,
2696 .set_settings = nv_set_settings,
2697 .get_regs_len = nv_get_regs_len,
2698 .get_regs = nv_get_regs,
2699 .nway_reset = nv_nway_reset,
2700 .get_perm_addr = ethtool_op_get_perm_addr,
2701#ifdef NETIF_F_TSO
2702 .get_tso = ethtool_op_get_tso,
2703 .set_tso = nv_set_tso
2704#endif
2705};
2706 3174
2707static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) 3175 ring->rx_max_pending = (np->desc_ver == DESC_VER_1) ? RING_MAX_DESC_VER_1 : RING_MAX_DESC_VER_2_3;
3176 ring->rx_mini_max_pending = 0;
3177 ring->rx_jumbo_max_pending = 0;
3178 ring->tx_max_pending = (np->desc_ver == DESC_VER_1) ? RING_MAX_DESC_VER_1 : RING_MAX_DESC_VER_2_3;
3179
3180 ring->rx_pending = np->rx_ring_size;
3181 ring->rx_mini_pending = 0;
3182 ring->rx_jumbo_pending = 0;
3183 ring->tx_pending = np->tx_ring_size;
3184}
3185
3186static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ring)
2708{ 3187{
2709 struct fe_priv *np = get_nvpriv(dev); 3188 struct fe_priv *np = netdev_priv(dev);
3189 u8 __iomem *base = get_hwbase(dev);
3190 u8 *rxtx_ring, *rx_skbuff, *tx_skbuff, *rx_dma, *tx_dma, *tx_dma_len;
3191 dma_addr_t ring_addr;
2710 3192
2711 spin_lock_irq(&np->lock); 3193 if (ring->rx_pending < RX_RING_MIN ||
3194 ring->tx_pending < TX_RING_MIN ||
3195 ring->rx_mini_pending != 0 ||
3196 ring->rx_jumbo_pending != 0 ||
3197 (np->desc_ver == DESC_VER_1 &&
3198 (ring->rx_pending > RING_MAX_DESC_VER_1 ||
3199 ring->tx_pending > RING_MAX_DESC_VER_1)) ||
3200 (np->desc_ver != DESC_VER_1 &&
3201 (ring->rx_pending > RING_MAX_DESC_VER_2_3 ||
3202 ring->tx_pending > RING_MAX_DESC_VER_2_3))) {
3203 return -EINVAL;
3204 }
2712 3205
2713 /* save vlan group */ 3206 /* allocate new rings */
2714 np->vlangrp = grp; 3207 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
3208 rxtx_ring = pci_alloc_consistent(np->pci_dev,
3209 sizeof(struct ring_desc) * (ring->rx_pending + ring->tx_pending),
3210 &ring_addr);
3211 } else {
3212 rxtx_ring = pci_alloc_consistent(np->pci_dev,
3213 sizeof(struct ring_desc_ex) * (ring->rx_pending + ring->tx_pending),
3214 &ring_addr);
3215 }
3216 rx_skbuff = kmalloc(sizeof(struct sk_buff*) * ring->rx_pending, GFP_KERNEL);
3217 rx_dma = kmalloc(sizeof(dma_addr_t) * ring->rx_pending, GFP_KERNEL);
3218 tx_skbuff = kmalloc(sizeof(struct sk_buff*) * ring->tx_pending, GFP_KERNEL);
3219 tx_dma = kmalloc(sizeof(dma_addr_t) * ring->tx_pending, GFP_KERNEL);
3220 tx_dma_len = kmalloc(sizeof(unsigned int) * ring->tx_pending, GFP_KERNEL);
3221 if (!rxtx_ring || !rx_skbuff || !rx_dma || !tx_skbuff || !tx_dma || !tx_dma_len) {
3222 /* fall back to old rings */
3223 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
3224 if(rxtx_ring)
3225 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (ring->rx_pending + ring->tx_pending),
3226 rxtx_ring, ring_addr);
3227 } else {
3228 if (rxtx_ring)
3229 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (ring->rx_pending + ring->tx_pending),
3230 rxtx_ring, ring_addr);
3231 }
3232 if (rx_skbuff)
3233 kfree(rx_skbuff);
3234 if (rx_dma)
3235 kfree(rx_dma);
3236 if (tx_skbuff)
3237 kfree(tx_skbuff);
3238 if (tx_dma)
3239 kfree(tx_dma);
3240 if (tx_dma_len)
3241 kfree(tx_dma_len);
3242 goto exit;
3243 }
2715 3244
2716 if (grp) { 3245 if (netif_running(dev)) {
2717 /* enable vlan on MAC */ 3246 nv_disable_irq(dev);
2718 np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP | NVREG_TXRXCTL_VLANINS; 3247 spin_lock_bh(&dev->xmit_lock);
3248 spin_lock(&np->lock);
3249 /* stop engines */
3250 nv_stop_rx(dev);
3251 nv_stop_tx(dev);
3252 nv_txrx_reset(dev);
3253 /* drain queues */
3254 nv_drain_rx(dev);
3255 nv_drain_tx(dev);
3256 /* delete queues */
3257 free_rings(dev);
3258 }
3259
3260 /* set new values */
3261 np->rx_ring_size = ring->rx_pending;
3262 np->tx_ring_size = ring->tx_pending;
3263 np->tx_limit_stop = ring->tx_pending - TX_LIMIT_DIFFERENCE;
3264 np->tx_limit_start = ring->tx_pending - TX_LIMIT_DIFFERENCE - 1;
3265 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
3266 np->rx_ring.orig = (struct ring_desc*)rxtx_ring;
3267 np->tx_ring.orig = &np->rx_ring.orig[np->rx_ring_size];
2719 } else { 3268 } else {
2720 /* disable vlan on MAC */ 3269 np->rx_ring.ex = (struct ring_desc_ex*)rxtx_ring;
2721 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP; 3270 np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size];
2722 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS;
2723 } 3271 }
3272 np->rx_skbuff = (struct sk_buff**)rx_skbuff;
3273 np->rx_dma = (dma_addr_t*)rx_dma;
3274 np->tx_skbuff = (struct sk_buff**)tx_skbuff;
3275 np->tx_dma = (dma_addr_t*)tx_dma;
3276 np->tx_dma_len = (unsigned int*)tx_dma_len;
3277 np->ring_addr = ring_addr;
3278
3279 memset(np->rx_skbuff, 0, sizeof(struct sk_buff*) * np->rx_ring_size);
3280 memset(np->rx_dma, 0, sizeof(dma_addr_t) * np->rx_ring_size);
3281 memset(np->tx_skbuff, 0, sizeof(struct sk_buff*) * np->tx_ring_size);
3282 memset(np->tx_dma, 0, sizeof(dma_addr_t) * np->tx_ring_size);
3283 memset(np->tx_dma_len, 0, sizeof(unsigned int) * np->tx_ring_size);
2724 3284
2725 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); 3285 if (netif_running(dev)) {
3286 /* reinit driver view of the queues */
3287 set_bufsize(dev);
3288 if (nv_init_ring(dev)) {
3289 if (!np->in_shutdown)
3290 mod_timer(&np->oom_kick, jiffies + OOM_REFILL);
3291 }
2726 3292
2727 spin_unlock_irq(&np->lock); 3293 /* reinit nic view of the queues */
2728}; 3294 writel(np->rx_buf_sz, base + NvRegOffloadConfig);
3295 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING);
3296 writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT),
3297 base + NvRegRingSizes);
3298 pci_push(base);
3299 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
3300 pci_push(base);
2729 3301
2730static void nv_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 3302 /* restart engines */
3303 nv_start_rx(dev);
3304 nv_start_tx(dev);
3305 spin_unlock(&np->lock);
3306 spin_unlock_bh(&dev->xmit_lock);
3307 nv_enable_irq(dev);
3308 }
3309 return 0;
3310exit:
3311 return -ENOMEM;
3312}
3313
3314static void nv_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam* pause)
2731{ 3315{
2732 /* nothing to do */ 3316 struct fe_priv *np = netdev_priv(dev);
2733};
2734 3317
2735static void set_msix_vector_map(struct net_device *dev, u32 vector, u32 irqmask) 3318 pause->autoneg = (np->pause_flags & NV_PAUSEFRAME_AUTONEG) != 0;
3319 pause->rx_pause = (np->pause_flags & NV_PAUSEFRAME_RX_ENABLE) != 0;
3320 pause->tx_pause = (np->pause_flags & NV_PAUSEFRAME_TX_ENABLE) != 0;
3321}
3322
3323static int nv_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam* pause)
3324{
3325 struct fe_priv *np = netdev_priv(dev);
3326 int adv, bmcr;
3327
3328 if ((!np->autoneg && np->duplex == 0) ||
3329 (np->autoneg && !pause->autoneg && np->duplex == 0)) {
3330 printk(KERN_INFO "%s: can not set pause settings when forced link is in half duplex.\n",
3331 dev->name);
3332 return -EINVAL;
3333 }
3334 if (pause->tx_pause && !(np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE)) {
3335 printk(KERN_INFO "%s: hardware does not support tx pause frames.\n", dev->name);
3336 return -EINVAL;
3337 }
3338
3339 netif_carrier_off(dev);
3340 if (netif_running(dev)) {
3341 nv_disable_irq(dev);
3342 spin_lock_bh(&dev->xmit_lock);
3343 spin_lock(&np->lock);
3344 /* stop engines */
3345 nv_stop_rx(dev);
3346 nv_stop_tx(dev);
3347 spin_unlock(&np->lock);
3348 spin_unlock_bh(&dev->xmit_lock);
3349 }
3350
3351 np->pause_flags &= ~(NV_PAUSEFRAME_RX_REQ|NV_PAUSEFRAME_TX_REQ);
3352 if (pause->rx_pause)
3353 np->pause_flags |= NV_PAUSEFRAME_RX_REQ;
3354 if (pause->tx_pause)
3355 np->pause_flags |= NV_PAUSEFRAME_TX_REQ;
3356
3357 if (np->autoneg && pause->autoneg) {
3358 np->pause_flags |= NV_PAUSEFRAME_AUTONEG;
3359
3360 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
3361 adv &= ~(ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
3362 if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) /* for rx we set both advertisments but disable tx pause */
3363 adv |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
3364 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ)
3365 adv |= ADVERTISE_PAUSE_ASYM;
3366 mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv);
3367
3368 if (netif_running(dev))
3369 printk(KERN_INFO "%s: link down.\n", dev->name);
3370 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
3371 bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
3372 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr);
3373 } else {
3374 np->pause_flags &= ~(NV_PAUSEFRAME_AUTONEG|NV_PAUSEFRAME_RX_ENABLE|NV_PAUSEFRAME_TX_ENABLE);
3375 if (pause->rx_pause)
3376 np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE;
3377 if (pause->tx_pause)
3378 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE;
3379
3380 if (!netif_running(dev))
3381 nv_update_linkspeed(dev);
3382 else
3383 nv_update_pause(dev, np->pause_flags);
3384 }
3385
3386 if (netif_running(dev)) {
3387 nv_start_rx(dev);
3388 nv_start_tx(dev);
3389 nv_enable_irq(dev);
3390 }
3391 return 0;
3392}
3393
3394static u32 nv_get_rx_csum(struct net_device *dev)
3395{
3396 struct fe_priv *np = netdev_priv(dev);
3397 return (np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) != 0;
3398}
3399
3400static int nv_set_rx_csum(struct net_device *dev, u32 data)
2736{ 3401{
3402 struct fe_priv *np = netdev_priv(dev);
2737 u8 __iomem *base = get_hwbase(dev); 3403 u8 __iomem *base = get_hwbase(dev);
2738 int i; 3404 int retcode = 0;
2739 u32 msixmap = 0;
2740 3405
2741 /* Each interrupt bit can be mapped to a MSIX vector (4 bits). 3406 if (np->driver_data & DEV_HAS_CHECKSUM) {
2742 * MSIXMap0 represents the first 8 interrupts and MSIXMap1 represents 3407
2743 * the remaining 8 interrupts. 3408 if (((np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) && data) ||
2744 */ 3409 (!(np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) && !data)) {
2745 for (i = 0; i < 8; i++) { 3410 /* already set or unset */
2746 if ((irqmask >> i) & 0x1) { 3411 return 0;
2747 msixmap |= vector << (i << 2);
2748 } 3412 }
2749 }
2750 writel(readl(base + NvRegMSIXMap0) | msixmap, base + NvRegMSIXMap0);
2751 3413
2752 msixmap = 0; 3414 if (data) {
2753 for (i = 0; i < 8; i++) { 3415 np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
2754 if ((irqmask >> (i + 8)) & 0x1) { 3416 } else if (!(np->vlanctl_bits & NVREG_VLANCONTROL_ENABLE)) {
2755 msixmap |= vector << (i << 2); 3417 np->txrxctl_bits &= ~NVREG_TXRXCTL_RXCHECK;
3418 } else {
3419 printk(KERN_INFO "Can not disable rx checksum if vlan is enabled\n");
3420 return -EINVAL;
2756 } 3421 }
3422
3423 if (netif_running(dev)) {
3424 spin_lock_irq(&np->lock);
3425 writel(np->txrxctl_bits, base + NvRegTxRxControl);
3426 spin_unlock_irq(&np->lock);
3427 }
3428 } else {
3429 return -EINVAL;
2757 } 3430 }
2758 writel(readl(base + NvRegMSIXMap1) | msixmap, base + NvRegMSIXMap1); 3431
3432 return retcode;
2759} 3433}
2760 3434
2761static int nv_request_irq(struct net_device *dev) 3435static int nv_set_tx_csum(struct net_device *dev, u32 data)
3436{
3437 struct fe_priv *np = netdev_priv(dev);
3438
3439 if (np->driver_data & DEV_HAS_CHECKSUM)
3440 return ethtool_op_set_tx_hw_csum(dev, data);
3441 else
3442 return -EOPNOTSUPP;
3443}
3444
3445static int nv_set_sg(struct net_device *dev, u32 data)
3446{
3447 struct fe_priv *np = netdev_priv(dev);
3448
3449 if (np->driver_data & DEV_HAS_CHECKSUM)
3450 return ethtool_op_set_sg(dev, data);
3451 else
3452 return -EOPNOTSUPP;
3453}
3454
3455static int nv_get_stats_count(struct net_device *dev)
3456{
3457 struct fe_priv *np = netdev_priv(dev);
3458
3459 if (np->driver_data & DEV_HAS_STATISTICS)
3460 return (sizeof(struct nv_ethtool_stats)/sizeof(u64));
3461 else
3462 return 0;
3463}
3464
3465static void nv_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *estats, u64 *buffer)
3466{
3467 struct fe_priv *np = netdev_priv(dev);
3468
3469 /* update stats */
3470 nv_do_stats_poll((unsigned long)dev);
3471
3472 memcpy(buffer, &np->estats, nv_get_stats_count(dev)*sizeof(u64));
3473}
3474
3475static int nv_self_test_count(struct net_device *dev)
3476{
3477 struct fe_priv *np = netdev_priv(dev);
3478
3479 if (np->driver_data & DEV_HAS_TEST_EXTENDED)
3480 return NV_TEST_COUNT_EXTENDED;
3481 else
3482 return NV_TEST_COUNT_BASE;
3483}
3484
3485static int nv_link_test(struct net_device *dev)
3486{
3487 struct fe_priv *np = netdev_priv(dev);
3488 int mii_status;
3489
3490 mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ);
3491 mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ);
3492
3493 /* check phy link status */
3494 if (!(mii_status & BMSR_LSTATUS))
3495 return 0;
3496 else
3497 return 1;
3498}
3499
3500static int nv_register_test(struct net_device *dev)
2762{ 3501{
2763 struct fe_priv *np = get_nvpriv(dev); 3502 u8 __iomem *base = get_hwbase(dev);
3503 int i = 0;
3504 u32 orig_read, new_read;
3505
3506 do {
3507 orig_read = readl(base + nv_registers_test[i].reg);
3508
3509 /* xor with mask to toggle bits */
3510 orig_read ^= nv_registers_test[i].mask;
3511
3512 writel(orig_read, base + nv_registers_test[i].reg);
3513
3514 new_read = readl(base + nv_registers_test[i].reg);
3515
3516 if ((new_read & nv_registers_test[i].mask) != (orig_read & nv_registers_test[i].mask))
3517 return 0;
3518
3519 /* restore original value */
3520 orig_read ^= nv_registers_test[i].mask;
3521 writel(orig_read, base + nv_registers_test[i].reg);
3522
3523 } while (nv_registers_test[++i].reg != 0);
3524
3525 return 1;
3526}
3527
3528static int nv_interrupt_test(struct net_device *dev)
3529{
3530 struct fe_priv *np = netdev_priv(dev);
2764 u8 __iomem *base = get_hwbase(dev); 3531 u8 __iomem *base = get_hwbase(dev);
2765 int ret = 1; 3532 int ret = 1;
2766 int i; 3533 int testcnt;
3534 u32 save_msi_flags, save_poll_interval = 0;
2767 3535
2768 if (np->msi_flags & NV_MSI_X_CAPABLE) { 3536 if (netif_running(dev)) {
2769 for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { 3537 /* free current irq */
2770 np->msi_x_entry[i].entry = i; 3538 nv_free_irq(dev);
3539 save_poll_interval = readl(base+NvRegPollingInterval);
3540 }
3541
3542 /* flag to test interrupt handler */
3543 np->intr_test = 0;
3544
3545 /* setup test irq */
3546 save_msi_flags = np->msi_flags;
3547 np->msi_flags &= ~NV_MSI_X_VECTORS_MASK;
3548 np->msi_flags |= 0x001; /* setup 1 vector */
3549 if (nv_request_irq(dev, 1))
3550 return 0;
3551
3552 /* setup timer interrupt */
3553 writel(NVREG_POLL_DEFAULT_CPU, base + NvRegPollingInterval);
3554 writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6);
3555
3556 nv_enable_hw_interrupts(dev, NVREG_IRQ_TIMER);
3557
3558 /* wait for at least one interrupt */
3559 msleep(100);
3560
3561 spin_lock_irq(&np->lock);
3562
3563 /* flag should be set within ISR */
3564 testcnt = np->intr_test;
3565 if (!testcnt)
3566 ret = 2;
3567
3568 nv_disable_hw_interrupts(dev, NVREG_IRQ_TIMER);
3569 if (!(np->msi_flags & NV_MSI_X_ENABLED))
3570 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
3571 else
3572 writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus);
3573
3574 spin_unlock_irq(&np->lock);
3575
3576 nv_free_irq(dev);
3577
3578 np->msi_flags = save_msi_flags;
3579
3580 if (netif_running(dev)) {
3581 writel(save_poll_interval, base + NvRegPollingInterval);
3582 writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6);
3583 /* restore original irq */
3584 if (nv_request_irq(dev, 0))
3585 return 0;
3586 }
3587
3588 return ret;
3589}
3590
3591static int nv_loopback_test(struct net_device *dev)
3592{
3593 struct fe_priv *np = netdev_priv(dev);
3594 u8 __iomem *base = get_hwbase(dev);
3595 struct sk_buff *tx_skb, *rx_skb;
3596 dma_addr_t test_dma_addr;
3597 u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET);
3598 u32 Flags;
3599 int len, i, pkt_len;
3600 u8 *pkt_data;
3601 u32 filter_flags = 0;
3602 u32 misc1_flags = 0;
3603 int ret = 1;
3604
3605 if (netif_running(dev)) {
3606 nv_disable_irq(dev);
3607 filter_flags = readl(base + NvRegPacketFilterFlags);
3608 misc1_flags = readl(base + NvRegMisc1);
3609 } else {
3610 nv_txrx_reset(dev);
3611 }
3612
3613 /* reinit driver view of the rx queue */
3614 set_bufsize(dev);
3615 nv_init_ring(dev);
3616
3617 /* setup hardware for loopback */
3618 writel(NVREG_MISC1_FORCE, base + NvRegMisc1);
3619 writel(NVREG_PFF_ALWAYS | NVREG_PFF_LOOPBACK, base + NvRegPacketFilterFlags);
3620
3621 /* reinit nic view of the rx queue */
3622 writel(np->rx_buf_sz, base + NvRegOffloadConfig);
3623 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING);
3624 writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT),
3625 base + NvRegRingSizes);
3626 pci_push(base);
3627
3628 /* restart rx engine */
3629 nv_start_rx(dev);
3630 nv_start_tx(dev);
3631
3632 /* setup packet for tx */
3633 pkt_len = ETH_DATA_LEN;
3634 tx_skb = dev_alloc_skb(pkt_len);
3635 pkt_data = skb_put(tx_skb, pkt_len);
3636 for (i = 0; i < pkt_len; i++)
3637 pkt_data[i] = (u8)(i & 0xff);
3638 test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data,
3639 tx_skb->end-tx_skb->data, PCI_DMA_FROMDEVICE);
3640
3641 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
3642 np->tx_ring.orig[0].PacketBuffer = cpu_to_le32(test_dma_addr);
3643 np->tx_ring.orig[0].FlagLen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra);
3644 } else {
3645 np->tx_ring.ex[0].PacketBufferHigh = cpu_to_le64(test_dma_addr) >> 32;
3646 np->tx_ring.ex[0].PacketBufferLow = cpu_to_le64(test_dma_addr) & 0x0FFFFFFFF;
3647 np->tx_ring.ex[0].FlagLen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra);
3648 }
3649 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
3650 pci_push(get_hwbase(dev));
3651
3652 msleep(500);
3653
3654 /* check for rx of the packet */
3655 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
3656 Flags = le32_to_cpu(np->rx_ring.orig[0].FlagLen);
3657 len = nv_descr_getlength(&np->rx_ring.orig[0], np->desc_ver);
3658
3659 } else {
3660 Flags = le32_to_cpu(np->rx_ring.ex[0].FlagLen);
3661 len = nv_descr_getlength_ex(&np->rx_ring.ex[0], np->desc_ver);
3662 }
3663
3664 if (Flags & NV_RX_AVAIL) {
3665 ret = 0;
3666 } else if (np->desc_ver == DESC_VER_1) {
3667 if (Flags & NV_RX_ERROR)
3668 ret = 0;
3669 } else {
3670 if (Flags & NV_RX2_ERROR) {
3671 ret = 0;
2771 } 3672 }
2772 if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) { 3673 }
2773 np->msi_flags |= NV_MSI_X_ENABLED;
2774 if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) {
2775 /* Request irq for rx handling */
2776 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) {
2777 printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret);
2778 pci_disable_msix(np->pci_dev);
2779 np->msi_flags &= ~NV_MSI_X_ENABLED;
2780 goto out_err;
2781 }
2782 /* Request irq for tx handling */
2783 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) {
2784 printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret);
2785 pci_disable_msix(np->pci_dev);
2786 np->msi_flags &= ~NV_MSI_X_ENABLED;
2787 goto out_free_rx;
2788 }
2789 /* Request irq for link and timer handling */
2790 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) {
2791 printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret);
2792 pci_disable_msix(np->pci_dev);
2793 np->msi_flags &= ~NV_MSI_X_ENABLED;
2794 goto out_free_tx;
2795 }
2796 /* map interrupts to their respective vector */
2797 writel(0, base + NvRegMSIXMap0);
2798 writel(0, base + NvRegMSIXMap1);
2799 set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL);
2800 set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL);
2801 set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER);
2802 } else {
2803 /* Request irq for all interrupts */
2804 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) {
2805 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
2806 pci_disable_msix(np->pci_dev);
2807 np->msi_flags &= ~NV_MSI_X_ENABLED;
2808 goto out_err;
2809 }
2810 3674
2811 /* map interrupts to vector 0 */ 3675 if (ret) {
2812 writel(0, base + NvRegMSIXMap0); 3676 if (len != pkt_len) {
2813 writel(0, base + NvRegMSIXMap1); 3677 ret = 0;
3678 dprintk(KERN_DEBUG "%s: loopback len mismatch %d vs %d\n",
3679 dev->name, len, pkt_len);
3680 } else {
3681 rx_skb = np->rx_skbuff[0];
3682 for (i = 0; i < pkt_len; i++) {
3683 if (rx_skb->data[i] != (u8)(i & 0xff)) {
3684 ret = 0;
3685 dprintk(KERN_DEBUG "%s: loopback pattern check failed on byte %d\n",
3686 dev->name, i);
3687 break;
3688 }
2814 } 3689 }
2815 } 3690 }
3691 } else {
3692 dprintk(KERN_DEBUG "%s: loopback - did not receive test packet\n", dev->name);
2816 } 3693 }
2817 if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { 3694
2818 if ((ret = pci_enable_msi(np->pci_dev)) == 0) { 3695 pci_unmap_page(np->pci_dev, test_dma_addr,
2819 np->msi_flags |= NV_MSI_ENABLED; 3696 tx_skb->end-tx_skb->data,
2820 if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { 3697 PCI_DMA_TODEVICE);
2821 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); 3698 dev_kfree_skb_any(tx_skb);
2822 pci_disable_msi(np->pci_dev); 3699
2823 np->msi_flags &= ~NV_MSI_ENABLED; 3700 /* stop engines */
2824 goto out_err; 3701 nv_stop_rx(dev);
3702 nv_stop_tx(dev);
3703 nv_txrx_reset(dev);
3704 /* drain rx queue */
3705 nv_drain_rx(dev);
3706 nv_drain_tx(dev);
3707
3708 if (netif_running(dev)) {
3709 writel(misc1_flags, base + NvRegMisc1);
3710 writel(filter_flags, base + NvRegPacketFilterFlags);
3711 nv_enable_irq(dev);
3712 }
3713
3714 return ret;
3715}
3716
3717static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 *buffer)
3718{
3719 struct fe_priv *np = netdev_priv(dev);
3720 u8 __iomem *base = get_hwbase(dev);
3721 int result;
3722 memset(buffer, 0, nv_self_test_count(dev)*sizeof(u64));
3723
3724 if (!nv_link_test(dev)) {
3725 test->flags |= ETH_TEST_FL_FAILED;
3726 buffer[0] = 1;
3727 }
3728
3729 if (test->flags & ETH_TEST_FL_OFFLINE) {
3730 if (netif_running(dev)) {
3731 netif_stop_queue(dev);
3732 spin_lock_bh(&dev->xmit_lock);
3733 spin_lock_irq(&np->lock);
3734 nv_disable_hw_interrupts(dev, np->irqmask);
3735 if (!(np->msi_flags & NV_MSI_X_ENABLED)) {
3736 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
3737 } else {
3738 writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus);
2825 } 3739 }
3740 /* stop engines */
3741 nv_stop_rx(dev);
3742 nv_stop_tx(dev);
3743 nv_txrx_reset(dev);
3744 /* drain rx queue */
3745 nv_drain_rx(dev);
3746 nv_drain_tx(dev);
3747 spin_unlock_irq(&np->lock);
3748 spin_unlock_bh(&dev->xmit_lock);
3749 }
2826 3750
2827 /* map interrupts to vector 0 */ 3751 if (!nv_register_test(dev)) {
2828 writel(0, base + NvRegMSIMap0); 3752 test->flags |= ETH_TEST_FL_FAILED;
2829 writel(0, base + NvRegMSIMap1); 3753 buffer[1] = 1;
2830 /* enable msi vector 0 */ 3754 }
2831 writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask); 3755
3756 result = nv_interrupt_test(dev);
3757 if (result != 1) {
3758 test->flags |= ETH_TEST_FL_FAILED;
3759 buffer[2] = 1;
3760 }
3761 if (result == 0) {
3762 /* bail out */
3763 return;
3764 }
3765
3766 if (!nv_loopback_test(dev)) {
3767 test->flags |= ETH_TEST_FL_FAILED;
3768 buffer[3] = 1;
3769 }
3770
3771 if (netif_running(dev)) {
3772 /* reinit driver view of the rx queue */
3773 set_bufsize(dev);
3774 if (nv_init_ring(dev)) {
3775 if (!np->in_shutdown)
3776 mod_timer(&np->oom_kick, jiffies + OOM_REFILL);
3777 }
3778 /* reinit nic view of the rx queue */
3779 writel(np->rx_buf_sz, base + NvRegOffloadConfig);
3780 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING);
3781 writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT),
3782 base + NvRegRingSizes);
3783 pci_push(base);
3784 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
3785 pci_push(base);
3786 /* restart rx engine */
3787 nv_start_rx(dev);
3788 nv_start_tx(dev);
3789 netif_start_queue(dev);
3790 nv_enable_hw_interrupts(dev, np->irqmask);
2832 } 3791 }
2833 } 3792 }
2834 if (ret != 0) { 3793}
2835 if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0)
2836 goto out_err;
2837 }
2838 3794
2839 return 0; 3795static void nv_get_strings(struct net_device *dev, u32 stringset, u8 *buffer)
2840out_free_tx: 3796{
2841 free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, dev); 3797 switch (stringset) {
2842out_free_rx: 3798 case ETH_SS_STATS:
2843 free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, dev); 3799 memcpy(buffer, &nv_estats_str, nv_get_stats_count(dev)*sizeof(struct nv_ethtool_str));
2844out_err: 3800 break;
2845 return 1; 3801 case ETH_SS_TEST:
3802 memcpy(buffer, &nv_etests_str, nv_self_test_count(dev)*sizeof(struct nv_ethtool_str));
3803 break;
3804 }
2846} 3805}
2847 3806
2848static void nv_free_irq(struct net_device *dev) 3807static struct ethtool_ops ops = {
3808 .get_drvinfo = nv_get_drvinfo,
3809 .get_link = ethtool_op_get_link,
3810 .get_wol = nv_get_wol,
3811 .set_wol = nv_set_wol,
3812 .get_settings = nv_get_settings,
3813 .set_settings = nv_set_settings,
3814 .get_regs_len = nv_get_regs_len,
3815 .get_regs = nv_get_regs,
3816 .nway_reset = nv_nway_reset,
3817 .get_perm_addr = ethtool_op_get_perm_addr,
3818 .get_tso = ethtool_op_get_tso,
3819 .set_tso = nv_set_tso,
3820 .get_ringparam = nv_get_ringparam,
3821 .set_ringparam = nv_set_ringparam,
3822 .get_pauseparam = nv_get_pauseparam,
3823 .set_pauseparam = nv_set_pauseparam,
3824 .get_rx_csum = nv_get_rx_csum,
3825 .set_rx_csum = nv_set_rx_csum,
3826 .get_tx_csum = ethtool_op_get_tx_csum,
3827 .set_tx_csum = nv_set_tx_csum,
3828 .get_sg = ethtool_op_get_sg,
3829 .set_sg = nv_set_sg,
3830 .get_strings = nv_get_strings,
3831 .get_stats_count = nv_get_stats_count,
3832 .get_ethtool_stats = nv_get_ethtool_stats,
3833 .self_test_count = nv_self_test_count,
3834 .self_test = nv_self_test,
3835};
3836
3837static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2849{ 3838{
2850 struct fe_priv *np = get_nvpriv(dev); 3839 struct fe_priv *np = get_nvpriv(dev);
2851 int i;
2852 3840
2853 if (np->msi_flags & NV_MSI_X_ENABLED) { 3841 spin_lock_irq(&np->lock);
2854 for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { 3842
2855 free_irq(np->msi_x_entry[i].vector, dev); 3843 /* save vlan group */
2856 } 3844 np->vlangrp = grp;
2857 pci_disable_msix(np->pci_dev); 3845
2858 np->msi_flags &= ~NV_MSI_X_ENABLED; 3846 if (grp) {
3847 /* enable vlan on MAC */
3848 np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP | NVREG_TXRXCTL_VLANINS;
2859 } else { 3849 } else {
2860 free_irq(np->pci_dev->irq, dev); 3850 /* disable vlan on MAC */
2861 if (np->msi_flags & NV_MSI_ENABLED) { 3851 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP;
2862 pci_disable_msi(np->pci_dev); 3852 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS;
2863 np->msi_flags &= ~NV_MSI_ENABLED;
2864 }
2865 } 3853 }
2866} 3854
3855 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
3856
3857 spin_unlock_irq(&np->lock);
3858};
3859
3860static void nv_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
3861{
3862 /* nothing to do */
3863};
2867 3864
2868static int nv_open(struct net_device *dev) 3865static int nv_open(struct net_device *dev)
2869{ 3866{
@@ -2908,7 +3905,7 @@ static int nv_open(struct net_device *dev)
2908 3905
2909 /* 4) give hw rings */ 3906 /* 4) give hw rings */
2910 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); 3907 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING);
2911 writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), 3908 writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT),
2912 base + NvRegRingSizes); 3909 base + NvRegRingSizes);
2913 3910
2914 /* 5) continue setup */ 3911 /* 5) continue setup */
@@ -2950,7 +3947,8 @@ static int nv_open(struct net_device *dev)
2950 base + NvRegAdapterControl); 3947 base + NvRegAdapterControl);
2951 writel(NVREG_MIISPEED_BIT8|NVREG_MIIDELAY, base + NvRegMIISpeed); 3948 writel(NVREG_MIISPEED_BIT8|NVREG_MIIDELAY, base + NvRegMIISpeed);
2952 writel(NVREG_UNKSETUP4_VAL, base + NvRegUnknownSetupReg4); 3949 writel(NVREG_UNKSETUP4_VAL, base + NvRegUnknownSetupReg4);
2953 writel(NVREG_WAKEUPFLAGS_VAL, base + NvRegWakeUpFlags); 3950 if (np->wolenabled)
3951 writel(NVREG_WAKEUPFLAGS_ENABLE , base + NvRegWakeUpFlags);
2954 3952
2955 i = readl(base + NvRegPowerState); 3953 i = readl(base + NvRegPowerState);
2956 if ( (i & NVREG_POWERSTATE_POWEREDUP) == 0) 3954 if ( (i & NVREG_POWERSTATE_POWEREDUP) == 0)
@@ -2966,7 +3964,7 @@ static int nv_open(struct net_device *dev)
2966 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); 3964 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
2967 pci_push(base); 3965 pci_push(base);
2968 3966
2969 if (nv_request_irq(dev)) { 3967 if (nv_request_irq(dev, 0)) {
2970 goto out_drain; 3968 goto out_drain;
2971 } 3969 }
2972 3970
@@ -3003,6 +4001,11 @@ static int nv_open(struct net_device *dev)
3003 } 4001 }
3004 if (oom) 4002 if (oom)
3005 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); 4003 mod_timer(&np->oom_kick, jiffies + OOM_REFILL);
4004
4005 /* start statistics timer */
4006 if (np->driver_data & DEV_HAS_STATISTICS)
4007 mod_timer(&np->stats_poll, jiffies + STATS_INTERVAL);
4008
3006 spin_unlock_irq(&np->lock); 4009 spin_unlock_irq(&np->lock);
3007 4010
3008 return 0; 4011 return 0;
@@ -3023,6 +4026,7 @@ static int nv_close(struct net_device *dev)
3023 4026
3024 del_timer_sync(&np->oom_kick); 4027 del_timer_sync(&np->oom_kick);
3025 del_timer_sync(&np->nic_poll); 4028 del_timer_sync(&np->nic_poll);
4029 del_timer_sync(&np->stats_poll);
3026 4030
3027 netif_stop_queue(dev); 4031 netif_stop_queue(dev);
3028 spin_lock_irq(&np->lock); 4032 spin_lock_irq(&np->lock);
@@ -3082,6 +4086,9 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
3082 init_timer(&np->nic_poll); 4086 init_timer(&np->nic_poll);
3083 np->nic_poll.data = (unsigned long) dev; 4087 np->nic_poll.data = (unsigned long) dev;
3084 np->nic_poll.function = &nv_do_nic_poll; /* timer handler */ 4088 np->nic_poll.function = &nv_do_nic_poll; /* timer handler */
4089 init_timer(&np->stats_poll);
4090 np->stats_poll.data = (unsigned long) dev;
4091 np->stats_poll.function = &nv_do_stats_poll; /* timer handler */
3085 4092
3086 err = pci_enable_device(pci_dev); 4093 err = pci_enable_device(pci_dev);
3087 if (err) { 4094 if (err) {
@@ -3096,7 +4103,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
3096 if (err < 0) 4103 if (err < 0)
3097 goto out_disable; 4104 goto out_disable;
3098 4105
3099 if (id->driver_data & (DEV_HAS_VLAN|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL)) 4106 if (id->driver_data & (DEV_HAS_VLAN|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_STATISTICS))
3100 np->register_size = NV_PCI_REGSZ_VER2; 4107 np->register_size = NV_PCI_REGSZ_VER2;
3101 else 4108 else
3102 np->register_size = NV_PCI_REGSZ_VER1; 4109 np->register_size = NV_PCI_REGSZ_VER1;
@@ -3128,16 +4135,18 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
3128 /* packet format 3: supports 40-bit addressing */ 4135 /* packet format 3: supports 40-bit addressing */
3129 np->desc_ver = DESC_VER_3; 4136 np->desc_ver = DESC_VER_3;
3130 np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; 4137 np->txrxctl_bits = NVREG_TXRXCTL_DESC_3;
3131 if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) { 4138 if (dma_64bit) {
3132 printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", 4139 if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) {
3133 pci_name(pci_dev)); 4140 printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n",
3134 } else { 4141 pci_name(pci_dev));
3135 dev->features |= NETIF_F_HIGHDMA; 4142 } else {
3136 printk(KERN_INFO "forcedeth: using HIGHDMA\n"); 4143 dev->features |= NETIF_F_HIGHDMA;
3137 } 4144 printk(KERN_INFO "forcedeth: using HIGHDMA\n");
3138 if (pci_set_consistent_dma_mask(pci_dev, 0x0000007fffffffffULL)) { 4145 }
3139 printk(KERN_INFO "forcedeth: 64-bit DMA (consistent) failed for device %s.\n", 4146 if (pci_set_consistent_dma_mask(pci_dev, DMA_39BIT_MASK)) {
3140 pci_name(pci_dev)); 4147 printk(KERN_INFO "forcedeth: 64-bit DMA (consistent) failed, using 32-bit ring buffers for device %s.\n",
4148 pci_name(pci_dev));
4149 }
3141 } 4150 }
3142 } else if (id->driver_data & DEV_HAS_LARGEDESC) { 4151 } else if (id->driver_data & DEV_HAS_LARGEDESC) {
3143 /* packet format 2: supports jumbo frames */ 4152 /* packet format 2: supports jumbo frames */
@@ -3170,16 +4179,16 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
3170 } 4179 }
3171 4180
3172 np->msi_flags = 0; 4181 np->msi_flags = 0;
3173 if ((id->driver_data & DEV_HAS_MSI) && !disable_msi) { 4182 if ((id->driver_data & DEV_HAS_MSI) && msi) {
3174 np->msi_flags |= NV_MSI_CAPABLE; 4183 np->msi_flags |= NV_MSI_CAPABLE;
3175 } 4184 }
3176 if ((id->driver_data & DEV_HAS_MSI_X) && !disable_msix) { 4185 if ((id->driver_data & DEV_HAS_MSI_X) && msix) {
3177 np->msi_flags |= NV_MSI_X_CAPABLE; 4186 np->msi_flags |= NV_MSI_X_CAPABLE;
3178 } 4187 }
3179 4188
3180 np->pause_flags = NV_PAUSEFRAME_RX_CAPABLE; 4189 np->pause_flags = NV_PAUSEFRAME_RX_CAPABLE | NV_PAUSEFRAME_RX_REQ | NV_PAUSEFRAME_AUTONEG;
3181 if (id->driver_data & DEV_HAS_PAUSEFRAME_TX) { 4190 if (id->driver_data & DEV_HAS_PAUSEFRAME_TX) {
3182 np->pause_flags |= NV_PAUSEFRAME_TX_CAPABLE; 4191 np->pause_flags |= NV_PAUSEFRAME_TX_CAPABLE | NV_PAUSEFRAME_TX_REQ;
3183 } 4192 }
3184 4193
3185 4194
@@ -3191,21 +4200,38 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
3191 4200
3192 dev->irq = pci_dev->irq; 4201 dev->irq = pci_dev->irq;
3193 4202
4203 np->rx_ring_size = RX_RING_DEFAULT;
4204 np->tx_ring_size = TX_RING_DEFAULT;
4205 np->tx_limit_stop = np->tx_ring_size - TX_LIMIT_DIFFERENCE;
4206 np->tx_limit_start = np->tx_ring_size - TX_LIMIT_DIFFERENCE - 1;
4207
3194 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { 4208 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
3195 np->rx_ring.orig = pci_alloc_consistent(pci_dev, 4209 np->rx_ring.orig = pci_alloc_consistent(pci_dev,
3196 sizeof(struct ring_desc) * (RX_RING + TX_RING), 4210 sizeof(struct ring_desc) * (np->rx_ring_size + np->tx_ring_size),
3197 &np->ring_addr); 4211 &np->ring_addr);
3198 if (!np->rx_ring.orig) 4212 if (!np->rx_ring.orig)
3199 goto out_unmap; 4213 goto out_unmap;
3200 np->tx_ring.orig = &np->rx_ring.orig[RX_RING]; 4214 np->tx_ring.orig = &np->rx_ring.orig[np->rx_ring_size];
3201 } else { 4215 } else {
3202 np->rx_ring.ex = pci_alloc_consistent(pci_dev, 4216 np->rx_ring.ex = pci_alloc_consistent(pci_dev,
3203 sizeof(struct ring_desc_ex) * (RX_RING + TX_RING), 4217 sizeof(struct ring_desc_ex) * (np->rx_ring_size + np->tx_ring_size),
3204 &np->ring_addr); 4218 &np->ring_addr);
3205 if (!np->rx_ring.ex) 4219 if (!np->rx_ring.ex)
3206 goto out_unmap; 4220 goto out_unmap;
3207 np->tx_ring.ex = &np->rx_ring.ex[RX_RING]; 4221 np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size];
3208 } 4222 }
4223 np->rx_skbuff = kmalloc(sizeof(struct sk_buff*) * np->rx_ring_size, GFP_KERNEL);
4224 np->rx_dma = kmalloc(sizeof(dma_addr_t) * np->rx_ring_size, GFP_KERNEL);
4225 np->tx_skbuff = kmalloc(sizeof(struct sk_buff*) * np->tx_ring_size, GFP_KERNEL);
4226 np->tx_dma = kmalloc(sizeof(dma_addr_t) * np->tx_ring_size, GFP_KERNEL);
4227 np->tx_dma_len = kmalloc(sizeof(unsigned int) * np->tx_ring_size, GFP_KERNEL);
4228 if (!np->rx_skbuff || !np->rx_dma || !np->tx_skbuff || !np->tx_dma || !np->tx_dma_len)
4229 goto out_freering;
4230 memset(np->rx_skbuff, 0, sizeof(struct sk_buff*) * np->rx_ring_size);
4231 memset(np->rx_dma, 0, sizeof(dma_addr_t) * np->rx_ring_size);
4232 memset(np->tx_skbuff, 0, sizeof(struct sk_buff*) * np->tx_ring_size);
4233 memset(np->tx_dma, 0, sizeof(dma_addr_t) * np->tx_ring_size);
4234 memset(np->tx_dma_len, 0, sizeof(unsigned int) * np->tx_ring_size);
3209 4235
3210 dev->open = nv_open; 4236 dev->open = nv_open;
3211 dev->stop = nv_close; 4237 dev->stop = nv_close;
@@ -3327,7 +4353,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
3327 if (i == 33) { 4353 if (i == 33) {
3328 printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", 4354 printk(KERN_INFO "%s: open: Could not find a valid PHY.\n",
3329 pci_name(pci_dev)); 4355 pci_name(pci_dev));
3330 goto out_freering; 4356 goto out_error;
3331 } 4357 }
3332 4358
3333 /* reset it */ 4359 /* reset it */
@@ -3341,7 +4367,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
3341 err = register_netdev(dev); 4367 err = register_netdev(dev);
3342 if (err) { 4368 if (err) {
3343 printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err); 4369 printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err);
3344 goto out_freering; 4370 goto out_error;
3345 } 4371 }
3346 printk(KERN_INFO "%s: forcedeth.c: subsystem: %05x:%04x bound to %s\n", 4372 printk(KERN_INFO "%s: forcedeth.c: subsystem: %05x:%04x bound to %s\n",
3347 dev->name, pci_dev->subsystem_vendor, pci_dev->subsystem_device, 4373 dev->name, pci_dev->subsystem_vendor, pci_dev->subsystem_device,
@@ -3349,14 +4375,10 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
3349 4375
3350 return 0; 4376 return 0;
3351 4377
3352out_freering: 4378out_error:
3353 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
3354 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (RX_RING + TX_RING),
3355 np->rx_ring.orig, np->ring_addr);
3356 else
3357 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (RX_RING + TX_RING),
3358 np->rx_ring.ex, np->ring_addr);
3359 pci_set_drvdata(pci_dev, NULL); 4379 pci_set_drvdata(pci_dev, NULL);
4380out_freering:
4381 free_rings(dev);
3360out_unmap: 4382out_unmap:
3361 iounmap(get_hwbase(dev)); 4383 iounmap(get_hwbase(dev));
3362out_relreg: 4384out_relreg:
@@ -3372,15 +4394,11 @@ out:
3372static void __devexit nv_remove(struct pci_dev *pci_dev) 4394static void __devexit nv_remove(struct pci_dev *pci_dev)
3373{ 4395{
3374 struct net_device *dev = pci_get_drvdata(pci_dev); 4396 struct net_device *dev = pci_get_drvdata(pci_dev);
3375 struct fe_priv *np = netdev_priv(dev);
3376 4397
3377 unregister_netdev(dev); 4398 unregister_netdev(dev);
3378 4399
3379 /* free all structures */ 4400 /* free all structures */
3380 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) 4401 free_rings(dev);
3381 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (RX_RING + TX_RING), np->rx_ring.orig, np->ring_addr);
3382 else
3383 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (RX_RING + TX_RING), np->rx_ring.ex, np->ring_addr);
3384 iounmap(get_hwbase(dev)); 4402 iounmap(get_hwbase(dev));
3385 pci_release_regions(pci_dev); 4403 pci_release_regions(pci_dev);
3386 pci_disable_device(pci_dev); 4404 pci_disable_device(pci_dev);
@@ -3443,11 +4461,43 @@ static struct pci_device_id pci_tbl[] = {
3443 }, 4461 },
3444 { /* MCP55 Ethernet Controller */ 4462 { /* MCP55 Ethernet Controller */
3445 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), 4463 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14),
3446 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX, 4464 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
3447 }, 4465 },
3448 { /* MCP55 Ethernet Controller */ 4466 { /* MCP55 Ethernet Controller */
3449 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), 4467 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15),
3450 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX, 4468 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
4469 },
4470 { /* MCP61 Ethernet Controller */
4471 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16),
4472 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
4473 },
4474 { /* MCP61 Ethernet Controller */
4475 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_17),
4476 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
4477 },
4478 { /* MCP61 Ethernet Controller */
4479 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_18),
4480 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
4481 },
4482 { /* MCP61 Ethernet Controller */
4483 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_19),
4484 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
4485 },
4486 { /* MCP65 Ethernet Controller */
4487 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20),
4488 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
4489 },
4490 { /* MCP65 Ethernet Controller */
4491 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21),
4492 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
4493 },
4494 { /* MCP65 Ethernet Controller */
4495 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22),
4496 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
4497 },
4498 { /* MCP65 Ethernet Controller */
4499 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23),
4500 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED,
3451 }, 4501 },
3452 {0,}, 4502 {0,},
3453}; 4503};
@@ -3477,10 +4527,12 @@ module_param(optimization_mode, int, 0);
3477MODULE_PARM_DESC(optimization_mode, "In throughput mode (0), every tx & rx packet will generate an interrupt. In CPU mode (1), interrupts are controlled by a timer."); 4527MODULE_PARM_DESC(optimization_mode, "In throughput mode (0), every tx & rx packet will generate an interrupt. In CPU mode (1), interrupts are controlled by a timer.");
3478module_param(poll_interval, int, 0); 4528module_param(poll_interval, int, 0);
3479MODULE_PARM_DESC(poll_interval, "Interval determines how frequent timer interrupt is generated by [(time_in_micro_secs * 100) / (2^10)]. Min is 0 and Max is 65535."); 4529MODULE_PARM_DESC(poll_interval, "Interval determines how frequent timer interrupt is generated by [(time_in_micro_secs * 100) / (2^10)]. Min is 0 and Max is 65535.");
3480module_param(disable_msi, int, 0); 4530module_param(msi, int, 0);
3481MODULE_PARM_DESC(disable_msi, "Disable MSI interrupts by setting to 1."); 4531MODULE_PARM_DESC(msi, "MSI interrupts are enabled by setting to 1 and disabled by setting to 0.");
3482module_param(disable_msix, int, 0); 4532module_param(msix, int, 0);
3483MODULE_PARM_DESC(disable_msix, "Disable MSIX interrupts by setting to 1."); 4533MODULE_PARM_DESC(msix, "MSIX interrupts are enabled by setting to 1 and disabled by setting to 0.");
4534module_param(dma_64bit, int, 0);
4535MODULE_PARM_DESC(dma_64bit, "High DMA is enabled by setting to 1 and disabled by setting to 0.");
3484 4536
3485MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); 4537MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>");
3486MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); 4538MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver");
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 102c1f0b90da..d12605f0ac7c 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -308,9 +308,9 @@ static int sp_set_mac_address(struct net_device *dev, void *addr)
308{ 308{
309 struct sockaddr_ax25 *sa = addr; 309 struct sockaddr_ax25 *sa = addr;
310 310
311 spin_lock_irq(&dev->xmit_lock); 311 netif_tx_lock_bh(dev);
312 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN); 312 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
313 spin_unlock_irq(&dev->xmit_lock); 313 netif_tx_unlock_bh(dev);
314 314
315 return 0; 315 return 0;
316} 316}
@@ -767,9 +767,9 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
767 break; 767 break;
768 } 768 }
769 769
770 spin_lock_irq(&dev->xmit_lock); 770 netif_tx_lock_bh(dev);
771 memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); 771 memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN);
772 spin_unlock_irq(&dev->xmit_lock); 772 netif_tx_unlock_bh(dev);
773 773
774 err = 0; 774 err = 0;
775 break; 775 break;
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index d81a8e1eeb8d..3ebbbe56b6e9 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -357,9 +357,9 @@ static int ax_set_mac_address(struct net_device *dev, void *addr)
357{ 357{
358 struct sockaddr_ax25 *sa = addr; 358 struct sockaddr_ax25 *sa = addr;
359 359
360 spin_lock_irq(&dev->xmit_lock); 360 netif_tx_lock_bh(dev);
361 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN); 361 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
362 spin_unlock_irq(&dev->xmit_lock); 362 netif_tx_unlock_bh(dev);
363 363
364 return 0; 364 return 0;
365} 365}
@@ -886,9 +886,9 @@ static int mkiss_ioctl(struct tty_struct *tty, struct file *file,
886 break; 886 break;
887 } 887 }
888 888
889 spin_lock_irq(&dev->xmit_lock); 889 netif_tx_lock_bh(dev);
890 memcpy(dev->dev_addr, addr, AX25_ADDR_LEN); 890 memcpy(dev->dev_addr, addr, AX25_ADDR_LEN);
891 spin_unlock_irq(&dev->xmit_lock); 891 netif_tx_unlock_bh(dev);
892 892
893 err = 0; 893 err = 0;
894 break; 894 break;
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index 0d7a6250e346..e26a3e407d70 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -446,7 +446,7 @@ MODULE_LICENSE("GPL");
446 446
447/* This is set up so that only a single autoprobe takes place per call. 447/* This is set up so that only a single autoprobe takes place per call.
448ISA device autoprobes on a running machine are not recommended. */ 448ISA device autoprobes on a running machine are not recommended. */
449int 449int __init
450init_module(void) 450init_module(void)
451{ 451{
452 struct net_device *dev; 452 struct net_device *dev;
diff --git a/drivers/net/hp.c b/drivers/net/hp.c
index cf9fb3698a6b..551a71b3c5fd 100644
--- a/drivers/net/hp.c
+++ b/drivers/net/hp.c
@@ -384,7 +384,7 @@ hp_block_output(struct net_device *dev, int count,
384} 384}
385 385
386/* This function resets the ethercard if something screws up. */ 386/* This function resets the ethercard if something screws up. */
387static void 387static void __init
388hp_init_card(struct net_device *dev) 388hp_init_card(struct net_device *dev)
389{ 389{
390 int irq = dev->irq; 390 int irq = dev->irq;
@@ -409,7 +409,7 @@ MODULE_LICENSE("GPL");
409 409
410/* This is set up so that only a single autoprobe takes place per call. 410/* This is set up so that only a single autoprobe takes place per call.
411ISA device autoprobes on a running machine are not recommended. */ 411ISA device autoprobes on a running machine are not recommended. */
412int 412int __init
413init_module(void) 413init_module(void)
414{ 414{
415 struct net_device *dev; 415 struct net_device *dev;
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 31fb2d75dc44..2e222ef91e22 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -76,13 +76,13 @@ static void ri_tasklet(unsigned long dev)
76 dp->st_task_enter++; 76 dp->st_task_enter++;
77 if ((skb = skb_peek(&dp->tq)) == NULL) { 77 if ((skb = skb_peek(&dp->tq)) == NULL) {
78 dp->st_txq_refl_try++; 78 dp->st_txq_refl_try++;
79 if (spin_trylock(&_dev->xmit_lock)) { 79 if (netif_tx_trylock(_dev)) {
80 dp->st_rxq_enter++; 80 dp->st_rxq_enter++;
81 while ((skb = skb_dequeue(&dp->rq)) != NULL) { 81 while ((skb = skb_dequeue(&dp->rq)) != NULL) {
82 skb_queue_tail(&dp->tq, skb); 82 skb_queue_tail(&dp->tq, skb);
83 dp->st_rx2tx_tran++; 83 dp->st_rx2tx_tran++;
84 } 84 }
85 spin_unlock(&_dev->xmit_lock); 85 netif_tx_unlock(_dev);
86 } else { 86 } else {
87 /* reschedule */ 87 /* reschedule */
88 dp->st_rxq_notenter++; 88 dp->st_rxq_notenter++;
@@ -110,7 +110,7 @@ static void ri_tasklet(unsigned long dev)
110 } 110 }
111 } 111 }
112 112
113 if (spin_trylock(&_dev->xmit_lock)) { 113 if (netif_tx_trylock(_dev)) {
114 dp->st_rxq_check++; 114 dp->st_rxq_check++;
115 if ((skb = skb_peek(&dp->rq)) == NULL) { 115 if ((skb = skb_peek(&dp->rq)) == NULL) {
116 dp->tasklet_pending = 0; 116 dp->tasklet_pending = 0;
@@ -118,10 +118,10 @@ static void ri_tasklet(unsigned long dev)
118 netif_wake_queue(_dev); 118 netif_wake_queue(_dev);
119 } else { 119 } else {
120 dp->st_rxq_rsch++; 120 dp->st_rxq_rsch++;
121 spin_unlock(&_dev->xmit_lock); 121 netif_tx_unlock(_dev);
122 goto resched; 122 goto resched;
123 } 123 }
124 spin_unlock(&_dev->xmit_lock); 124 netif_tx_unlock(_dev);
125 } else { 125 } else {
126resched: 126resched:
127 dp->tasklet_pending = 1; 127 dp->tasklet_pending = 1;
diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig
index cff8598aa800..d2ce4896abff 100644
--- a/drivers/net/irda/Kconfig
+++ b/drivers/net/irda/Kconfig
@@ -417,5 +417,20 @@ config PXA_FICP
417 available capabilities may vary from one PXA2xx target to 417 available capabilities may vary from one PXA2xx target to
418 another. 418 another.
419 419
420config MCS_FIR
421 tristate "MosChip MCS7780 IrDA-USB dongle"
422 depends on IRDA && USB && EXPERIMENTAL
423 help
424 Say Y or M here if you want to build support for the MosChip
425 MCS7780 IrDA-USB bridge device driver.
426
427 USB bridge based on the MosChip MCS7780 don't conform to the
428 IrDA-USB device class specification, and therefore need their
429 own specific driver. Those dongles support SIR and FIR (4Mbps)
430 speeds.
431
432 To compile it as a module, choose M here: the module will be called
433 mcs7780.
434
420endmenu 435endmenu
421 436
diff --git a/drivers/net/irda/Makefile b/drivers/net/irda/Makefile
index c1ce2398efea..5be09f1b9ee2 100644
--- a/drivers/net/irda/Makefile
+++ b/drivers/net/irda/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_ALI_FIR) += ali-ircc.o
19obj-$(CONFIG_VLSI_FIR) += vlsi_ir.o 19obj-$(CONFIG_VLSI_FIR) += vlsi_ir.o
20obj-$(CONFIG_VIA_FIR) += via-ircc.o 20obj-$(CONFIG_VIA_FIR) += via-ircc.o
21obj-$(CONFIG_PXA_FICP) += pxaficp_ir.o 21obj-$(CONFIG_PXA_FICP) += pxaficp_ir.o
22obj-$(CONFIG_MCS_FIR) += mcs7780.o
22# Old dongle drivers for old SIR drivers 23# Old dongle drivers for old SIR drivers
23obj-$(CONFIG_ESI_DONGLE_OLD) += esi.o 24obj-$(CONFIG_ESI_DONGLE_OLD) += esi.o
24obj-$(CONFIG_TEKRAM_DONGLE_OLD) += tekram.o 25obj-$(CONFIG_TEKRAM_DONGLE_OLD) += tekram.o
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 2e7882eb7d6f..bf1fca5a3fa0 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -34,14 +34,12 @@
34#include <linux/rtnetlink.h> 34#include <linux/rtnetlink.h>
35#include <linux/serial_reg.h> 35#include <linux/serial_reg.h>
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/platform_device.h>
37 38
38#include <asm/io.h> 39#include <asm/io.h>
39#include <asm/dma.h> 40#include <asm/dma.h>
40#include <asm/byteorder.h> 41#include <asm/byteorder.h>
41 42
42#include <linux/pm.h>
43#include <linux/pm_legacy.h>
44
45#include <net/irda/wrapper.h> 43#include <net/irda/wrapper.h>
46#include <net/irda/irda.h> 44#include <net/irda/irda.h>
47#include <net/irda/irda_device.h> 45#include <net/irda/irda_device.h>
@@ -51,7 +49,19 @@
51#define CHIP_IO_EXTENT 8 49#define CHIP_IO_EXTENT 8
52#define BROKEN_DONGLE_ID 50#define BROKEN_DONGLE_ID
53 51
54static char *driver_name = "ali-ircc"; 52#define ALI_IRCC_DRIVER_NAME "ali-ircc"
53
54/* Power Management */
55static int ali_ircc_suspend(struct platform_device *dev, pm_message_t state);
56static int ali_ircc_resume(struct platform_device *dev);
57
58static struct platform_driver ali_ircc_driver = {
59 .suspend = ali_ircc_suspend,
60 .resume = ali_ircc_resume,
61 .driver = {
62 .name = ALI_IRCC_DRIVER_NAME,
63 },
64};
55 65
56/* Module parameters */ 66/* Module parameters */
57static int qos_mtt_bits = 0x07; /* 1 ms or more */ 67static int qos_mtt_bits = 0x07; /* 1 ms or more */
@@ -97,10 +107,7 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self);
97static int ali_ircc_net_open(struct net_device *dev); 107static int ali_ircc_net_open(struct net_device *dev);
98static int ali_ircc_net_close(struct net_device *dev); 108static int ali_ircc_net_close(struct net_device *dev);
99static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 109static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
100static int ali_ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data);
101static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud); 110static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud);
102static void ali_ircc_suspend(struct ali_ircc_cb *self);
103static void ali_ircc_wakeup(struct ali_ircc_cb *self);
104static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev); 111static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev);
105 112
106/* SIR function */ 113/* SIR function */
@@ -145,6 +152,14 @@ static int __init ali_ircc_init(void)
145 int i = 0; 152 int i = 0;
146 153
147 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 154 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
155
156 ret = platform_driver_register(&ali_ircc_driver);
157 if (ret) {
158 IRDA_ERROR("%s, Can't register driver!\n",
159 ALI_IRCC_DRIVER_NAME);
160 return ret;
161 }
162
148 163
149 /* Probe for all the ALi chipsets we know about */ 164 /* Probe for all the ALi chipsets we know about */
150 for (chip= chips; chip->name; chip++, i++) 165 for (chip= chips; chip->name; chip++, i++)
@@ -214,6 +229,10 @@ static int __init ali_ircc_init(void)
214 } 229 }
215 230
216 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 231 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__);
232
233 if (ret)
234 platform_driver_unregister(&ali_ircc_driver);
235
217 return ret; 236 return ret;
218} 237}
219 238
@@ -228,14 +247,14 @@ static void __exit ali_ircc_cleanup(void)
228 int i; 247 int i;
229 248
230 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 249 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
231
232 pm_unregister_all(ali_ircc_pmproc);
233 250
234 for (i=0; i < 4; i++) { 251 for (i=0; i < 4; i++) {
235 if (dev_self[i]) 252 if (dev_self[i])
236 ali_ircc_close(dev_self[i]); 253 ali_ircc_close(dev_self[i]);
237 } 254 }
238 255
256 platform_driver_unregister(&ali_ircc_driver);
257
239 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 258 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__);
240} 259}
241 260
@@ -249,7 +268,6 @@ static int ali_ircc_open(int i, chipio_t *info)
249{ 268{
250 struct net_device *dev; 269 struct net_device *dev;
251 struct ali_ircc_cb *self; 270 struct ali_ircc_cb *self;
252 struct pm_dev *pmdev;
253 int dongle_id; 271 int dongle_id;
254 int err; 272 int err;
255 273
@@ -284,7 +302,8 @@ static int ali_ircc_open(int i, chipio_t *info)
284 self->io.fifo_size = 16; /* SIR: 16, FIR: 32 Benjamin 2000/11/1 */ 302 self->io.fifo_size = 16; /* SIR: 16, FIR: 32 Benjamin 2000/11/1 */
285 303
286 /* Reserve the ioports that we need */ 304 /* Reserve the ioports that we need */
287 if (!request_region(self->io.fir_base, self->io.fir_ext, driver_name)) { 305 if (!request_region(self->io.fir_base, self->io.fir_ext,
306 ALI_IRCC_DRIVER_NAME)) {
288 IRDA_WARNING("%s(), can't get iobase of 0x%03x\n", __FUNCTION__, 307 IRDA_WARNING("%s(), can't get iobase of 0x%03x\n", __FUNCTION__,
289 self->io.fir_base); 308 self->io.fir_base);
290 err = -ENODEV; 309 err = -ENODEV;
@@ -354,13 +373,10 @@ static int ali_ircc_open(int i, chipio_t *info)
354 373
355 /* Check dongle id */ 374 /* Check dongle id */
356 dongle_id = ali_ircc_read_dongle_id(i, info); 375 dongle_id = ali_ircc_read_dongle_id(i, info);
357 IRDA_MESSAGE("%s(), %s, Found dongle: %s\n", __FUNCTION__, driver_name, dongle_types[dongle_id]); 376 IRDA_MESSAGE("%s(), %s, Found dongle: %s\n", __FUNCTION__,
377 ALI_IRCC_DRIVER_NAME, dongle_types[dongle_id]);
358 378
359 self->io.dongle_id = dongle_id; 379 self->io.dongle_id = dongle_id;
360
361 pmdev = pm_register(PM_SYS_DEV, PM_SYS_IRDA, ali_ircc_pmproc);
362 if (pmdev)
363 pmdev->data = self;
364 380
365 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 381 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__);
366 382
@@ -548,12 +564,11 @@ static int ali_ircc_setup(chipio_t *info)
548 /* Should be 0x00 in the M1535/M1535D */ 564 /* Should be 0x00 in the M1535/M1535D */
549 if(version != 0x00) 565 if(version != 0x00)
550 { 566 {
551 IRDA_ERROR("%s, Wrong chip version %02x\n", driver_name, version); 567 IRDA_ERROR("%s, Wrong chip version %02x\n",
568 ALI_IRCC_DRIVER_NAME, version);
552 return -1; 569 return -1;
553 } 570 }
554 571
555 // IRDA_MESSAGE("%s, Found chip at base=0x%03x\n", driver_name, info->cfg_base);
556
557 /* Set FIR FIFO Threshold Register */ 572 /* Set FIR FIFO Threshold Register */
558 switch_bank(iobase, BANK1); 573 switch_bank(iobase, BANK1);
559 outb(RX_FIFO_Threshold, iobase+FIR_FIFO_TR); 574 outb(RX_FIFO_Threshold, iobase+FIR_FIFO_TR);
@@ -583,7 +598,8 @@ static int ali_ircc_setup(chipio_t *info)
583 /* Switch to SIR space */ 598 /* Switch to SIR space */
584 FIR2SIR(iobase); 599 FIR2SIR(iobase);
585 600
586 IRDA_MESSAGE("%s, driver loaded (Benjamin Kong)\n", driver_name); 601 IRDA_MESSAGE("%s, driver loaded (Benjamin Kong)\n",
602 ALI_IRCC_DRIVER_NAME);
587 603
588 /* Enable receive interrupts */ 604 /* Enable receive interrupts */
589 // outb(UART_IER_RDI, iobase+UART_IER); //benjamin 2000/11/23 01:25PM 605 // outb(UART_IER_RDI, iobase+UART_IER); //benjamin 2000/11/23 01:25PM
@@ -647,7 +663,8 @@ static irqreturn_t ali_ircc_interrupt(int irq, void *dev_id,
647 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 663 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
648 664
649 if (!dev) { 665 if (!dev) {
650 IRDA_WARNING("%s: irq %d for unknown device.\n", driver_name, irq); 666 IRDA_WARNING("%s: irq %d for unknown device.\n",
667 ALI_IRCC_DRIVER_NAME, irq);
651 return IRQ_NONE; 668 return IRQ_NONE;
652 } 669 }
653 670
@@ -1328,7 +1345,8 @@ static int ali_ircc_net_open(struct net_device *dev)
1328 /* Request IRQ and install Interrupt Handler */ 1345 /* Request IRQ and install Interrupt Handler */
1329 if (request_irq(self->io.irq, ali_ircc_interrupt, 0, dev->name, dev)) 1346 if (request_irq(self->io.irq, ali_ircc_interrupt, 0, dev->name, dev))
1330 { 1347 {
1331 IRDA_WARNING("%s, unable to allocate irq=%d\n", driver_name, 1348 IRDA_WARNING("%s, unable to allocate irq=%d\n",
1349 ALI_IRCC_DRIVER_NAME,
1332 self->io.irq); 1350 self->io.irq);
1333 return -EAGAIN; 1351 return -EAGAIN;
1334 } 1352 }
@@ -1338,7 +1356,8 @@ static int ali_ircc_net_open(struct net_device *dev)
1338 * failure. 1356 * failure.
1339 */ 1357 */
1340 if (request_dma(self->io.dma, dev->name)) { 1358 if (request_dma(self->io.dma, dev->name)) {
1341 IRDA_WARNING("%s, unable to allocate dma=%d\n", driver_name, 1359 IRDA_WARNING("%s, unable to allocate dma=%d\n",
1360 ALI_IRCC_DRIVER_NAME,
1342 self->io.dma); 1361 self->io.dma);
1343 free_irq(self->io.irq, self); 1362 free_irq(self->io.irq, self);
1344 return -EAGAIN; 1363 return -EAGAIN;
@@ -2108,61 +2127,38 @@ static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev)
2108 return &self->stats; 2127 return &self->stats;
2109} 2128}
2110 2129
2111static void ali_ircc_suspend(struct ali_ircc_cb *self) 2130static int ali_ircc_suspend(struct platform_device *dev, pm_message_t state)
2112{ 2131{
2113 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 2132 struct ali_ircc_cb *self = platform_get_drvdata(dev);
2114 2133
2115 IRDA_MESSAGE("%s, Suspending\n", driver_name); 2134 IRDA_MESSAGE("%s, Suspending\n", ALI_IRCC_DRIVER_NAME);
2116 2135
2117 if (self->io.suspended) 2136 if (self->io.suspended)
2118 return; 2137 return 0;
2119 2138
2120 ali_ircc_net_close(self->netdev); 2139 ali_ircc_net_close(self->netdev);
2121 2140
2122 self->io.suspended = 1; 2141 self->io.suspended = 1;
2123 2142
2124 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 2143 return 0;
2125} 2144}
2126 2145
2127static void ali_ircc_wakeup(struct ali_ircc_cb *self) 2146static int ali_ircc_resume(struct platform_device *dev)
2128{ 2147{
2129 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 2148 struct ali_ircc_cb *self = platform_get_drvdata(dev);
2130 2149
2131 if (!self->io.suspended) 2150 if (!self->io.suspended)
2132 return; 2151 return 0;
2133 2152
2134 ali_ircc_net_open(self->netdev); 2153 ali_ircc_net_open(self->netdev);
2135 2154
2136 IRDA_MESSAGE("%s, Waking up\n", driver_name); 2155 IRDA_MESSAGE("%s, Waking up\n", ALI_IRCC_DRIVER_NAME);
2137 2156
2138 self->io.suspended = 0; 2157 self->io.suspended = 0;
2139
2140 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );
2141}
2142 2158
2143static int ali_ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data)
2144{
2145 struct ali_ircc_cb *self = (struct ali_ircc_cb*) dev->data;
2146
2147 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
2148
2149 if (self) {
2150 switch (rqst) {
2151 case PM_SUSPEND:
2152 ali_ircc_suspend(self);
2153 break;
2154 case PM_RESUME:
2155 ali_ircc_wakeup(self);
2156 break;
2157 }
2158 }
2159
2160 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );
2161
2162 return 0; 2159 return 0;
2163} 2160}
2164 2161
2165
2166/* ALi Chip Function */ 2162/* ALi Chip Function */
2167 2163
2168static void SetCOMInterrupts(struct ali_ircc_cb *self , unsigned char enable) 2164static void SetCOMInterrupts(struct ali_ircc_cb *self , unsigned char enable)
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index cd87593e4e8a..844fa74ac9ec 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -83,9 +83,9 @@ static struct usb_device_id dongles[] = {
83 /* Extended Systems, Inc., XTNDAccess IrDA USB (ESI-9685) */ 83 /* Extended Systems, Inc., XTNDAccess IrDA USB (ESI-9685) */
84 { 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 */ 85 /* SigmaTel STIR4210/4220/4116 USB IrDA (VFIR) Bridge */
86 { USB_DEVICE(0x66f, 0x4210), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG }, 86 { USB_DEVICE(0x66f, 0x4210), .driver_info = IUC_STIR421X | IUC_SPEED_BUG },
87 { USB_DEVICE(0x66f, 0x4220), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG }, 87 { USB_DEVICE(0x66f, 0x4220), .driver_info = IUC_STIR421X | IUC_SPEED_BUG },
88 { USB_DEVICE(0x66f, 0x4116), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG }, 88 { USB_DEVICE(0x66f, 0x4116), .driver_info = IUC_STIR421X | IUC_SPEED_BUG },
89 { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | 89 { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
90 USB_DEVICE_ID_MATCH_INT_SUBCLASS, 90 USB_DEVICE_ID_MATCH_INT_SUBCLASS,
91 .bInterfaceClass = USB_CLASS_APP_SPEC, 91 .bInterfaceClass = USB_CLASS_APP_SPEC,
@@ -154,7 +154,7 @@ static void irda_usb_build_header(struct irda_usb_cb *self,
154 * and if either speed or xbofs (or both) needs 154 * and if either speed or xbofs (or both) needs
155 * to be changed. 155 * to be changed.
156 */ 156 */
157 if (self->capability & IUC_STIR_4210 && 157 if (self->capability & IUC_STIR421X &&
158 ((self->new_speed != -1) || (self->new_xbofs != -1))) { 158 ((self->new_speed != -1) || (self->new_xbofs != -1))) {
159 159
160 /* With STIR421x, speed and xBOFs must be set at the same 160 /* With STIR421x, speed and xBOFs must be set at the same
@@ -318,7 +318,7 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
318 /* Set the new speed and xbofs in this fake frame */ 318 /* Set the new speed and xbofs in this fake frame */
319 irda_usb_build_header(self, frame, 1); 319 irda_usb_build_header(self, frame, 1);
320 320
321 if ( self->capability & IUC_STIR_4210 ) { 321 if (self->capability & IUC_STIR421X) {
322 if (frame[0] == 0) return ; // do nothing if no change 322 if (frame[0] == 0) return ; // do nothing if no change
323 frame[1] = 0; // other parameters don't change here 323 frame[1] = 0; // other parameters don't change here
324 frame[2] = 0; 324 frame[2] = 0;
@@ -455,7 +455,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
455 455
456 /* Change setting for next frame */ 456 /* Change setting for next frame */
457 457
458 if ( self->capability & IUC_STIR_4210 ) { 458 if (self->capability & IUC_STIR421X) {
459 __u8 turnaround_time; 459 __u8 turnaround_time;
460 __u8* frame; 460 __u8* frame;
461 turnaround_time = get_turnaround_time( skb ); 461 turnaround_time = get_turnaround_time( skb );
@@ -897,10 +897,13 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
897 docopy = (urb->actual_length < IRDA_RX_COPY_THRESHOLD); 897 docopy = (urb->actual_length < IRDA_RX_COPY_THRESHOLD);
898 898
899 /* Allocate a new skb */ 899 /* Allocate a new skb */
900 if ( self->capability & IUC_STIR_4210 ) 900 if (self->capability & IUC_STIR421X)
901 newskb = dev_alloc_skb(docopy ? urb->actual_length : IRDA_SKB_MAX_MTU + USB_IRDA_SIGMATEL_HEADER); 901 newskb = dev_alloc_skb(docopy ? urb->actual_length :
902 IRDA_SKB_MAX_MTU +
903 USB_IRDA_STIR421X_HEADER);
902 else 904 else
903 newskb = dev_alloc_skb(docopy ? urb->actual_length : IRDA_SKB_MAX_MTU); 905 newskb = dev_alloc_skb(docopy ? urb->actual_length :
906 IRDA_SKB_MAX_MTU);
904 907
905 if (!newskb) { 908 if (!newskb) {
906 self->stats.rx_dropped++; 909 self->stats.rx_dropped++;
@@ -1022,188 +1025,140 @@ static int irda_usb_is_receiving(struct irda_usb_cb *self)
1022 return 0; /* For now */ 1025 return 0; /* For now */
1023} 1026}
1024 1027
1025 1028#define STIR421X_PATCH_PRODUCT_VER "Product Version: "
1026#define STIR421X_PATCH_PRODUCT_VERSION_STR "Product Version: " 1029#define STIR421X_PATCH_STMP_TAG "STMP"
1027#define STIR421X_PATCH_COMPONENT_VERSION_STR "Component Version: " 1030#define STIR421X_PATCH_CODE_OFFSET 512 /* patch image starts before here */
1028#define STIR421X_PATCH_DATA_TAG_STR "STMP" 1031/* marks end of patch file header (PC DOS text file EOF character) */
1029#define STIR421X_PATCH_FILE_VERSION_MAX_OFFSET 512 /* version info is before here */ 1032#define STIR421X_PATCH_END_OF_HDR_TAG 0x1A
1030#define STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET 512 /* patch image starts before here */ 1033#define STIR421X_PATCH_BLOCK_SIZE 1023
1031#define STIR421X_PATCH_FILE_END_OF_HEADER_TAG 0x1A /* marks end of patch file header (PC DOS text file EOF character) */
1032 1034
1033/* 1035/*
1034 * Known firmware patches for STIR421x dongles 1036 * Function stir421x_fwupload (struct irda_usb_cb *self,
1037 * unsigned char *patch,
1038 * const unsigned int patch_len)
1039 *
1040 * Upload firmware code to SigmaTel 421X IRDA-USB dongle
1035 */ 1041 */
1036static char * stir421x_patches[] = { 1042static int stir421x_fw_upload(struct irda_usb_cb *self,
1037 "42101001.sb", 1043 unsigned char *patch,
1038 "42101002.sb", 1044 const unsigned int patch_len)
1039};
1040
1041static int stir421x_get_patch_version(unsigned char * patch, const unsigned long patch_len)
1042{ 1045{
1043 unsigned int version_offset; 1046 int ret = -ENOMEM;
1044 unsigned long version_major, version_minor, version_build; 1047 int actual_len = 0;
1045 unsigned char * version_start; 1048 unsigned int i;
1046 int version_found = 0; 1049 unsigned int block_size = 0;
1047 1050 unsigned char *patch_block;
1048 for (version_offset = 0; 1051
1049 version_offset < STIR421X_PATCH_FILE_END_OF_HEADER_TAG; 1052 patch_block = kzalloc(STIR421X_PATCH_BLOCK_SIZE, GFP_KERNEL);
1050 version_offset++) { 1053 if (patch_block == NULL)
1051 if (!memcmp(patch + version_offset, 1054 return -ENOMEM;
1052 STIR421X_PATCH_PRODUCT_VERSION_STR, 1055
1053 sizeof(STIR421X_PATCH_PRODUCT_VERSION_STR) - 1)) { 1056 /* break up patch into 1023-byte sections */
1054 version_found = 1; 1057 for (i = 0; i < patch_len; i += block_size) {
1055 version_start = patch + 1058 block_size = patch_len - i;
1056 version_offset + 1059
1057 sizeof(STIR421X_PATCH_PRODUCT_VERSION_STR) - 1; 1060 if (block_size > STIR421X_PATCH_BLOCK_SIZE)
1058 break; 1061 block_size = STIR421X_PATCH_BLOCK_SIZE;
1059 } 1062
1063 /* upload the patch section */
1064 memcpy(patch_block, patch + i, block_size);
1065
1066 ret = usb_bulk_msg(self->usbdev,
1067 usb_sndbulkpipe(self->usbdev,
1068 self->bulk_out_ep),
1069 patch_block, block_size,
1070 &actual_len, msecs_to_jiffies(500));
1071 IRDA_DEBUG(3,"%s(): Bulk send %u bytes, ret=%d\n",
1072 __FUNCTION__, actual_len, ret);
1073
1074 if (ret < 0)
1075 break;
1060 } 1076 }
1061 1077
1062 /* We couldn't find a product version on this patch */ 1078 kfree(patch_block);
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 1079
1080 return ret;
1081 }
1138 1082
1083/*
1084 * Function stir421x_patch_device(struct irda_usb_cb *self)
1085 *
1086 * Get a firmware code from userspase using hotplug request_firmware() call
1087 */
1139static int stir421x_patch_device(struct irda_usb_cb *self) 1088static int stir421x_patch_device(struct irda_usb_cb *self)
1140{ 1089{
1141 unsigned int i, patch_found = 0, data_found = 0, data_offset; 1090 unsigned int i;
1142 int patch_version, ret = 0; 1091 int ret;
1143 const struct firmware *fw_entry; 1092 char stir421x_fw_name[11];
1144 1093 const struct firmware *fw;
1145 for (i = 0; i < ARRAY_SIZE(stir421x_patches); i++) { 1094 unsigned char *fw_version_ptr; /* pointer to version string */
1146 if(request_firmware(&fw_entry, stir421x_patches[i], &self->usbdev->dev) != 0) { 1095 unsigned long fw_version = 0;
1147 IRDA_ERROR( "%s(), Patch %s is not available\n", __FUNCTION__, stir421x_patches[i]); 1096
1148 continue; 1097 /*
1149 } 1098 * Known firmware patch file names for STIR421x dongles
1150 1099 * are "42101001.sb" or "42101002.sb"
1151 /* We found a patch from userspace */ 1100 */
1152 patch_version = stir421x_get_patch_version (fw_entry->data, fw_entry->size); 1101 sprintf(stir421x_fw_name, "4210%4X.sb",
1153 1102 self->usbdev->descriptor.bcdDevice);
1154 if (patch_version < 0) { 1103 ret = request_firmware(&fw, stir421x_fw_name, &self->usbdev->dev);
1155 /* Couldn't fetch a version, let's move on to the next file */ 1104 if (ret < 0)
1156 IRDA_ERROR("%s(), version parsing failed\n", __FUNCTION__); 1105 return ret;
1157 ret = patch_version; 1106
1158 release_firmware(fw_entry); 1107 /* We get a patch from userspace */
1159 continue; 1108 IRDA_MESSAGE("%s(): Received firmware %s (%u bytes)\n",
1160 } 1109 __FUNCTION__, stir421x_fw_name, fw->size);
1161 1110
1162 if (patch_version != self->usbdev->descriptor.bcdDevice) { 1111 ret = -EINVAL;
1163 /* Patch version and device don't match */ 1112
1164 IRDA_ERROR ("%s(), wrong patch version (%d <-> %d)\n", 1113 /* Get the bcd product version */
1165 __FUNCTION__, 1114 if (!memcmp(fw->data, STIR421X_PATCH_PRODUCT_VER,
1166 patch_version, self->usbdev->descriptor.bcdDevice); 1115 sizeof(STIR421X_PATCH_PRODUCT_VER) - 1)) {
1167 ret = -EINVAL; 1116 fw_version_ptr = fw->data +
1168 release_firmware(fw_entry); 1117 sizeof(STIR421X_PATCH_PRODUCT_VER) - 1;
1169 continue; 1118
1170 } 1119 /* Let's check if the product version is dotted */
1171 1120 if (fw_version_ptr[3] == '.' &&
1172 /* If we're here, we've found a correct patch */ 1121 fw_version_ptr[7] == '.') {
1173 patch_found = 1; 1122 unsigned long major, minor, build;
1174 break; 1123 major = simple_strtoul(fw_version_ptr, NULL, 10);
1175 1124 minor = simple_strtoul(fw_version_ptr + 4, NULL, 10);
1176 } 1125 build = simple_strtoul(fw_version_ptr + 8, NULL, 10);
1177 1126
1178 /* We couldn't find a valid firmware, let's leave */ 1127 fw_version = (major << 12)
1179 if (!patch_found) 1128 + (minor << 8)
1180 return ret; 1129 + ((build / 10) << 4)
1181 1130 + (build % 10);
1182 /* The actual image starts after the "STMP" keyword */ 1131
1183 for (data_offset = 0; data_offset < STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET; data_offset++) { 1132 IRDA_DEBUG(3, "%s(): Firmware Product version %ld\n",
1184 if (!memcmp(fw_entry->data + data_offset, 1133 __FUNCTION__, fw_version);
1185 STIR421X_PATCH_DATA_TAG_STR, 1134 }
1186 sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET))) { 1135 }
1187 IRDA_DEBUG(2, "%s(), found patch data for STIR421x at offset %d\n", 1136
1188 __FUNCTION__, data_offset); 1137 if (self->usbdev->descriptor.bcdDevice == fw_version) {
1189 data_found = 1; 1138 /*
1190 break; 1139 * If we're here, we've found a correct patch
1191 } 1140 * The actual image starts after the "STMP" keyword
1192 } 1141 * so forward to the firmware header tag
1193 1142 */
1194 /* We couldn't find "STMP" from the header */ 1143 for (i = 0; (fw->data[i] != STIR421X_PATCH_END_OF_HDR_TAG)
1195 if (!data_found) 1144 && (i < fw->size); i++) ;
1196 return -EINVAL; 1145 /* here we check for the out of buffer case */
1197 1146 if ((STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i])
1198 /* Let's upload the patch to the target */ 1147 && (i < STIR421X_PATCH_CODE_OFFSET)) {
1199 ret = stir421x_upload_patch(self, 1148 if (!memcmp(fw->data + i + 1, STIR421X_PATCH_STMP_TAG,
1200 &fw_entry->data[data_offset + sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET)], 1149 sizeof(STIR421X_PATCH_STMP_TAG) - 1)) {
1201 fw_entry->size - (data_offset + sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET))); 1150
1202 1151 /* We can upload the patch to the target */
1203 release_firmware(fw_entry); 1152 i += sizeof(STIR421X_PATCH_STMP_TAG);
1204 1153 ret = stir421x_fw_upload(self, &fw->data[i],
1205 return ret; 1154 fw->size - i);
1206 1155 }
1156 }
1157 }
1158
1159 release_firmware(fw);
1160
1161 return ret;
1207} 1162}
1208 1163
1209 1164
@@ -1702,12 +1657,12 @@ static int irda_usb_probe(struct usb_interface *intf,
1702 init_timer(&self->rx_defer_timer); 1657 init_timer(&self->rx_defer_timer);
1703 1658
1704 self->capability = id->driver_info; 1659 self->capability = id->driver_info;
1705 self->needspatch = ((self->capability & IUC_STIR_4210) != 0) ; 1660 self->needspatch = ((self->capability & IUC_STIR421X) != 0);
1706 1661
1707 /* Create all of the needed urbs */ 1662 /* Create all of the needed urbs */
1708 if (self->capability & IUC_STIR_4210) { 1663 if (self->capability & IUC_STIR421X) {
1709 self->max_rx_urb = IU_SIGMATEL_MAX_RX_URBS; 1664 self->max_rx_urb = IU_SIGMATEL_MAX_RX_URBS;
1710 self->header_length = USB_IRDA_SIGMATEL_HEADER; 1665 self->header_length = USB_IRDA_STIR421X_HEADER;
1711 } else { 1666 } else {
1712 self->max_rx_urb = IU_MAX_RX_URBS; 1667 self->max_rx_urb = IU_MAX_RX_URBS;
1713 self->header_length = USB_IRDA_HEADER; 1668 self->header_length = USB_IRDA_HEADER;
@@ -1813,8 +1768,8 @@ static int irda_usb_probe(struct usb_interface *intf,
1813 /* Now we fetch and upload the firmware patch */ 1768 /* Now we fetch and upload the firmware patch */
1814 ret = stir421x_patch_device(self); 1769 ret = stir421x_patch_device(self);
1815 self->needspatch = (ret < 0); 1770 self->needspatch = (ret < 0);
1816 if (ret < 0) { 1771 if (self->needspatch) {
1817 printk("patch_device failed\n"); 1772 IRDA_ERROR("STIR421X: Couldn't upload patch\n");
1818 goto err_out_5; 1773 goto err_out_5;
1819 } 1774 }
1820 1775
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h
index d833db52cebf..6b2271f18e77 100644
--- a/drivers/net/irda/irda-usb.h
+++ b/drivers/net/irda/irda-usb.h
@@ -34,9 +34,6 @@
34#include <net/irda/irda.h> 34#include <net/irda/irda.h>
35#include <net/irda/irda_device.h> /* struct irlap_cb */ 35#include <net/irda/irda_device.h> /* struct irlap_cb */
36 36
37#define PATCH_FILE_SIZE_MAX 65536
38#define PATCH_FILE_SIZE_MIN 80
39
40#define RX_COPY_THRESHOLD 200 37#define RX_COPY_THRESHOLD 200
41#define IRDA_USB_MAX_MTU 2051 38#define IRDA_USB_MAX_MTU 2051
42#define IRDA_USB_SPEED_MTU 64 /* Weird, but work like this */ 39#define IRDA_USB_SPEED_MTU 64 /* Weird, but work like this */
@@ -107,14 +104,15 @@
107#define IUC_SMALL_PKT 0x10 /* Device doesn't behave with big Rx packets */ 104#define IUC_SMALL_PKT 0x10 /* Device doesn't behave with big Rx packets */
108#define IUC_MAX_WINDOW 0x20 /* Device underestimate the Rx window */ 105#define IUC_MAX_WINDOW 0x20 /* Device underestimate the Rx window */
109#define IUC_MAX_XBOFS 0x40 /* Device need more xbofs than advertised */ 106#define IUC_MAX_XBOFS 0x40 /* Device need more xbofs than advertised */
110#define IUC_STIR_4210 0x80 /* SigmaTel 4210/4220/4116 VFIR */ 107#define IUC_STIR421X 0x80 /* SigmaTel 4210/4220/4116 VFIR */
111 108
112/* USB class definitions */ 109/* USB class definitions */
113#define USB_IRDA_HEADER 0x01 110#define USB_IRDA_HEADER 0x01
114#define USB_CLASS_IRDA 0x02 /* USB_CLASS_APP_SPEC subclass */ 111#define USB_CLASS_IRDA 0x02 /* USB_CLASS_APP_SPEC subclass */
115#define USB_DT_IRDA 0x21 112#define USB_DT_IRDA 0x21
116#define USB_IRDA_SIGMATEL_HEADER 0x03 113#define USB_IRDA_STIR421X_HEADER 0x03
117#define IU_SIGMATEL_MAX_RX_URBS (IU_MAX_ACTIVE_RX_URBS + USB_IRDA_SIGMATEL_HEADER) 114#define IU_SIGMATEL_MAX_RX_URBS (IU_MAX_ACTIVE_RX_URBS + \
115 USB_IRDA_STIR421X_HEADER)
118 116
119struct irda_class_desc { 117struct irda_class_desc {
120 __u8 bLength; 118 __u8 bLength;
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
new file mode 100644
index 000000000000..754297fc8f22
--- /dev/null
+++ b/drivers/net/irda/mcs7780.c
@@ -0,0 +1,1009 @@
1/*****************************************************************************
2*
3* Filename: mcs7780.c
4* Version: 0.4-alpha
5* Description: Irda MosChip USB Dongle Driver
6* Authors: Lukasz Stelmach <stlman@poczta.fm>
7* Brian Pugh <bpugh@cs.pdx.edu>
8* Judy Fischbach <jfisch@cs.pdx.edu>
9*
10* Based on stir4200 driver, but some things done differently.
11* Based on earlier driver by Paul Stewart <stewart@parc.com>
12*
13* Copyright (C) 2000, Roman Weissgaerber <weissg@vienna.at>
14* Copyright (C) 2001, Dag Brattli <dag@brattli.net>
15* Copyright (C) 2001, Jean Tourrilhes <jt@hpl.hp.com>
16* Copyright (C) 2004, Stephen Hemminger <shemminger@osdl.org>
17* Copyright (C) 2005, Lukasz Stelmach <stlman@poczta.fm>
18* Copyright (C) 2005, Brian Pugh <bpugh@cs.pdx.edu>
19* Copyright (C) 2005, Judy Fischbach <jfisch@cs.pdx.edu>
20*
21* This program is free software; you can redistribute it and/or modify
22* it under the terms of the GNU General Public License as published by
23* the Free Software Foundation; either version 2 of the License, or
24* (at your option) any later version.
25*
26* This program is distributed in the hope that it will be useful,
27* but WITHOUT ANY WARRANTY; without even the implied warranty of
28* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29* GNU General Public License for more details.
30*
31* You should have received a copy of the GNU General Public License
32* along with this program; if not, write to the Free Software
33* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
34*
35*****************************************************************************/
36
37/*
38 * MCS7780 is a simple USB to IrDA bridge by MosChip. It is neither
39 * compatibile with irda-usb nor with stir4200. Although it is quite
40 * similar to the later as far as general idea of operation is concerned.
41 * That is it requires the software to do all the framing job at SIR speeds.
42 * The hardware does take care of the framing at MIR and FIR speeds.
43 * It supports all speeds from 2400 through 4Mbps
44 */
45
46#include <linux/module.h>
47#include <linux/moduleparam.h>
48#include <linux/config.h>
49#include <linux/kernel.h>
50#include <linux/types.h>
51#include <linux/errno.h>
52#include <linux/init.h>
53#include <linux/slab.h>
54#include <linux/module.h>
55#include <linux/kref.h>
56#include <linux/usb.h>
57#include <linux/device.h>
58#include <linux/crc32.h>
59
60#include <asm/unaligned.h>
61#include <asm/byteorder.h>
62#include <asm/uaccess.h>
63
64#include <net/irda/irda.h>
65#include <net/irda/wrapper.h>
66#include <net/irda/crc.h>
67
68#include "mcs7780.h"
69
70#define MCS_VENDOR_ID 0x9710
71#define MCS_PRODUCT_ID 0x7780
72
73static struct usb_device_id mcs_table[] = {
74 /* MosChip Corp., MCS7780 FIR-USB Adapter */
75 {USB_DEVICE(MCS_VENDOR_ID, MCS_PRODUCT_ID)},
76 {},
77};
78
79MODULE_AUTHOR("Brian Pugh <bpugh@cs.pdx.edu>");
80MODULE_DESCRIPTION("IrDA-USB Dongle Driver for MosChip MCS7780");
81MODULE_VERSION("0.3alpha");
82MODULE_LICENSE("GPL");
83
84MODULE_DEVICE_TABLE(usb, mcs_table);
85
86static int qos_mtt_bits = 0x07 /* > 1ms */ ;
87module_param(qos_mtt_bits, int, 0);
88MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
89
90static int receive_mode = 0x1;
91module_param(receive_mode, int, 0);
92MODULE_PARM_DESC(receive_mode,
93 "Receive mode of the device (1:fast, 0:slow, default:1)");
94
95static int sir_tweak = 1;
96module_param(sir_tweak, int, 0444);
97MODULE_PARM_DESC(sir_tweak,
98 "Default pulse width (1:1.6us, 0:3/16 bit, default:1).");
99
100static int transceiver_type = MCS_TSC_VISHAY;
101module_param(transceiver_type, int, 0444);
102MODULE_PARM_DESC(transceiver_type, "IR transceiver type, see mcs7780.h.");
103
104struct usb_driver mcs_driver = {
105 .name = "mcs7780",
106 .probe = mcs_probe,
107 .disconnect = mcs_disconnect,
108 .id_table = mcs_table,
109};
110
111/* speed flag selection by direct addressing.
112addr = (speed >> 8) & 0x0f
113
1140x1 57600 0x2 115200 0x4 1152000 0x5 9600
1150x6 38400 0x9 2400 0xa 576000 0xb 19200
116
1174Mbps (or 2400) must be checked separately. Since it also has
118to be programmed in a different manner that is not a big problem.
119*/
120static __u16 mcs_speed_set[16] = { 0,
121 MCS_SPEED_57600,
122 MCS_SPEED_115200,
123 0,
124 MCS_SPEED_1152000,
125 MCS_SPEED_9600,
126 MCS_SPEED_38400,
127 0, 0,
128 MCS_SPEED_2400,
129 MCS_SPEED_576000,
130 MCS_SPEED_19200,
131 0, 0, 0,
132};
133
134/* Set given 16 bit register with a 16 bit value. Send control message
135 * to set dongle register. */
136static int mcs_set_reg(struct mcs_cb *mcs, __u16 reg, __u16 val)
137{
138 struct usb_device *dev = mcs->usbdev;
139 return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ,
140 MCS_WR_RTYPE, val, reg, NULL, 0,
141 msecs_to_jiffies(MCS_CTRL_TIMEOUT));
142}
143
144/* Get 16 bit register value. Send contol message to read dongle register. */
145static int mcs_get_reg(struct mcs_cb *mcs, __u16 reg, __u16 * val)
146{
147 struct usb_device *dev = mcs->usbdev;
148 int ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ,
149 MCS_RD_RTYPE, 0, reg, val, 2,
150 msecs_to_jiffies(MCS_CTRL_TIMEOUT));
151
152 return ret;
153}
154
155/* Setup a communication between mcs7780 and TFDU chips. It is described
156 * in more detail in the data sheet. The setup sequence puts the the
157 * vishay tranceiver into high speed mode. It will also receive SIR speed
158 * packets but at reduced sensitivity.
159 */
160
161/* 0: OK 1:ERROR */
162static inline int mcs_setup_transceiver_vishay(struct mcs_cb *mcs)
163{
164 int ret = 0;
165 __u16 rval;
166
167 /* mcs_get_reg should read exactly two bytes from the dongle */
168 ret = mcs_get_reg(mcs, MCS_XCVR_REG, &rval);
169 if (unlikely(ret != 2)) {
170 ret = -EIO;
171 goto error;
172 }
173
174 /* The MCS_XCVR_CONF bit puts the transceiver into configuration
175 * mode. The MCS_MODE0 bit must start out high (1) and then
176 * transition to low and the MCS_STFIR and MCS_MODE1 bits must
177 * be low.
178 */
179 rval |= (MCS_MODE0 | MCS_XCVR_CONF);
180 rval &= ~MCS_STFIR;
181 rval &= ~MCS_MODE1;
182 ret = mcs_set_reg(mcs, MCS_XCVR_REG, rval);
183 if (unlikely(ret))
184 goto error;
185
186 rval &= ~MCS_MODE0;
187 ret = mcs_set_reg(mcs, MCS_XCVR_REG, rval);
188 if (unlikely(ret))
189 goto error;
190
191 rval &= ~MCS_XCVR_CONF;
192 ret = mcs_set_reg(mcs, MCS_XCVR_REG, rval);
193 if (unlikely(ret))
194 goto error;
195
196 ret = 0;
197 error:
198 return ret;
199}
200
201/* Setup a communication between mcs7780 and agilent chip. */
202static inline int mcs_setup_transceiver_agilent(struct mcs_cb *mcs)
203{
204 IRDA_WARNING("This transceiver type is not supported yet.");
205 return 1;
206}
207
208/* Setup a communication between mcs7780 and sharp chip. */
209static inline int mcs_setup_transceiver_sharp(struct mcs_cb *mcs)
210{
211 IRDA_WARNING("This transceiver type is not supported yet.");
212 return 1;
213}
214
215/* Common setup for all transceivers */
216static inline int mcs_setup_transceiver(struct mcs_cb *mcs)
217{
218 int ret = 0;
219 __u16 rval;
220 char *msg;
221
222 msg = "Basic transceiver setup error.";
223
224 /* read value of MODE Register, set the DRIVER and RESET bits
225 * and write value back out to MODE Register
226 */
227 ret = mcs_get_reg(mcs, MCS_MODE_REG, &rval);
228 if(unlikely(ret != 2))
229 goto error;
230 rval |= MCS_DRIVER; /* put the mcs7780 into configuration mode. */
231 ret = mcs_set_reg(mcs, MCS_MODE_REG, rval);
232 if(unlikely(ret))
233 goto error;
234
235 rval = 0; /* set min pulse width to 0 initially. */
236 ret = mcs_set_reg(mcs, MCS_MINRXPW_REG, rval);
237 if(unlikely(ret))
238 goto error;
239
240 ret = mcs_get_reg(mcs, MCS_MODE_REG, &rval);
241 if(unlikely(ret != 2))
242 goto error;
243
244 rval &= ~MCS_FIR; /* turn off fir mode. */
245 if(mcs->sir_tweak)
246 rval |= MCS_SIR16US; /* 1.6us pulse width */
247 else
248 rval &= ~MCS_SIR16US; /* 3/16 bit time pulse width */
249
250 /* make sure ask mode and back to back packets are off. */
251 rval &= ~(MCS_BBTG | MCS_ASK);
252
253 rval &= ~MCS_SPEED_MASK;
254 rval |= MCS_SPEED_9600; /* make sure initial speed is 9600. */
255 mcs->speed = 9600;
256 mcs->new_speed = 0; /* new_speed is set to 0 */
257 rval &= ~MCS_PLLPWDN; /* disable power down. */
258
259 /* make sure device determines direction and that the auto send sip
260 * pulse are on.
261 */
262 rval |= MCS_DTD | MCS_SIPEN;
263
264 ret = mcs_set_reg(mcs, MCS_MODE_REG, rval);
265 if(unlikely(ret))
266 goto error;
267
268 msg = "transceiver model specific setup error.";
269 switch (mcs->transceiver_type) {
270 case MCS_TSC_VISHAY:
271 ret = mcs_setup_transceiver_vishay(mcs);
272 break;
273
274 case MCS_TSC_SHARP:
275 ret = mcs_setup_transceiver_sharp(mcs);
276 break;
277
278 case MCS_TSC_AGILENT:
279 ret = mcs_setup_transceiver_agilent(mcs);
280 break;
281
282 default:
283 IRDA_WARNING("Unknown transceiver type: %d",
284 mcs->transceiver_type);
285 ret = 1;
286 }
287 if (unlikely(ret))
288 goto error;
289
290 /* If transceiver is not SHARP, then if receive mode set
291 * on the RXFAST bit in the XCVR Register otherwise unset it
292 */
293 if (mcs->transceiver_type != MCS_TSC_SHARP) {
294
295 ret = mcs_get_reg(mcs, MCS_XCVR_REG, &rval);
296 if (unlikely(ret != 2))
297 goto error;
298 if (mcs->receive_mode)
299 rval |= MCS_RXFAST;
300 else
301 rval &= ~MCS_RXFAST;
302 ret = mcs_set_reg(mcs, MCS_XCVR_REG, rval);
303 if (unlikely(ret))
304 goto error;
305 }
306
307 msg = "transceiver reset.";
308
309 ret = mcs_get_reg(mcs, MCS_MODE_REG, &rval);
310 if (unlikely(ret != 2))
311 goto error;
312
313 /* reset the mcs7780 so all changes take effect. */
314 rval &= ~MCS_RESET;
315 ret = mcs_set_reg(mcs, MCS_MODE_REG, rval);
316 if (unlikely(ret))
317 goto error;
318 else
319 return ret;
320
321error:
322 IRDA_ERROR("%s", msg);
323 return ret;
324}
325
326/* Wraps the data in format for SIR */
327static inline int mcs_wrap_sir_skb(struct sk_buff *skb, __u8 * buf)
328{
329 int wraplen;
330
331 /* 2: full frame length, including "the length" */
332 wraplen = async_wrap_skb(skb, buf + 2, 4094);
333
334 wraplen += 2;
335 buf[0] = wraplen & 0xff;
336 buf[1] = (wraplen >> 8) & 0xff;
337
338 return wraplen;
339}
340
341/* Wraps the data in format for FIR */
342static unsigned mcs_wrap_fir_skb(const struct sk_buff *skb, __u8 *buf)
343{
344 unsigned int len = 0;
345 __u32 fcs = ~(crc32_le(~0, skb->data, skb->len));
346
347 /* add 2 bytes for length value and 4 bytes for fcs. */
348 len = skb->len + 6;
349
350 /* The mcs7780 requires that the first two bytes are the packet
351 * length in little endian order. Note: the length value includes
352 * the two bytes for the length value itself.
353 */
354 buf[0] = len & 0xff;
355 buf[1] = (len >> 8) & 0xff;
356 /* copy the data into the tx buffer. */
357 memcpy(buf+2, skb->data, skb->len);
358 /* put the fcs in the last four bytes in little endian order. */
359 buf[len - 4] = fcs & 0xff;
360 buf[len - 3] = (fcs >> 8) & 0xff;
361 buf[len - 2] = (fcs >> 16) & 0xff;
362 buf[len - 1] = (fcs >> 24) & 0xff;
363
364 return len;
365}
366
367/* Wraps the data in format for MIR */
368static unsigned mcs_wrap_mir_skb(const struct sk_buff *skb, __u8 *buf)
369{
370 __u16 fcs = 0;
371 int len = skb->len + 4;
372
373 fcs = ~(irda_calc_crc16(~fcs, skb->data, skb->len));
374 /* put the total packet length in first. Note: packet length
375 * value includes the two bytes that hold the packet length
376 * itself.
377 */
378 buf[0] = len & 0xff;
379 buf[1] = (len >> 8) & 0xff;
380 /* copy the data */
381 memcpy(buf+2, skb->data, skb->len);
382 /* put the fcs in last two bytes in little endian order. */
383 buf[len - 2] = fcs & 0xff;
384 buf[len - 1] = (fcs >> 8) & 0xff;
385
386 return len;
387}
388
389/* Unwrap received packets at MIR speed. A 16 bit crc_ccitt checksum is
390 * used for the fcs. When performed over the entire packet the result
391 * should be GOOD_FCS = 0xf0b8. Hands the unwrapped data off to the IrDA
392 * layer via a sk_buff.
393 */
394static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
395{
396 __u16 fcs;
397 int new_len;
398 struct sk_buff *skb;
399
400 /* Assume that the frames are going to fill a single packet
401 * rather than span multiple packets.
402 */
403
404 new_len = len - 2;
405 if(unlikely(new_len <= 0)) {
406 IRDA_ERROR("%s short frame length %d\n",
407 mcs->netdev->name, new_len);
408 ++mcs->stats.rx_errors;
409 ++mcs->stats.rx_length_errors;
410 return;
411 }
412 fcs = 0;
413 fcs = irda_calc_crc16(~fcs, buf, len);
414
415 if(fcs != GOOD_FCS) {
416 IRDA_ERROR("crc error calc 0x%x len %d\n",
417 fcs, new_len);
418 mcs->stats.rx_errors++;
419 mcs->stats.rx_crc_errors++;
420 return;
421 }
422
423 skb = dev_alloc_skb(new_len + 1);
424 if(unlikely(!skb)) {
425 ++mcs->stats.rx_dropped;
426 return;
427 }
428
429 skb_reserve(skb, 1);
430 memcpy(skb->data, buf, new_len);
431 skb_put(skb, new_len);
432 skb->mac.raw = skb->data;
433 skb->protocol = htons(ETH_P_IRDA);
434 skb->dev = mcs->netdev;
435
436 netif_rx(skb);
437
438 mcs->stats.rx_packets++;
439 mcs->stats.rx_bytes += new_len;
440
441 return;
442}
443
444/* Unwrap received packets at FIR speed. A 32 bit crc_ccitt checksum is
445 * used for the fcs. Hands the unwrapped data off to the IrDA
446 * layer via a sk_buff.
447 */
448static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
449{
450 __u32 fcs;
451 int new_len;
452 struct sk_buff *skb;
453
454 /* Assume that the frames are going to fill a single packet
455 * rather than span multiple packets. This is most likely a false
456 * assumption.
457 */
458
459 new_len = len - 4;
460 if(unlikely(new_len <= 0)) {
461 IRDA_ERROR("%s short frame length %d\n",
462 mcs->netdev->name, new_len);
463 ++mcs->stats.rx_errors;
464 ++mcs->stats.rx_length_errors;
465 return;
466 }
467
468 fcs = ~(crc32_le(~0, buf, new_len));
469 if(fcs != le32_to_cpu(get_unaligned((u32 *)(buf+new_len)))) {
470 IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len);
471 mcs->stats.rx_errors++;
472 mcs->stats.rx_crc_errors++;
473 return;
474 }
475
476 skb = dev_alloc_skb(new_len + 1);
477 if(unlikely(!skb)) {
478 ++mcs->stats.rx_dropped;
479 return;
480 }
481
482 skb_reserve(skb, 1);
483 memcpy(skb->data, buf, new_len);
484 skb_put(skb, new_len);
485 skb->mac.raw = skb->data;
486 skb->protocol = htons(ETH_P_IRDA);
487 skb->dev = mcs->netdev;
488
489 netif_rx(skb);
490
491 mcs->stats.rx_packets++;
492 mcs->stats.rx_bytes += new_len;
493
494 return;
495}
496
497
498/* Allocates urbs for both receive and transmit.
499 * If alloc fails return error code 0 (fail) otherwise
500 * return error code 1 (success).
501 */
502static inline int mcs_setup_urbs(struct mcs_cb *mcs)
503{
504 mcs->rx_urb = NULL;
505
506 mcs->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
507 if (!mcs->tx_urb)
508 return 0;
509
510 mcs->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
511 if (!mcs->rx_urb)
512 return 0;
513
514 return 1;
515}
516
517/* Sets up state to be initially outside frame, gets receive urb,
518 * sets status to successful and then submits the urb to start
519 * receiving the data.
520 */
521static inline int mcs_receive_start(struct mcs_cb *mcs)
522{
523 mcs->rx_buff.in_frame = FALSE;
524 mcs->rx_buff.state = OUTSIDE_FRAME;
525
526 usb_fill_bulk_urb(mcs->rx_urb, mcs->usbdev,
527 usb_rcvbulkpipe(mcs->usbdev, mcs->ep_in),
528 mcs->in_buf, 4096, mcs_receive_irq, mcs);
529
530 mcs->rx_urb->status = 0;
531 return usb_submit_urb(mcs->rx_urb, GFP_KERNEL);
532}
533
534/* Finds the in and out endpoints for the mcs control block */
535static inline int mcs_find_endpoints(struct mcs_cb *mcs,
536 struct usb_host_endpoint *ep, int epnum)
537{
538 int i;
539 int ret = 0;
540
541 /* If no place to store the endpoints just return */
542 if (!ep)
543 return ret;
544
545 /* cycle through all endpoints, find the first two that are DIR_IN */
546 for (i = 0; i < epnum; i++) {
547 if (ep[i].desc.bEndpointAddress & USB_DIR_IN)
548 mcs->ep_in = ep[i].desc.bEndpointAddress;
549 else
550 mcs->ep_out = ep[i].desc.bEndpointAddress;
551
552 /* MosChip says that the chip has only two bulk
553 * endpoints. Find one for each direction and move on.
554 */
555 if ((mcs->ep_in != 0) && (mcs->ep_out != 0)) {
556 ret = 1;
557 break;
558 }
559 }
560
561 return ret;
562}
563
564static void mcs_speed_work(void *arg)
565{
566 struct mcs_cb *mcs = arg;
567 struct net_device *netdev = mcs->netdev;
568
569 mcs_speed_change(mcs);
570 netif_wake_queue(netdev);
571}
572
573/* Function to change the speed of the mcs7780. Fully supports SIR,
574 * MIR, and FIR speeds.
575 */
576static int mcs_speed_change(struct mcs_cb *mcs)
577{
578 int ret = 0;
579 int rst = 0;
580 int cnt = 0;
581 __u16 nspeed;
582 __u16 rval;
583
584 nspeed = mcs_speed_set[(mcs->new_speed >> 8) & 0x0f];
585
586 do {
587 mcs_get_reg(mcs, MCS_RESV_REG, &rval);
588 } while(cnt++ < 100 && (rval & MCS_IRINTX));
589
590 if(cnt >= 100) {
591 IRDA_ERROR("unable to change speed");
592 ret = -EIO;
593 goto error;
594 }
595
596 mcs_get_reg(mcs, MCS_MODE_REG, &rval);
597
598 /* MINRXPW values recomended by MosChip */
599 if (mcs->new_speed <= 115200) {
600 rval &= ~MCS_FIR;
601
602 if ((rst = (mcs->speed > 115200)))
603 mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
604
605 } else if (mcs->new_speed <= 1152000) {
606 rval &= ~MCS_FIR;
607
608 if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000)))
609 mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
610
611 } else {
612 rval |= MCS_FIR;
613
614 if ((rst = (mcs->speed != 4000000)))
615 mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
616
617 }
618
619 rval &= ~MCS_SPEED_MASK;
620 rval |= nspeed;
621
622 ret = mcs_set_reg(mcs, MCS_MODE_REG, rval);
623 if (unlikely(ret))
624 goto error;
625
626 if (rst)
627 switch (mcs->transceiver_type) {
628 case MCS_TSC_VISHAY:
629 ret = mcs_setup_transceiver_vishay(mcs);
630 break;
631
632 case MCS_TSC_SHARP:
633 ret = mcs_setup_transceiver_sharp(mcs);
634 break;
635
636 case MCS_TSC_AGILENT:
637 ret = mcs_setup_transceiver_agilent(mcs);
638 break;
639
640 default:
641 ret = 1;
642 IRDA_WARNING("Unknown transceiver type: %d",
643 mcs->transceiver_type);
644 }
645 if (unlikely(ret))
646 goto error;
647
648 mcs_get_reg(mcs, MCS_MODE_REG, &rval);
649 rval &= ~MCS_RESET;
650 ret = mcs_set_reg(mcs, MCS_MODE_REG, rval);
651
652 mcs->speed = mcs->new_speed;
653 error:
654 mcs->new_speed = 0;
655 return ret;
656}
657
658/* Ioctl calls not supported at this time. Can be an area of future work. */
659static int mcs_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
660{
661 /* struct if_irda_req *irq = (struct if_irda_req *)rq; */
662 /* struct mcs_cb *mcs = netdev_priv(netdev); */
663 int ret = 0;
664
665 switch (cmd) {
666 default:
667 ret = -EOPNOTSUPP;
668 }
669
670 return ret;
671}
672
673/* Network device is taken down, done by "ifconfig irda0 down" */
674static int mcs_net_close(struct net_device *netdev)
675{
676 int ret = 0;
677 struct mcs_cb *mcs = netdev_priv(netdev);
678
679 /* Stop transmit processing */
680 netif_stop_queue(netdev);
681
682 /* kill and free the receive and transmit URBs */
683 usb_kill_urb(mcs->rx_urb);
684 usb_free_urb(mcs->rx_urb);
685 usb_kill_urb(mcs->tx_urb);
686 usb_free_urb(mcs->tx_urb);
687
688 /* Stop and remove instance of IrLAP */
689 if (mcs->irlap)
690 irlap_close(mcs->irlap);
691
692 mcs->irlap = NULL;
693 return ret;
694}
695
696/* Network device is taken up, done by "ifconfig irda0 up" */
697static int mcs_net_open(struct net_device *netdev)
698{
699 struct mcs_cb *mcs = netdev_priv(netdev);
700 char hwname[16];
701 int ret = 0;
702
703 ret = usb_clear_halt(mcs->usbdev,
704 usb_sndbulkpipe(mcs->usbdev, mcs->ep_in));
705 if (ret)
706 goto error1;
707 ret = usb_clear_halt(mcs->usbdev,
708 usb_rcvbulkpipe(mcs->usbdev, mcs->ep_out));
709 if (ret)
710 goto error1;
711
712 ret = mcs_setup_transceiver(mcs);
713 if (ret)
714 goto error1;
715
716 ret = -ENOMEM;
717
718 /* Initialize for SIR/FIR to copy data directly into skb. */
719 mcs->receiving = 0;
720 mcs->rx_buff.truesize = IRDA_SKB_MAX_MTU;
721 mcs->rx_buff.skb = dev_alloc_skb(IRDA_SKB_MAX_MTU);
722 if (!mcs->rx_buff.skb)
723 goto error1;
724
725 skb_reserve(mcs->rx_buff.skb, 1);
726 mcs->rx_buff.head = mcs->rx_buff.skb->data;
727 do_gettimeofday(&mcs->rx_time);
728
729 /*
730 * Now that everything should be initialized properly,
731 * Open new IrLAP layer instance to take care of us...
732 * Note : will send immediately a speed change...
733 */
734 sprintf(hwname, "usb#%d", mcs->usbdev->devnum);
735 mcs->irlap = irlap_open(netdev, &mcs->qos, hwname);
736 if (!mcs->irlap) {
737 IRDA_ERROR("mcs7780: irlap_open failed");
738 goto error2;
739 }
740
741 if (!mcs_setup_urbs(mcs))
742 goto error3;
743
744 ret = mcs_receive_start(mcs);
745 if (ret)
746 goto error3;
747
748 netif_start_queue(netdev);
749 return 0;
750
751 error3:
752 irlap_close(mcs->irlap);
753 error2:
754 kfree_skb(mcs->rx_buff.skb);
755 error1:
756 return ret;
757}
758
759
760/* Get device stats for /proc/net/dev and ifconfig */
761static struct net_device_stats *mcs_net_get_stats(struct net_device *netdev)
762{
763 struct mcs_cb *mcs = netdev_priv(netdev);
764 return &mcs->stats;
765}
766
767/* Receive callback function. */
768static void mcs_receive_irq(struct urb *urb, struct pt_regs *regs)
769{
770 __u8 *bytes;
771 struct mcs_cb *mcs = urb->context;
772 int i;
773 int ret;
774
775 if (!netif_running(mcs->netdev))
776 return;
777
778 if (urb->status)
779 return;
780
781 if (urb->actual_length > 0) {
782 bytes = urb->transfer_buffer;
783
784 /* MCS returns frames without BOF and EOF
785 * I assume it returns whole frames.
786 */
787 /* SIR speed */
788 if(mcs->speed < 576000) {
789 async_unwrap_char(mcs->netdev, &mcs->stats,
790 &mcs->rx_buff, 0xc0);
791
792 for (i = 0; i < urb->actual_length; i++)
793 async_unwrap_char(mcs->netdev, &mcs->stats,
794 &mcs->rx_buff, bytes[i]);
795
796 async_unwrap_char(mcs->netdev, &mcs->stats,
797 &mcs->rx_buff, 0xc1);
798 }
799 /* MIR speed */
800 else if(mcs->speed == 576000 || mcs->speed == 1152000) {
801 mcs_unwrap_mir(mcs, urb->transfer_buffer,
802 urb->actual_length);
803 }
804 /* FIR speed */
805 else {
806 mcs_unwrap_fir(mcs, urb->transfer_buffer,
807 urb->actual_length);
808 }
809 mcs->netdev->last_rx = jiffies;
810 do_gettimeofday(&mcs->rx_time);
811 }
812
813 ret = usb_submit_urb(urb, GFP_ATOMIC);
814}
815
816/* Transmit callback funtion. */
817static void mcs_send_irq(struct urb *urb, struct pt_regs *regs)
818{
819 struct mcs_cb *mcs = urb->context;
820 struct net_device *ndev = mcs->netdev;
821
822 if (unlikely(mcs->new_speed))
823 schedule_work(&mcs->work);
824 else
825 netif_wake_queue(ndev);
826}
827
828/* Transmit callback funtion. */
829static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
830{
831 unsigned long flags;
832 struct mcs_cb *mcs;
833 int wraplen;
834 int ret = 0;
835
836
837 if (skb == NULL || ndev == NULL)
838 return -EINVAL;
839
840 netif_stop_queue(ndev);
841 mcs = netdev_priv(ndev);
842
843 spin_lock_irqsave(&mcs->lock, flags);
844
845 mcs->new_speed = irda_get_next_speed(skb);
846 if (likely(mcs->new_speed == mcs->speed))
847 mcs->new_speed = 0;
848
849 /* SIR speed */
850 if(mcs->speed < 576000) {
851 wraplen = mcs_wrap_sir_skb(skb, mcs->out_buf);
852 }
853 /* MIR speed */
854 else if(mcs->speed == 576000 || mcs->speed == 1152000) {
855 wraplen = mcs_wrap_mir_skb(skb, mcs->out_buf);
856 }
857 /* FIR speed */
858 else {
859 wraplen = mcs_wrap_fir_skb(skb, mcs->out_buf);
860 }
861 usb_fill_bulk_urb(mcs->tx_urb, mcs->usbdev,
862 usb_sndbulkpipe(mcs->usbdev, mcs->ep_out),
863 mcs->out_buf, wraplen, mcs_send_irq, mcs);
864
865 if ((ret = usb_submit_urb(mcs->tx_urb, GFP_ATOMIC))) {
866 IRDA_ERROR("failed tx_urb: %d", ret);
867 switch (ret) {
868 case -ENODEV:
869 case -EPIPE:
870 break;
871 default:
872 mcs->stats.tx_errors++;
873 netif_start_queue(ndev);
874 }
875 } else {
876 mcs->stats.tx_packets++;
877 mcs->stats.tx_bytes += skb->len;
878 }
879
880 dev_kfree_skb(skb);
881 spin_unlock_irqrestore(&mcs->lock, flags);
882 return ret;
883}
884
885/*
886 * This function is called by the USB subsystem for each new device in the
887 * system. Need to verify the device and if it is, then start handling it.
888 */
889static int mcs_probe(struct usb_interface *intf,
890 const struct usb_device_id *id)
891{
892 struct usb_device *udev = interface_to_usbdev(intf);
893 struct net_device *ndev = NULL;
894 struct mcs_cb *mcs;
895 int ret = -ENOMEM;
896
897 ndev = alloc_irdadev(sizeof(*mcs));
898 if (!ndev)
899 goto error1;
900
901 IRDA_DEBUG(1, "MCS7780 USB-IrDA bridge found at %d.", udev->devnum);
902
903 /* what is it realy for? */
904 SET_MODULE_OWNER(ndev);
905 SET_NETDEV_DEV(ndev, &intf->dev);
906
907 ret = usb_reset_configuration(udev);
908 if (ret != 0) {
909 IRDA_ERROR("mcs7780: usb reset configuration failed");
910 goto error2;
911 }
912
913 mcs = netdev_priv(ndev);
914 mcs->usbdev = udev;
915 mcs->netdev = ndev;
916 spin_lock_init(&mcs->lock);
917
918 /* Initialize QoS for this device */
919 irda_init_max_qos_capabilies(&mcs->qos);
920
921 /* That's the Rx capability. */
922 mcs->qos.baud_rate.bits &=
923 IR_2400 | IR_9600 | IR_19200 | IR_38400 | IR_57600 | IR_115200
924 | IR_576000 | IR_1152000 | (IR_4000000 << 8);
925
926
927 mcs->qos.min_turn_time.bits &= qos_mtt_bits;
928 irda_qos_bits_to_value(&mcs->qos);
929
930 /* Speed change work initialisation*/
931 INIT_WORK(&mcs->work, mcs_speed_work, mcs);
932
933 /* Override the network functions we need to use */
934 ndev->hard_start_xmit = mcs_hard_xmit;
935 ndev->open = mcs_net_open;
936 ndev->stop = mcs_net_close;
937 ndev->get_stats = mcs_net_get_stats;
938 ndev->do_ioctl = mcs_net_ioctl;
939
940 if (!intf->cur_altsetting)
941 goto error2;
942
943 ret = mcs_find_endpoints(mcs, intf->cur_altsetting->endpoint,
944 intf->cur_altsetting->desc.bNumEndpoints);
945 if (!ret) {
946 ret = -ENODEV;
947 goto error2;
948 }
949
950 ret = register_netdev(ndev);
951 if (ret != 0)
952 goto error2;
953
954 IRDA_DEBUG(1, "IrDA: Registered MosChip MCS7780 device as %s",
955 ndev->name);
956
957 mcs->transceiver_type = transceiver_type;
958 mcs->sir_tweak = sir_tweak;
959 mcs->receive_mode = receive_mode;
960
961 usb_set_intfdata(intf, mcs);
962 return 0;
963
964 error2:
965 free_netdev(ndev);
966
967 error1:
968 return ret;
969}
970
971/* The current device is removed, the USB layer tells us to shut down. */
972static void mcs_disconnect(struct usb_interface *intf)
973{
974 struct mcs_cb *mcs = usb_get_intfdata(intf);
975
976 if (!mcs)
977 return;
978
979 flush_scheduled_work();
980
981 unregister_netdev(mcs->netdev);
982 free_netdev(mcs->netdev);
983
984 usb_set_intfdata(intf, NULL);
985 IRDA_DEBUG(0, "MCS7780 now disconnected.");
986}
987
988/* Module insertion */
989static int __init mcs_init(void)
990{
991 int result;
992
993 /* register this driver with the USB subsystem */
994 result = usb_register(&mcs_driver);
995 if (result)
996 IRDA_ERROR("usb_register failed. Error number %d", result);
997
998 return result;
999}
1000module_init(mcs_init);
1001
1002/* Module removal */
1003static void __exit mcs_exit(void)
1004{
1005 /* deregister this driver with the USB subsystem */
1006 usb_deregister(&mcs_driver);
1007}
1008module_exit(mcs_exit);
1009
diff --git a/drivers/net/irda/mcs7780.h b/drivers/net/irda/mcs7780.h
new file mode 100644
index 000000000000..1a723d725c2a
--- /dev/null
+++ b/drivers/net/irda/mcs7780.h
@@ -0,0 +1,167 @@
1/*****************************************************************************
2*
3* Filename: mcs7780.h
4* Version: 0.2-alpha
5* Description: Irda MosChip USB Dongle
6* Status: Experimental
7* Authors: Lukasz Stelmach <stlman@poczta.fm>
8* Brian Pugh <bpugh@cs.pdx.edu>
9*
10* Copyright (C) 2005, Lukasz Stelmach <stlman@poczta.fm>
11* Copyright (C) 2005, Brian Pugh <bpugh@cs.pdx.edu>
12*
13* This program is free software; you can redistribute it and/or modify
14* it under the terms of the GNU General Public License as published by
15* the Free Software Foundation; either version 2 of the License, or
16* (at your option) any later version.
17*
18* This program is distributed in the hope that it will be useful,
19* but WITHOUT ANY WARRANTY; without even the implied warranty of
20* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21* GNU General Public License for more details.
22*
23* You should have received a copy of the GNU General Public License
24* along with this program; if not, write to the Free Software
25* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*
27*****************************************************************************/
28#ifndef _MCS7780_H
29#define _MCS7780_H
30
31#define MCS_MODE_SIR 0
32#define MCS_MODE_MIR 1
33#define MCS_MODE_FIR 2
34
35#define MCS_CTRL_TIMEOUT 500
36#define MCS_XMIT_TIMEOUT 500
37/* Possible transceiver types */
38#define MCS_TSC_VISHAY 0 /* Vishay TFD, default choice */
39#define MCS_TSC_AGILENT 1 /* Agilent 3602/3600 */
40#define MCS_TSC_SHARP 2 /* Sharp GP2W1000YP */
41
42/* Requests */
43#define MCS_RD_RTYPE 0xC0
44#define MCS_WR_RTYPE 0x40
45#define MCS_RDREQ 0x0F
46#define MCS_WRREQ 0x0E
47
48/* Register 0x00 */
49#define MCS_MODE_REG 0
50#define MCS_FIR ((__u16)0x0001)
51#define MCS_SIR16US ((__u16)0x0002)
52#define MCS_BBTG ((__u16)0x0004)
53#define MCS_ASK ((__u16)0x0008)
54#define MCS_PARITY ((__u16)0x0010)
55
56/* SIR/MIR speed constants */
57#define MCS_SPEED_SHIFT 5
58#define MCS_SPEED_MASK ((__u16)0x00E0)
59#define MCS_SPEED(x) ((x & MCS_SPEED_MASK) >> MCS_SPEED_SHIFT)
60#define MCS_SPEED_2400 ((0 << MCS_SPEED_SHIFT) & MCS_SPEED_MASK)
61#define MCS_SPEED_9600 ((1 << MCS_SPEED_SHIFT) & MCS_SPEED_MASK)
62#define MCS_SPEED_19200 ((2 << MCS_SPEED_SHIFT) & MCS_SPEED_MASK)
63#define MCS_SPEED_38400 ((3 << MCS_SPEED_SHIFT) & MCS_SPEED_MASK)
64#define MCS_SPEED_57600 ((4 << MCS_SPEED_SHIFT) & MCS_SPEED_MASK)
65#define MCS_SPEED_115200 ((5 << MCS_SPEED_SHIFT) & MCS_SPEED_MASK)
66#define MCS_SPEED_576000 ((6 << MCS_SPEED_SHIFT) & MCS_SPEED_MASK)
67#define MCS_SPEED_1152000 ((7 << MCS_SPEED_SHIFT) & MCS_SPEED_MASK)
68
69#define MCS_PLLPWDN ((__u16)0x0100)
70#define MCS_DRIVER ((__u16)0x0200)
71#define MCS_DTD ((__u16)0x0400)
72#define MCS_DIR ((__u16)0x0800)
73#define MCS_SIPEN ((__u16)0x1000)
74#define MCS_SENDSIP ((__u16)0x2000)
75#define MCS_CHGDIR ((__u16)0x4000)
76#define MCS_RESET ((__u16)0x8000)
77
78/* Register 0x02 */
79#define MCS_XCVR_REG 2
80#define MCS_MODE0 ((__u16)0x0001)
81#define MCS_STFIR ((__u16)0x0002)
82#define MCS_XCVR_CONF ((__u16)0x0004)
83#define MCS_RXFAST ((__u16)0x0008)
84/* TXCUR [6:4] */
85#define MCS_TXCUR_SHIFT 4
86#define MCS_TXCUR_MASK ((__u16)0x0070)
87#define MCS_TXCUR(x) ((x & MCS_TXCUR_MASK) >> MCS_TXCUR_SHIFT)
88#define MCS_SETTXCUR(x,y) \
89 ((x & ~MCS_TXCUR_MASK) | (y << MCS_TXCUR_SHIFT) & MCS_TXCUR_MASK)
90
91#define MCS_MODE1 ((__u16)0x0080)
92#define MCS_SMODE0 ((__u16)0x0100)
93#define MCS_SMODE1 ((__u16)0x0200)
94#define MCS_INVTX ((__u16)0x0400)
95#define MCS_INVRX ((__u16)0x0800)
96
97#define MCS_MINRXPW_REG 4
98
99#define MCS_RESV_REG 7
100#define MCS_IRINTX ((__u16)0x0001)
101#define MCS_IRINRX ((__u16)0x0002)
102
103struct mcs_cb {
104 struct usb_device *usbdev; /* init: probe_irda */
105 struct net_device *netdev; /* network layer */
106 struct irlap_cb *irlap; /* The link layer we are binded to */
107 struct net_device_stats stats; /* network statistics */
108 struct qos_info qos;
109 unsigned int speed; /* Current speed */
110 unsigned int new_speed; /* new speed */
111
112 struct work_struct work; /* Change speed work */
113
114 struct sk_buff *tx_pending;
115 char in_buf[4096]; /* transmit/receive buffer */
116 char out_buf[4096]; /* transmit/receive buffer */
117 __u8 *fifo_status;
118
119 iobuff_t rx_buff; /* receive unwrap state machine */
120 struct timeval rx_time;
121 spinlock_t lock;
122 int receiving;
123
124 __u8 ep_in;
125 __u8 ep_out;
126
127 struct urb *rx_urb;
128 struct urb *tx_urb;
129
130 int transceiver_type;
131 int sir_tweak;
132 int receive_mode;
133};
134
135static int mcs_set_reg(struct mcs_cb *mcs, __u16 reg, __u16 val);
136static int mcs_get_reg(struct mcs_cb *mcs, __u16 reg, __u16 * val);
137
138static inline int mcs_setup_transceiver_vishay(struct mcs_cb *mcs);
139static inline int mcs_setup_transceiver_agilent(struct mcs_cb *mcs);
140static inline int mcs_setup_transceiver_sharp(struct mcs_cb *mcs);
141static inline int mcs_setup_transceiver(struct mcs_cb *mcs);
142static inline int mcs_wrap_sir_skb(struct sk_buff *skb, __u8 * buf);
143static unsigned mcs_wrap_fir_skb(const struct sk_buff *skb, __u8 *buf);
144static unsigned mcs_wrap_mir_skb(const struct sk_buff *skb, __u8 *buf);
145static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len);
146static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len);
147static inline int mcs_setup_urbs(struct mcs_cb *mcs);
148static inline int mcs_receive_start(struct mcs_cb *mcs);
149static inline int mcs_find_endpoints(struct mcs_cb *mcs,
150 struct usb_host_endpoint *ep, int epnum);
151
152static int mcs_speed_change(struct mcs_cb *mcs);
153
154static int mcs_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd);
155static int mcs_net_close(struct net_device *netdev);
156static int mcs_net_open(struct net_device *netdev);
157static struct net_device_stats *mcs_net_get_stats(struct net_device *netdev);
158
159static void mcs_receive_irq(struct urb *urb, struct pt_regs *regs);
160static void mcs_send_irq(struct urb *urb, struct pt_regs *regs);
161static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *netdev);
162
163static int mcs_probe(struct usb_interface *intf,
164 const struct usb_device_id *id);
165static void mcs_disconnect(struct usb_interface *intf);
166
167#endif /* _MCS7780_H */
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 31867e4b891b..d61b208b52a2 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -50,6 +50,7 @@
50#include <linux/delay.h> 50#include <linux/delay.h>
51#include <linux/usb.h> 51#include <linux/usb.h>
52#include <linux/crc32.h> 52#include <linux/crc32.h>
53#include <linux/kthread.h>
53#include <net/irda/irda.h> 54#include <net/irda/irda.h>
54#include <net/irda/irlap.h> 55#include <net/irda/irlap.h>
55#include <net/irda/irda_device.h> 56#include <net/irda/irda_device.h>
@@ -173,9 +174,7 @@ struct stir_cb {
173 struct qos_info qos; 174 struct qos_info qos;
174 unsigned speed; /* Current speed */ 175 unsigned speed; /* Current speed */
175 176
176 wait_queue_head_t thr_wait; /* transmit thread wakeup */ 177 struct task_struct *thread; /* transmit thread */
177 struct completion thr_exited;
178 pid_t thr_pid;
179 178
180 struct sk_buff *tx_pending; 179 struct sk_buff *tx_pending;
181 void *io_buf; /* transmit/receive buffer */ 180 void *io_buf; /* transmit/receive buffer */
@@ -577,7 +576,7 @@ static int stir_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
577 SKB_LINEAR_ASSERT(skb); 576 SKB_LINEAR_ASSERT(skb);
578 577
579 skb = xchg(&stir->tx_pending, skb); 578 skb = xchg(&stir->tx_pending, skb);
580 wake_up(&stir->thr_wait); 579 wake_up_process(stir->thread);
581 580
582 /* this should never happen unless stop/wakeup problem */ 581 /* this should never happen unless stop/wakeup problem */
583 if (unlikely(skb)) { 582 if (unlikely(skb)) {
@@ -753,13 +752,7 @@ static int stir_transmit_thread(void *arg)
753 struct net_device *dev = stir->netdev; 752 struct net_device *dev = stir->netdev;
754 struct sk_buff *skb; 753 struct sk_buff *skb;
755 754
756 daemonize("%s", dev->name); 755 while (!kthread_should_stop()) {
757 allow_signal(SIGTERM);
758
759 while (netif_running(dev)
760 && netif_device_present(dev)
761 && !signal_pending(current))
762 {
763#ifdef CONFIG_PM 756#ifdef CONFIG_PM
764 /* if suspending, then power off and wait */ 757 /* if suspending, then power off and wait */
765 if (unlikely(freezing(current))) { 758 if (unlikely(freezing(current))) {
@@ -813,10 +806,11 @@ static int stir_transmit_thread(void *arg)
813 } 806 }
814 807
815 /* sleep if nothing to send */ 808 /* sleep if nothing to send */
816 wait_event_interruptible(stir->thr_wait, stir->tx_pending); 809 set_current_state(TASK_INTERRUPTIBLE);
817 } 810 schedule();
818 811
819 complete_and_exit (&stir->thr_exited, 0); 812 }
813 return 0;
820} 814}
821 815
822 816
@@ -859,7 +853,7 @@ static void stir_rcv_irq(struct urb *urb, struct pt_regs *regs)
859 warn("%s: usb receive submit error: %d", 853 warn("%s: usb receive submit error: %d",
860 stir->netdev->name, err); 854 stir->netdev->name, err);
861 stir->receiving = 0; 855 stir->receiving = 0;
862 wake_up(&stir->thr_wait); 856 wake_up_process(stir->thread);
863 } 857 }
864} 858}
865 859
@@ -928,10 +922,10 @@ static int stir_net_open(struct net_device *netdev)
928 } 922 }
929 923
930 /** Start kernel thread for transmit. */ 924 /** Start kernel thread for transmit. */
931 stir->thr_pid = kernel_thread(stir_transmit_thread, stir, 925 stir->thread = kthread_run(stir_transmit_thread, stir,
932 CLONE_FS|CLONE_FILES); 926 "%s", stir->netdev->name);
933 if (stir->thr_pid < 0) { 927 if (IS_ERR(stir->thread)) {
934 err = stir->thr_pid; 928 err = PTR_ERR(stir->thread);
935 err("stir4200: unable to start kernel thread"); 929 err("stir4200: unable to start kernel thread");
936 goto err_out6; 930 goto err_out6;
937 } 931 }
@@ -968,8 +962,7 @@ static int stir_net_close(struct net_device *netdev)
968 netif_stop_queue(netdev); 962 netif_stop_queue(netdev);
969 963
970 /* Kill transmit thread */ 964 /* Kill transmit thread */
971 kill_proc(stir->thr_pid, SIGTERM, 1); 965 kthread_stop(stir->thread);
972 wait_for_completion(&stir->thr_exited);
973 kfree(stir->fifo_status); 966 kfree(stir->fifo_status);
974 967
975 /* Mop up receive urb's */ 968 /* Mop up receive urb's */
@@ -1084,9 +1077,6 @@ static int stir_probe(struct usb_interface *intf,
1084 stir->qos.min_turn_time.bits &= qos_mtt_bits; 1077 stir->qos.min_turn_time.bits &= qos_mtt_bits;
1085 irda_qos_bits_to_value(&stir->qos); 1078 irda_qos_bits_to_value(&stir->qos);
1086 1079
1087 init_completion (&stir->thr_exited);
1088 init_waitqueue_head (&stir->thr_wait);
1089
1090 /* Override the network functions we need to use */ 1080 /* Override the network functions we need to use */
1091 net->hard_start_xmit = stir_hard_xmit; 1081 net->hard_start_xmit = stir_hard_xmit;
1092 net->open = stir_net_open; 1082 net->open = stir_net_open;
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 97a49e0be76b..d70b9e8d6e60 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -959,7 +959,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
959 || (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec)) 959 || (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec))
960 break; 960 break;
961 udelay(100); 961 udelay(100);
962 /* must not sleep here - we are called under xmit_lock! */ 962 /* must not sleep here - called under netif_tx_lock! */
963 } 963 }
964 } 964 }
965 965
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 411f4d809c47..625ff61c9988 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1200,7 +1200,7 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
1200 } 1200 }
1201 1201
1202 if (has_tiny_unaligned_frags(skb)) { 1202 if (has_tiny_unaligned_frags(skb)) {
1203 if ((skb_linearize(skb, GFP_ATOMIC) != 0)) { 1203 if (__skb_linearize(skb)) {
1204 stats->tx_dropped++; 1204 stats->tx_dropped++;
1205 printk(KERN_DEBUG "%s: failed to linearize tiny " 1205 printk(KERN_DEBUG "%s: failed to linearize tiny "
1206 "unaligned fragment\n", dev->name); 1206 "unaligned fragment\n", dev->name);
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 90627756d6fa..2e4ecedba057 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -318,12 +318,12 @@ performance critical codepaths:
318The rx process only runs in the interrupt handler. Access from outside 318The rx process only runs in the interrupt handler. Access from outside
319the interrupt handler is only permitted after disable_irq(). 319the interrupt handler is only permitted after disable_irq().
320 320
321The rx process usually runs under the dev->xmit_lock. If np->intr_tx_reap 321The rx process usually runs under the netif_tx_lock. If np->intr_tx_reap
322is set, then access is permitted under spin_lock_irq(&np->lock). 322is set, then access is permitted under spin_lock_irq(&np->lock).
323 323
324Thus configuration functions that want to access everything must call 324Thus configuration functions that want to access everything must call
325 disable_irq(dev->irq); 325 disable_irq(dev->irq);
326 spin_lock_bh(dev->xmit_lock); 326 netif_tx_lock_bh(dev);
327 spin_lock_irq(&np->lock); 327 spin_lock_irq(&np->lock);
328 328
329IV. Notes 329IV. Notes
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index b32765215f75..963a11fa9fe2 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -829,7 +829,7 @@ that the ne2k probe is the last 8390 based probe to take place (as it
829is at boot) and so the probe will get confused by any other 8390 cards. 829is at boot) and so the probe will get confused by any other 8390 cards.
830ISA device autoprobes on a running machine are not recommended anyway. */ 830ISA device autoprobes on a running machine are not recommended anyway. */
831 831
832int init_module(void) 832int __init init_module(void)
833{ 833{
834 int this_dev, found = 0; 834 int this_dev, found = 0;
835 835
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c
index 2aa7b77f84f8..eebf5f02b476 100644
--- a/drivers/net/ne2.c
+++ b/drivers/net/ne2.c
@@ -780,7 +780,7 @@ MODULE_PARM_DESC(bad, "(ignored)");
780 780
781/* Module code fixed by David Weinehall */ 781/* Module code fixed by David Weinehall */
782 782
783int init_module(void) 783int __init init_module(void)
784{ 784{
785 struct net_device *dev; 785 struct net_device *dev;
786 int this_dev, found = 0; 786 int this_dev, found = 0;
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index b2073fce8216..01cd8ec751ea 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1609,8 +1609,6 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1609 kfree_skb(skb); 1609 kfree_skb(skb);
1610 skb = ns; 1610 skb = ns;
1611 } 1611 }
1612 else if (!pskb_may_pull(skb, skb->len))
1613 goto err;
1614 else 1612 else
1615 skb->ip_summed = CHECKSUM_NONE; 1613 skb->ip_summed = CHECKSUM_NONE;
1616 1614
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index cac9fdd2e1d5..11daed495b97 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2627,6 +2627,50 @@ no_rx:
2627#endif 2627#endif
2628 2628
2629/** 2629/**
2630 * s2io_netpoll - Rx interrupt service handler for netpoll support
2631 * @dev : pointer to the device structure.
2632 * Description:
2633 * Polling 'interrupt' - used by things like netconsole to send skbs
2634 * without having to re-enable interrupts. It's not called while
2635 * the interrupt routine is executing.
2636 */
2637
2638#ifdef CONFIG_NET_POLL_CONTROLLER
2639static void s2io_netpoll(struct net_device *dev)
2640{
2641 nic_t *nic = dev->priv;
2642 mac_info_t *mac_control;
2643 struct config_param *config;
2644 XENA_dev_config_t __iomem *bar0 = nic->bar0;
2645 u64 val64;
2646 int i;
2647
2648 disable_irq(dev->irq);
2649
2650 atomic_inc(&nic->isr_cnt);
2651 mac_control = &nic->mac_control;
2652 config = &nic->config;
2653
2654 val64 = readq(&bar0->rx_traffic_int);
2655 writeq(val64, &bar0->rx_traffic_int);
2656
2657 for (i = 0; i < config->rx_ring_num; i++)
2658 rx_intr_handler(&mac_control->rings[i]);
2659
2660 for (i = 0; i < config->rx_ring_num; i++) {
2661 if (fill_rx_buffers(nic, i) == -ENOMEM) {
2662 DBG_PRINT(ERR_DBG, "%s:Out of memory", dev->name);
2663 DBG_PRINT(ERR_DBG, " in Rx Netpoll!!\n");
2664 break;
2665 }
2666 }
2667 atomic_dec(&nic->isr_cnt);
2668 enable_irq(dev->irq);
2669 return;
2670}
2671#endif
2672
2673/**
2630 * rx_intr_handler - Rx interrupt handler 2674 * rx_intr_handler - Rx interrupt handler
2631 * @nic: device private variable. 2675 * @nic: device private variable.
2632 * Description: 2676 * Description:
@@ -6967,6 +7011,10 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
6967 dev->weight = 32; 7011 dev->weight = 32;
6968#endif 7012#endif
6969 7013
7014#ifdef CONFIG_NET_POLL_CONTROLLER
7015 dev->poll_controller = s2io_netpoll;
7016#endif
7017
6970 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 7018 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
6971 if (sp->high_dma_flag == TRUE) 7019 if (sp->high_dma_flag == TRUE)
6972 dev->features |= NETIF_F_HIGHDMA; 7020 dev->features |= NETIF_F_HIGHDMA;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 959109609d85..fba1e4d4d83d 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -187,12 +187,11 @@ static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
187 return v; 187 return v;
188} 188}
189 189
190static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) 190static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
191{ 191{
192 u16 power_control; 192 u16 power_control;
193 u32 reg1; 193 u32 reg1;
194 int vaux; 194 int vaux;
195 int ret = 0;
196 195
197 pr_debug("sky2_set_power_state %d\n", state); 196 pr_debug("sky2_set_power_state %d\n", state);
198 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 197 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
@@ -275,12 +274,10 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
275 break; 274 break;
276 default: 275 default:
277 printk(KERN_ERR PFX "Unknown power state %d\n", state); 276 printk(KERN_ERR PFX "Unknown power state %d\n", state);
278 ret = -1;
279 } 277 }
280 278
281 sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control); 279 sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control);
282 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); 280 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
283 return ret;
284} 281}
285 282
286static void sky2_phy_reset(struct sky2_hw *hw, unsigned port) 283static void sky2_phy_reset(struct sky2_hw *hw, unsigned port)
@@ -2164,6 +2161,13 @@ static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port,
2164/* If idle then force a fake soft NAPI poll once a second 2161/* If idle then force a fake soft NAPI poll once a second
2165 * to work around cases where sharing an edge triggered interrupt. 2162 * to work around cases where sharing an edge triggered interrupt.
2166 */ 2163 */
2164static inline void sky2_idle_start(struct sky2_hw *hw)
2165{
2166 if (idle_timeout > 0)
2167 mod_timer(&hw->idle_timer,
2168 jiffies + msecs_to_jiffies(idle_timeout));
2169}
2170
2167static void sky2_idle(unsigned long arg) 2171static void sky2_idle(unsigned long arg)
2168{ 2172{
2169 struct sky2_hw *hw = (struct sky2_hw *) arg; 2173 struct sky2_hw *hw = (struct sky2_hw *) arg;
@@ -2183,6 +2187,9 @@ static int sky2_poll(struct net_device *dev0, int *budget)
2183 int work_done = 0; 2187 int work_done = 0;
2184 u32 status = sky2_read32(hw, B0_Y2_SP_EISR); 2188 u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
2185 2189
2190 if (!~status)
2191 goto out;
2192
2186 if (status & Y2_IS_HW_ERR) 2193 if (status & Y2_IS_HW_ERR)
2187 sky2_hw_intr(hw); 2194 sky2_hw_intr(hw);
2188 2195
@@ -2219,7 +2226,7 @@ static int sky2_poll(struct net_device *dev0, int *budget)
2219 2226
2220 if (sky2_more_work(hw)) 2227 if (sky2_more_work(hw))
2221 return 1; 2228 return 1;
2222 2229out:
2223 netif_rx_complete(dev0); 2230 netif_rx_complete(dev0);
2224 2231
2225 sky2_read32(hw, B0_Y2_SP_LISR); 2232 sky2_read32(hw, B0_Y2_SP_LISR);
@@ -2248,8 +2255,10 @@ static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs)
2248static void sky2_netpoll(struct net_device *dev) 2255static void sky2_netpoll(struct net_device *dev)
2249{ 2256{
2250 struct sky2_port *sky2 = netdev_priv(dev); 2257 struct sky2_port *sky2 = netdev_priv(dev);
2258 struct net_device *dev0 = sky2->hw->dev[0];
2251 2259
2252 sky2_intr(sky2->hw->pdev->irq, sky2->hw, NULL); 2260 if (netif_running(dev) && __netif_rx_schedule_prep(dev0))
2261 __netif_rx_schedule(dev0);
2253} 2262}
2254#endif 2263#endif
2255 2264
@@ -3350,9 +3359,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
3350 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 3359 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
3351 3360
3352 setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); 3361 setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw);
3353 if (idle_timeout > 0) 3362 sky2_idle_start(hw);
3354 mod_timer(&hw->idle_timer,
3355 jiffies + msecs_to_jiffies(idle_timeout));
3356 3363
3357 pci_set_drvdata(pdev, hw); 3364 pci_set_drvdata(pdev, hw);
3358 3365
@@ -3425,8 +3432,14 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
3425{ 3432{
3426 struct sky2_hw *hw = pci_get_drvdata(pdev); 3433 struct sky2_hw *hw = pci_get_drvdata(pdev);
3427 int i; 3434 int i;
3435 pci_power_t pstate = pci_choose_state(pdev, state);
3436
3437 if (!(pstate == PCI_D3hot || pstate == PCI_D3cold))
3438 return -EINVAL;
3439
3440 del_timer_sync(&hw->idle_timer);
3428 3441
3429 for (i = 0; i < 2; i++) { 3442 for (i = 0; i < hw->ports; i++) {
3430 struct net_device *dev = hw->dev[i]; 3443 struct net_device *dev = hw->dev[i];
3431 3444
3432 if (dev) { 3445 if (dev) {
@@ -3435,10 +3448,14 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
3435 3448
3436 sky2_down(dev); 3449 sky2_down(dev);
3437 netif_device_detach(dev); 3450 netif_device_detach(dev);
3451 netif_poll_disable(dev);
3438 } 3452 }
3439 } 3453 }
3440 3454
3441 return sky2_set_power_state(hw, pci_choose_state(pdev, state)); 3455 sky2_write32(hw, B0_IMSK, 0);
3456 pci_save_state(pdev);
3457 sky2_set_power_state(hw, pstate);
3458 return 0;
3442} 3459}
3443 3460
3444static int sky2_resume(struct pci_dev *pdev) 3461static int sky2_resume(struct pci_dev *pdev)
@@ -3448,27 +3465,31 @@ static int sky2_resume(struct pci_dev *pdev)
3448 3465
3449 pci_restore_state(pdev); 3466 pci_restore_state(pdev);
3450 pci_enable_wake(pdev, PCI_D0, 0); 3467 pci_enable_wake(pdev, PCI_D0, 0);
3451 err = sky2_set_power_state(hw, PCI_D0); 3468 sky2_set_power_state(hw, PCI_D0);
3452 if (err)
3453 goto out;
3454 3469
3455 err = sky2_reset(hw); 3470 err = sky2_reset(hw);
3456 if (err) 3471 if (err)
3457 goto out; 3472 goto out;
3458 3473
3459 for (i = 0; i < 2; i++) { 3474 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
3475
3476 for (i = 0; i < hw->ports; i++) {
3460 struct net_device *dev = hw->dev[i]; 3477 struct net_device *dev = hw->dev[i];
3461 if (dev && netif_running(dev)) { 3478 if (dev && netif_running(dev)) {
3462 netif_device_attach(dev); 3479 netif_device_attach(dev);
3480 netif_poll_enable(dev);
3481
3463 err = sky2_up(dev); 3482 err = sky2_up(dev);
3464 if (err) { 3483 if (err) {
3465 printk(KERN_ERR PFX "%s: could not up: %d\n", 3484 printk(KERN_ERR PFX "%s: could not up: %d\n",
3466 dev->name, err); 3485 dev->name, err);
3467 dev_close(dev); 3486 dev_close(dev);
3468 break; 3487 goto out;
3469 } 3488 }
3470 } 3489 }
3471 } 3490 }
3491
3492 sky2_idle_start(hw);
3472out: 3493out:
3473 return err; 3494 return err;
3474} 3495}
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c
index 3db30cd0625e..5b4e8529d4ab 100644
--- a/drivers/net/smc-ultra.c
+++ b/drivers/net/smc-ultra.c
@@ -553,7 +553,7 @@ MODULE_LICENSE("GPL");
553 553
554/* This is set up so that only a single autoprobe takes place per call. 554/* This is set up so that only a single autoprobe takes place per call.
555ISA device autoprobes on a running machine are not recommended. */ 555ISA device autoprobes on a running machine are not recommended. */
556int 556int __init
557init_module(void) 557init_module(void)
558{ 558{
559 struct net_device *dev; 559 struct net_device *dev;
diff --git a/drivers/net/smc-ultra32.c b/drivers/net/smc-ultra32.c
index b3e397d7ca85..ff9bd97746dc 100644
--- a/drivers/net/smc-ultra32.c
+++ b/drivers/net/smc-ultra32.c
@@ -421,7 +421,7 @@ static struct net_device *dev_ultra[MAX_ULTRA32_CARDS];
421MODULE_DESCRIPTION("SMC Ultra32 EISA ethernet driver"); 421MODULE_DESCRIPTION("SMC Ultra32 EISA ethernet driver");
422MODULE_LICENSE("GPL"); 422MODULE_LICENSE("GPL");
423 423
424int init_module(void) 424int __init init_module(void)
425{ 425{
426 int this_dev, found = 0; 426 int this_dev, found = 0;
427 427
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index f86697da04d6..6cf16f322ad5 100644
--- a/drivers/net/smc9194.c
+++ b/drivers/net/smc9194.c
@@ -732,12 +732,9 @@ static int ifport;
732struct net_device * __init smc_init(int unit) 732struct net_device * __init smc_init(int unit)
733{ 733{
734 struct net_device *dev = alloc_etherdev(sizeof(struct smc_local)); 734 struct net_device *dev = alloc_etherdev(sizeof(struct smc_local));
735 static struct devlist *smcdev = smc_devlist; 735 struct devlist *smcdev = smc_devlist;
736 int err = 0; 736 int err = 0;
737 737
738#ifndef NO_AUTOPROBE
739 smcdev = smc_devlist;
740#endif
741 if (!dev) 738 if (!dev)
742 return ERR_PTR(-ENODEV); 739 return ERR_PTR(-ENODEV);
743 740
@@ -1607,7 +1604,7 @@ MODULE_PARM_DESC(io, "SMC 99194 I/O base address");
1607MODULE_PARM_DESC(irq, "SMC 99194 IRQ number"); 1604MODULE_PARM_DESC(irq, "SMC 99194 IRQ number");
1608MODULE_PARM_DESC(ifport, "SMC 99194 interface port (0-default, 1-TP, 2-AUI)"); 1605MODULE_PARM_DESC(ifport, "SMC 99194 interface port (0-default, 1-TP, 2-AUI)");
1609 1606
1610int init_module(void) 1607int __init init_module(void)
1611{ 1608{
1612 if (io == 0) 1609 if (io == 0)
1613 printk(KERN_WARNING 1610 printk(KERN_WARNING
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index 61eec46cb111..f13b2a195c70 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -94,11 +94,13 @@
94 Version LK1.10 (Philippe De Muyter phdm@macqel.be): 94 Version LK1.10 (Philippe De Muyter phdm@macqel.be):
95 - Make 'unblock interface after Tx underrun' work 95 - Make 'unblock interface after Tx underrun' work
96 96
97 Version LK1.11 (Pedro Alejandro Lopez-Valencia palopezv at gmail.com):
98 - Add support for IC Plus Corporation IP100A chipset
97*/ 99*/
98 100
99#define DRV_NAME "sundance" 101#define DRV_NAME "sundance"
100#define DRV_VERSION "1.01+LK1.10" 102#define DRV_VERSION "1.01+LK1.11"
101#define DRV_RELDATE "28-Oct-2005" 103#define DRV_RELDATE "14-Jun-2006"
102 104
103 105
104/* The user-configurable values. 106/* The user-configurable values.
@@ -287,6 +289,7 @@ static struct pci_device_id sundance_pci_tbl[] = {
287 {0x1186, 0x1002, 0x1186, 0x1040, 0, 0, 3}, 289 {0x1186, 0x1002, 0x1186, 0x1040, 0, 0, 3},
288 {0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 290 {0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
289 {0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5}, 291 {0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
292 {0x13F0, 0x0200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6},
290 {0,} 293 {0,}
291}; 294};
292MODULE_DEVICE_TABLE(pci, sundance_pci_tbl); 295MODULE_DEVICE_TABLE(pci, sundance_pci_tbl);
@@ -305,6 +308,7 @@ static const struct pci_id_info pci_id_tbl[] = {
305 {"D-Link DFE-530TXS FAST Ethernet Adapter"}, 308 {"D-Link DFE-530TXS FAST Ethernet Adapter"},
306 {"D-Link DL10050-based FAST Ethernet Adapter"}, 309 {"D-Link DL10050-based FAST Ethernet Adapter"},
307 {"Sundance Technology Alta"}, 310 {"Sundance Technology Alta"},
311 {"IC Plus Corporation IP100A FAST Ethernet Adapter"},
308 {NULL,}, /* 0 terminated list. */ 312 {NULL,}, /* 0 terminated list. */
309}; 313};
310 314
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 49ad60b72657..b2ddd4522a87 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -69,8 +69,8 @@
69 69
70#define DRV_MODULE_NAME "tg3" 70#define DRV_MODULE_NAME "tg3"
71#define PFX DRV_MODULE_NAME ": " 71#define PFX DRV_MODULE_NAME ": "
72#define DRV_MODULE_VERSION "3.58" 72#define DRV_MODULE_VERSION "3.60"
73#define DRV_MODULE_RELDATE "May 22, 2006" 73#define DRV_MODULE_RELDATE "June 17, 2006"
74 74
75#define TG3_DEF_MAC_MODE 0 75#define TG3_DEF_MAC_MODE 0
76#define TG3_DEF_RX_MODE 0 76#define TG3_DEF_RX_MODE 0
@@ -229,6 +229,8 @@ static struct pci_device_id tg3_pci_tbl[] = {
229 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 229 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
230 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755M, 230 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755M,
231 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 231 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
232 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786,
233 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
232 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787, 234 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787,
233 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 235 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
234 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M, 236 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M,
@@ -2965,6 +2967,27 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
2965 return err; 2967 return err;
2966} 2968}
2967 2969
2970/* This is called whenever we suspect that the system chipset is re-
2971 * ordering the sequence of MMIO to the tx send mailbox. The symptom
2972 * is bogus tx completions. We try to recover by setting the
2973 * TG3_FLAG_MBOX_WRITE_REORDER flag and resetting the chip later
2974 * in the workqueue.
2975 */
2976static void tg3_tx_recover(struct tg3 *tp)
2977{
2978 BUG_ON((tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) ||
2979 tp->write32_tx_mbox == tg3_write_indirect_mbox);
2980
2981 printk(KERN_WARNING PFX "%s: The system may be re-ordering memory-"
2982 "mapped I/O cycles to the network device, attempting to "
2983 "recover. Please report the problem to the driver maintainer "
2984 "and include system chipset information.\n", tp->dev->name);
2985
2986 spin_lock(&tp->lock);
2987 tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING;
2988 spin_unlock(&tp->lock);
2989}
2990
2968/* Tigon3 never reports partial packet sends. So we do not 2991/* Tigon3 never reports partial packet sends. So we do not
2969 * need special logic to handle SKBs that have not had all 2992 * need special logic to handle SKBs that have not had all
2970 * of their frags sent yet, like SunGEM does. 2993 * of their frags sent yet, like SunGEM does.
@@ -2977,9 +3000,13 @@ static void tg3_tx(struct tg3 *tp)
2977 while (sw_idx != hw_idx) { 3000 while (sw_idx != hw_idx) {
2978 struct tx_ring_info *ri = &tp->tx_buffers[sw_idx]; 3001 struct tx_ring_info *ri = &tp->tx_buffers[sw_idx];
2979 struct sk_buff *skb = ri->skb; 3002 struct sk_buff *skb = ri->skb;
2980 int i; 3003 int i, tx_bug = 0;
3004
3005 if (unlikely(skb == NULL)) {
3006 tg3_tx_recover(tp);
3007 return;
3008 }
2981 3009
2982 BUG_ON(skb == NULL);
2983 pci_unmap_single(tp->pdev, 3010 pci_unmap_single(tp->pdev,
2984 pci_unmap_addr(ri, mapping), 3011 pci_unmap_addr(ri, mapping),
2985 skb_headlen(skb), 3012 skb_headlen(skb),
@@ -2990,10 +3017,9 @@ static void tg3_tx(struct tg3 *tp)
2990 sw_idx = NEXT_TX(sw_idx); 3017 sw_idx = NEXT_TX(sw_idx);
2991 3018
2992 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 3019 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
2993 BUG_ON(sw_idx == hw_idx);
2994
2995 ri = &tp->tx_buffers[sw_idx]; 3020 ri = &tp->tx_buffers[sw_idx];
2996 BUG_ON(ri->skb != NULL); 3021 if (unlikely(ri->skb != NULL || sw_idx == hw_idx))
3022 tx_bug = 1;
2997 3023
2998 pci_unmap_page(tp->pdev, 3024 pci_unmap_page(tp->pdev,
2999 pci_unmap_addr(ri, mapping), 3025 pci_unmap_addr(ri, mapping),
@@ -3004,6 +3030,11 @@ static void tg3_tx(struct tg3 *tp)
3004 } 3030 }
3005 3031
3006 dev_kfree_skb(skb); 3032 dev_kfree_skb(skb);
3033
3034 if (unlikely(tx_bug)) {
3035 tg3_tx_recover(tp);
3036 return;
3037 }
3007 } 3038 }
3008 3039
3009 tp->tx_cons = sw_idx; 3040 tp->tx_cons = sw_idx;
@@ -3331,6 +3362,11 @@ static int tg3_poll(struct net_device *netdev, int *budget)
3331 /* run TX completion thread */ 3362 /* run TX completion thread */
3332 if (sblk->idx[0].tx_consumer != tp->tx_cons) { 3363 if (sblk->idx[0].tx_consumer != tp->tx_cons) {
3333 tg3_tx(tp); 3364 tg3_tx(tp);
3365 if (unlikely(tp->tg3_flags & TG3_FLAG_TX_RECOVERY_PENDING)) {
3366 netif_rx_complete(netdev);
3367 schedule_work(&tp->reset_task);
3368 return 0;
3369 }
3334 } 3370 }
3335 3371
3336 /* run RX thread, within the bounds set by NAPI. 3372 /* run RX thread, within the bounds set by NAPI.
@@ -3391,12 +3427,10 @@ static inline void tg3_full_lock(struct tg3 *tp, int irq_sync)
3391 if (irq_sync) 3427 if (irq_sync)
3392 tg3_irq_quiesce(tp); 3428 tg3_irq_quiesce(tp);
3393 spin_lock_bh(&tp->lock); 3429 spin_lock_bh(&tp->lock);
3394 spin_lock(&tp->tx_lock);
3395} 3430}
3396 3431
3397static inline void tg3_full_unlock(struct tg3 *tp) 3432static inline void tg3_full_unlock(struct tg3 *tp)
3398{ 3433{
3399 spin_unlock(&tp->tx_lock);
3400 spin_unlock_bh(&tp->lock); 3434 spin_unlock_bh(&tp->lock);
3401} 3435}
3402 3436
@@ -3579,6 +3613,13 @@ static void tg3_reset_task(void *_data)
3579 restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER; 3613 restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER;
3580 tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; 3614 tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER;
3581 3615
3616 if (tp->tg3_flags & TG3_FLAG_TX_RECOVERY_PENDING) {
3617 tp->write32_tx_mbox = tg3_write32_tx_mbox;
3618 tp->write32_rx_mbox = tg3_write_flush_reg32;
3619 tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER;
3620 tp->tg3_flags &= ~TG3_FLAG_TX_RECOVERY_PENDING;
3621 }
3622
3582 tg3_halt(tp, RESET_KIND_SHUTDOWN, 0); 3623 tg3_halt(tp, RESET_KIND_SHUTDOWN, 0);
3583 tg3_init_hw(tp, 1); 3624 tg3_init_hw(tp, 1);
3584 3625
@@ -3718,14 +3759,11 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3718 3759
3719 len = skb_headlen(skb); 3760 len = skb_headlen(skb);
3720 3761
3721 /* No BH disabling for tx_lock here. We are running in BH disabled 3762 /* We are running in BH disabled context with netif_tx_lock
3722 * context and TX reclaim runs via tp->poll inside of a software 3763 * and TX reclaim runs via tp->poll inside of a software
3723 * interrupt. Furthermore, IRQ processing runs lockless so we have 3764 * interrupt. Furthermore, IRQ processing runs lockless so we have
3724 * no IRQ context deadlocks to worry about either. Rejoice! 3765 * no IRQ context deadlocks to worry about either. Rejoice!
3725 */ 3766 */
3726 if (!spin_trylock(&tp->tx_lock))
3727 return NETDEV_TX_LOCKED;
3728
3729 if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { 3767 if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
3730 if (!netif_queue_stopped(dev)) { 3768 if (!netif_queue_stopped(dev)) {
3731 netif_stop_queue(dev); 3769 netif_stop_queue(dev);
@@ -3734,7 +3772,6 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3734 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " 3772 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
3735 "queue awake!\n", dev->name); 3773 "queue awake!\n", dev->name);
3736 } 3774 }
3737 spin_unlock(&tp->tx_lock);
3738 return NETDEV_TX_BUSY; 3775 return NETDEV_TX_BUSY;
3739 } 3776 }
3740 3777
@@ -3817,15 +3854,16 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3817 tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); 3854 tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry);
3818 3855
3819 tp->tx_prod = entry; 3856 tp->tx_prod = entry;
3820 if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1)) { 3857 if (unlikely(TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))) {
3858 spin_lock(&tp->tx_lock);
3821 netif_stop_queue(dev); 3859 netif_stop_queue(dev);
3822 if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH) 3860 if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH)
3823 netif_wake_queue(tp->dev); 3861 netif_wake_queue(tp->dev);
3862 spin_unlock(&tp->tx_lock);
3824 } 3863 }
3825 3864
3826out_unlock: 3865out_unlock:
3827 mmiowb(); 3866 mmiowb();
3828 spin_unlock(&tp->tx_lock);
3829 3867
3830 dev->trans_start = jiffies; 3868 dev->trans_start = jiffies;
3831 3869
@@ -3844,14 +3882,11 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
3844 3882
3845 len = skb_headlen(skb); 3883 len = skb_headlen(skb);
3846 3884
3847 /* No BH disabling for tx_lock here. We are running in BH disabled 3885 /* We are running in BH disabled context with netif_tx_lock
3848 * context and TX reclaim runs via tp->poll inside of a software 3886 * and TX reclaim runs via tp->poll inside of a software
3849 * interrupt. Furthermore, IRQ processing runs lockless so we have 3887 * interrupt. Furthermore, IRQ processing runs lockless so we have
3850 * no IRQ context deadlocks to worry about either. Rejoice! 3888 * no IRQ context deadlocks to worry about either. Rejoice!
3851 */ 3889 */
3852 if (!spin_trylock(&tp->tx_lock))
3853 return NETDEV_TX_LOCKED;
3854
3855 if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { 3890 if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
3856 if (!netif_queue_stopped(dev)) { 3891 if (!netif_queue_stopped(dev)) {
3857 netif_stop_queue(dev); 3892 netif_stop_queue(dev);
@@ -3860,7 +3895,6 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
3860 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " 3895 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
3861 "queue awake!\n", dev->name); 3896 "queue awake!\n", dev->name);
3862 } 3897 }
3863 spin_unlock(&tp->tx_lock);
3864 return NETDEV_TX_BUSY; 3898 return NETDEV_TX_BUSY;
3865 } 3899 }
3866 3900
@@ -3998,15 +4032,16 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
3998 tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); 4032 tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry);
3999 4033
4000 tp->tx_prod = entry; 4034 tp->tx_prod = entry;
4001 if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1)) { 4035 if (unlikely(TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))) {
4036 spin_lock(&tp->tx_lock);
4002 netif_stop_queue(dev); 4037 netif_stop_queue(dev);
4003 if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH) 4038 if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH)
4004 netif_wake_queue(tp->dev); 4039 netif_wake_queue(tp->dev);
4040 spin_unlock(&tp->tx_lock);
4005 } 4041 }
4006 4042
4007out_unlock: 4043out_unlock:
4008 mmiowb(); 4044 mmiowb();
4009 spin_unlock(&tp->tx_lock);
4010 4045
4011 dev->trans_start = jiffies; 4046 dev->trans_start = jiffies;
4012 4047
@@ -4485,9 +4520,8 @@ static void tg3_disable_nvram_access(struct tg3 *tp)
4485/* tp->lock is held. */ 4520/* tp->lock is held. */
4486static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind) 4521static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind)
4487{ 4522{
4488 if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) 4523 tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX,
4489 tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX, 4524 NIC_SRAM_FIRMWARE_MBOX_MAGIC1);
4490 NIC_SRAM_FIRMWARE_MBOX_MAGIC1);
4491 4525
4492 if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) { 4526 if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) {
4493 switch (kind) { 4527 switch (kind) {
@@ -4568,13 +4602,12 @@ static int tg3_chip_reset(struct tg3 *tp)
4568 void (*write_op)(struct tg3 *, u32, u32); 4602 void (*write_op)(struct tg3 *, u32, u32);
4569 int i; 4603 int i;
4570 4604
4571 if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { 4605 tg3_nvram_lock(tp);
4572 tg3_nvram_lock(tp); 4606
4573 /* No matching tg3_nvram_unlock() after this because 4607 /* No matching tg3_nvram_unlock() after this because
4574 * chip reset below will undo the nvram lock. 4608 * chip reset below will undo the nvram lock.
4575 */ 4609 */
4576 tp->nvram_lock_cnt = 0; 4610 tp->nvram_lock_cnt = 0;
4577 }
4578 4611
4579 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || 4612 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
4580 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || 4613 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
@@ -4727,20 +4760,25 @@ static int tg3_chip_reset(struct tg3 *tp)
4727 tw32_f(MAC_MODE, 0); 4760 tw32_f(MAC_MODE, 0);
4728 udelay(40); 4761 udelay(40);
4729 4762
4730 if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { 4763 /* Wait for firmware initialization to complete. */
4731 /* Wait for firmware initialization to complete. */ 4764 for (i = 0; i < 100000; i++) {
4732 for (i = 0; i < 100000; i++) { 4765 tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val);
4733 tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); 4766 if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
4734 if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) 4767 break;
4735 break; 4768 udelay(10);
4736 udelay(10); 4769 }
4737 } 4770
4738 if (i >= 100000) { 4771 /* Chip might not be fitted with firmare. Some Sun onboard
4739 printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, " 4772 * parts are configured like that. So don't signal the timeout
4740 "firmware will not restart magic=%08x\n", 4773 * of the above loop as an error, but do report the lack of
4741 tp->dev->name, val); 4774 * running firmware once.
4742 return -ENODEV; 4775 */
4743 } 4776 if (i >= 100000 &&
4777 !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) {
4778 tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
4779
4780 printk(KERN_INFO PFX "%s: No firmware running.\n",
4781 tp->dev->name);
4744 } 4782 }
4745 4783
4746 if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && 4784 if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
@@ -9075,9 +9113,6 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
9075{ 9113{
9076 int j; 9114 int j;
9077 9115
9078 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X)
9079 return;
9080
9081 tw32_f(GRC_EEPROM_ADDR, 9116 tw32_f(GRC_EEPROM_ADDR,
9082 (EEPROM_ADDR_FSM_RESET | 9117 (EEPROM_ADDR_FSM_RESET |
9083 (EEPROM_DEFAULT_CLOCK_PERIOD << 9118 (EEPROM_DEFAULT_CLOCK_PERIOD <<
@@ -9210,11 +9245,6 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
9210{ 9245{
9211 int ret; 9246 int ret;
9212 9247
9213 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
9214 printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 570X\n");
9215 return -EINVAL;
9216 }
9217
9218 if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) 9248 if (!(tp->tg3_flags & TG3_FLAG_NVRAM))
9219 return tg3_nvram_read_using_eeprom(tp, offset, val); 9249 return tg3_nvram_read_using_eeprom(tp, offset, val);
9220 9250
@@ -9447,11 +9477,6 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf)
9447{ 9477{
9448 int ret; 9478 int ret;
9449 9479
9450 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
9451 printk(KERN_ERR PFX "Attempt to do nvram_write on Sun 570X\n");
9452 return -EINVAL;
9453 }
9454
9455 if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) { 9480 if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) {
9456 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl & 9481 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl &
9457 ~GRC_LCLCTRL_GPIO_OUTPUT1); 9482 ~GRC_LCLCTRL_GPIO_OUTPUT1);
@@ -9578,15 +9603,19 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
9578 pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, 9603 pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
9579 tp->misc_host_ctrl); 9604 tp->misc_host_ctrl);
9580 9605
9606 /* The memory arbiter has to be enabled in order for SRAM accesses
9607 * to succeed. Normally on powerup the tg3 chip firmware will make
9608 * sure it is enabled, but other entities such as system netboot
9609 * code might disable it.
9610 */
9611 val = tr32(MEMARB_MODE);
9612 tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE);
9613
9581 tp->phy_id = PHY_ID_INVALID; 9614 tp->phy_id = PHY_ID_INVALID;
9582 tp->led_ctrl = LED_CTRL_MODE_PHY_1; 9615 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
9583 9616
9584 /* Do not even try poking around in here on Sun parts. */ 9617 /* Assume an onboard device by default. */
9585 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { 9618 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
9586 /* All SUN chips are built-in LOMs. */
9587 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
9588 return;
9589 }
9590 9619
9591 tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); 9620 tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val);
9592 if (val == NIC_SRAM_DATA_SIG_MAGIC) { 9621 if (val == NIC_SRAM_DATA_SIG_MAGIC) {
@@ -9686,6 +9715,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
9686 9715
9687 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) 9716 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP)
9688 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; 9717 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
9718 else
9719 tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT;
9689 9720
9690 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { 9721 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) {
9691 tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; 9722 tp->tg3_flags |= TG3_FLAG_ENABLE_ASF;
@@ -9834,16 +9865,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
9834 int i; 9865 int i;
9835 u32 magic; 9866 u32 magic;
9836 9867
9837 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
9838 /* Sun decided not to put the necessary bits in the
9839 * NVRAM of their onboard tg3 parts :(
9840 */
9841 strcpy(tp->board_part_number, "Sun 570X");
9842 return;
9843 }
9844
9845 if (tg3_nvram_read_swab(tp, 0x0, &magic)) 9868 if (tg3_nvram_read_swab(tp, 0x0, &magic))
9846 return; 9869 goto out_not_found;
9847 9870
9848 if (magic == TG3_EEPROM_MAGIC) { 9871 if (magic == TG3_EEPROM_MAGIC) {
9849 for (i = 0; i < 256; i += 4) { 9872 for (i = 0; i < 256; i += 4) {
@@ -9874,6 +9897,9 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
9874 break; 9897 break;
9875 msleep(1); 9898 msleep(1);
9876 } 9899 }
9900 if (!(tmp16 & 0x8000))
9901 goto out_not_found;
9902
9877 pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, 9903 pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA,
9878 &tmp); 9904 &tmp);
9879 tmp = cpu_to_le32(tmp); 9905 tmp = cpu_to_le32(tmp);
@@ -9965,37 +9991,6 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
9965 } 9991 }
9966} 9992}
9967 9993
9968#ifdef CONFIG_SPARC64
9969static int __devinit tg3_is_sun_570X(struct tg3 *tp)
9970{
9971 struct pci_dev *pdev = tp->pdev;
9972 struct pcidev_cookie *pcp = pdev->sysdata;
9973
9974 if (pcp != NULL) {
9975 int node = pcp->prom_node;
9976 u32 venid;
9977 int err;
9978
9979 err = prom_getproperty(node, "subsystem-vendor-id",
9980 (char *) &venid, sizeof(venid));
9981 if (err == 0 || err == -1)
9982 return 0;
9983 if (venid == PCI_VENDOR_ID_SUN)
9984 return 1;
9985
9986 /* TG3 chips onboard the SunBlade-2500 don't have the
9987 * subsystem-vendor-id set to PCI_VENDOR_ID_SUN but they
9988 * are distinguishable from non-Sun variants by being
9989 * named "network" by the firmware. Non-Sun cards will
9990 * show up as being named "ethernet".
9991 */
9992 if (!strcmp(pcp->prom_name, "network"))
9993 return 1;
9994 }
9995 return 0;
9996}
9997#endif
9998
9999static int __devinit tg3_get_invariants(struct tg3 *tp) 9994static int __devinit tg3_get_invariants(struct tg3 *tp)
10000{ 9995{
10001 static struct pci_device_id write_reorder_chipsets[] = { 9996 static struct pci_device_id write_reorder_chipsets[] = {
@@ -10012,11 +10007,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10012 u16 pci_cmd; 10007 u16 pci_cmd;
10013 int err; 10008 int err;
10014 10009
10015#ifdef CONFIG_SPARC64
10016 if (tg3_is_sun_570X(tp))
10017 tp->tg3_flags2 |= TG3_FLG2_SUN_570X;
10018#endif
10019
10020 /* Force memory write invalidate off. If we leave it on, 10010 /* Force memory write invalidate off. If we leave it on,
10021 * then on 5700_BX chips we have to enable a workaround. 10011 * then on 5700_BX chips we have to enable a workaround.
10022 * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary 10012 * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary
@@ -10312,8 +10302,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10312 if (tp->write32 == tg3_write_indirect_reg32 || 10302 if (tp->write32 == tg3_write_indirect_reg32 ||
10313 ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && 10303 ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
10314 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 10304 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
10315 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) || 10305 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)))
10316 (tp->tg3_flags2 & TG3_FLG2_SUN_570X))
10317 tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; 10306 tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG;
10318 10307
10319 /* Get eeprom hw config before calling tg3_set_power_state(). 10308 /* Get eeprom hw config before calling tg3_set_power_state().
@@ -10594,8 +10583,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
10594#endif 10583#endif
10595 10584
10596 mac_offset = 0x7c; 10585 mac_offset = 0x7c;
10597 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && 10586 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
10598 !(tp->tg3_flags & TG3_FLG2_SUN_570X)) ||
10599 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { 10587 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) {
10600 if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) 10588 if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID)
10601 mac_offset = 0xcc; 10589 mac_offset = 0xcc;
@@ -10622,8 +10610,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
10622 } 10610 }
10623 if (!addr_ok) { 10611 if (!addr_ok) {
10624 /* Next, try NVRAM. */ 10612 /* Next, try NVRAM. */
10625 if (!(tp->tg3_flags & TG3_FLG2_SUN_570X) && 10613 if (!tg3_nvram_read(tp, mac_offset + 0, &hi) &&
10626 !tg3_nvram_read(tp, mac_offset + 0, &hi) &&
10627 !tg3_nvram_read(tp, mac_offset + 4, &lo)) { 10614 !tg3_nvram_read(tp, mac_offset + 4, &lo)) {
10628 dev->dev_addr[0] = ((hi >> 16) & 0xff); 10615 dev->dev_addr[0] = ((hi >> 16) & 0xff);
10629 dev->dev_addr[1] = ((hi >> 24) & 0xff); 10616 dev->dev_addr[1] = ((hi >> 24) & 0xff);
@@ -11291,7 +11278,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
11291 SET_MODULE_OWNER(dev); 11278 SET_MODULE_OWNER(dev);
11292 SET_NETDEV_DEV(dev, &pdev->dev); 11279 SET_NETDEV_DEV(dev, &pdev->dev);
11293 11280
11294 dev->features |= NETIF_F_LLTX;
11295#if TG3_VLAN_TAG_USED 11281#if TG3_VLAN_TAG_USED
11296 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 11282 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
11297 dev->vlan_rx_register = tg3_vlan_rx_register; 11283 dev->vlan_rx_register = tg3_vlan_rx_register;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 0e29b885d449..8209da5dd15f 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2074,12 +2074,22 @@ struct tg3 {
2074 2074
2075 /* SMP locking strategy: 2075 /* SMP locking strategy:
2076 * 2076 *
2077 * lock: Held during all operations except TX packet 2077 * lock: Held during reset, PHY access, timer, and when
2078 * processing. 2078 * updating tg3_flags and tg3_flags2.
2079 * 2079 *
2080 * tx_lock: Held during tg3_start_xmit and tg3_tx 2080 * tx_lock: Held during tg3_start_xmit and tg3_tx only
2081 * when calling netif_[start|stop]_queue.
2082 * tg3_start_xmit is protected by netif_tx_lock.
2081 * 2083 *
2082 * Both of these locks are to be held with BH safety. 2084 * Both of these locks are to be held with BH safety.
2085 *
2086 * Because the IRQ handler, tg3_poll, and tg3_start_xmit
2087 * are running lockless, it is necessary to completely
2088 * quiesce the chip with tg3_netif_stop and tg3_full_lock
2089 * before reconfiguring the device.
2090 *
2091 * indirect_lock: Held when accessing registers indirectly
2092 * with IRQ disabling.
2083 */ 2093 */
2084 spinlock_t lock; 2094 spinlock_t lock;
2085 spinlock_t indirect_lock; 2095 spinlock_t indirect_lock;
@@ -2155,11 +2165,7 @@ struct tg3 {
2155#define TG3_FLAG_ENABLE_ASF 0x00000020 2165#define TG3_FLAG_ENABLE_ASF 0x00000020
2156#define TG3_FLAG_5701_REG_WRITE_BUG 0x00000040 2166#define TG3_FLAG_5701_REG_WRITE_BUG 0x00000040
2157#define TG3_FLAG_POLL_SERDES 0x00000080 2167#define TG3_FLAG_POLL_SERDES 0x00000080
2158#if defined(CONFIG_X86)
2159#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100 2168#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100
2160#else
2161#define TG3_FLAG_MBOX_WRITE_REORDER 0 /* disables code too */
2162#endif
2163#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200 2169#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200
2164#define TG3_FLAG_WOL_SPEED_100MB 0x00000400 2170#define TG3_FLAG_WOL_SPEED_100MB 0x00000400
2165#define TG3_FLAG_WOL_ENABLE 0x00000800 2171#define TG3_FLAG_WOL_ENABLE 0x00000800
@@ -2172,6 +2178,7 @@ struct tg3 {
2172#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000 2178#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000
2173#define TG3_FLAG_PCI_32BIT 0x00080000 2179#define TG3_FLAG_PCI_32BIT 0x00080000
2174#define TG3_FLAG_SRAM_USE_CONFIG 0x00100000 2180#define TG3_FLAG_SRAM_USE_CONFIG 0x00100000
2181#define TG3_FLAG_TX_RECOVERY_PENDING 0x00200000
2175#define TG3_FLAG_SERDES_WOL_CAP 0x00400000 2182#define TG3_FLAG_SERDES_WOL_CAP 0x00400000
2176#define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000 2183#define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000
2177#define TG3_FLAG_10_100_ONLY 0x01000000 2184#define TG3_FLAG_10_100_ONLY 0x01000000
@@ -2184,7 +2191,7 @@ struct tg3 {
2184#define TG3_FLAG_INIT_COMPLETE 0x80000000 2191#define TG3_FLAG_INIT_COMPLETE 0x80000000
2185 u32 tg3_flags2; 2192 u32 tg3_flags2;
2186#define TG3_FLG2_RESTART_TIMER 0x00000001 2193#define TG3_FLG2_RESTART_TIMER 0x00000001
2187#define TG3_FLG2_SUN_570X 0x00000002 2194/* 0x00000002 available */
2188#define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 2195#define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004
2189#define TG3_FLG2_IS_5788 0x00000008 2196#define TG3_FLG2_IS_5788 0x00000008
2190#define TG3_FLG2_MAX_RXPEND_64 0x00000010 2197#define TG3_FLG2_MAX_RXPEND_64 0x00000010
@@ -2216,6 +2223,7 @@ struct tg3 {
2216#define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2) 2223#define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2)
2217#define TG3_FLG2_1SHOT_MSI 0x10000000 2224#define TG3_FLG2_1SHOT_MSI 0x10000000
2218#define TG3_FLG2_PHY_JITTER_BUG 0x20000000 2225#define TG3_FLG2_PHY_JITTER_BUG 0x20000000
2226#define TG3_FLG2_NO_FWARE_REPORTED 0x40000000
2219 2227
2220 u32 split_mode_max_reqs; 2228 u32 split_mode_max_reqs;
2221#define SPLIT_MODE_5704_MAX_REQ 3 2229#define SPLIT_MODE_5704_MAX_REQ 3
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index b3cf11d32e24..cabdf894e21e 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -1483,14 +1483,6 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1483 sa_offset = 2; /* Grrr, damn Matrox boards. */ 1483 sa_offset = 2; /* Grrr, damn Matrox boards. */
1484 multiport_cnt = 4; 1484 multiport_cnt = 4;
1485 } 1485 }
1486#ifdef CONFIG_DDB5476
1487 if ((pdev->bus->number == 0) && (PCI_SLOT(pdev->devfn) == 6)) {
1488 /* DDB5476 MAC address in first EEPROM locations. */
1489 sa_offset = 0;
1490 /* No media table either */
1491 tp->flags &= ~HAS_MEDIA_TABLE;
1492 }
1493#endif
1494#ifdef CONFIG_DDB5477 1486#ifdef CONFIG_DDB5477
1495 if ((pdev->bus->number == 0) && (PCI_SLOT(pdev->devfn) == 4)) { 1487 if ((pdev->bus->number == 0) && (PCI_SLOT(pdev->devfn) == 4)) {
1496 /* DDB5477 MAC address in first EEPROM locations. */ 1488 /* DDB5477 MAC address in first EEPROM locations. */
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 64ecf929d2ac..8fea2aa455d4 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -1605,11 +1605,11 @@ static void __devexit w840_remove1 (struct pci_dev *pdev)
1605 * - get_stats: 1605 * - get_stats:
1606 * spin_lock_irq(np->lock), doesn't touch hw if not present 1606 * spin_lock_irq(np->lock), doesn't touch hw if not present
1607 * - hard_start_xmit: 1607 * - hard_start_xmit:
1608 * netif_stop_queue + spin_unlock_wait(&dev->xmit_lock); 1608 * synchronize_irq + netif_tx_disable;
1609 * - tx_timeout: 1609 * - tx_timeout:
1610 * netif_device_detach + spin_unlock_wait(&dev->xmit_lock); 1610 * netif_device_detach + netif_tx_disable;
1611 * - set_multicast_list 1611 * - set_multicast_list
1612 * netif_device_detach + spin_unlock_wait(&dev->xmit_lock); 1612 * netif_device_detach + netif_tx_disable;
1613 * - interrupt handler 1613 * - interrupt handler
1614 * doesn't touch hw if not present, synchronize_irq waits for 1614 * doesn't touch hw if not present, synchronize_irq waits for
1615 * running instances of the interrupt handler. 1615 * running instances of the interrupt handler.
@@ -1635,12 +1635,11 @@ static int w840_suspend (struct pci_dev *pdev, pm_message_t state)
1635 netif_device_detach(dev); 1635 netif_device_detach(dev);
1636 update_csr6(dev, 0); 1636 update_csr6(dev, 0);
1637 iowrite32(0, ioaddr + IntrEnable); 1637 iowrite32(0, ioaddr + IntrEnable);
1638 netif_stop_queue(dev);
1639 spin_unlock_irq(&np->lock); 1638 spin_unlock_irq(&np->lock);
1640 1639
1641 spin_unlock_wait(&dev->xmit_lock);
1642 synchronize_irq(dev->irq); 1640 synchronize_irq(dev->irq);
1643 1641 netif_tx_disable(dev);
1642
1644 np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff; 1643 np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff;
1645 1644
1646 /* no more hardware accesses behind this line. */ 1645 /* no more hardware accesses behind this line. */
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index ed1f837c8fda..2eb6b5f9ba0d 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1899,6 +1899,13 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
1899 1899
1900 int pktlen = skb->len; 1900 int pktlen = skb->len;
1901 1901
1902#ifdef VELOCITY_ZERO_COPY_SUPPORT
1903 if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) {
1904 kfree_skb(skb);
1905 return 0;
1906 }
1907#endif
1908
1902 spin_lock_irqsave(&vptr->lock, flags); 1909 spin_lock_irqsave(&vptr->lock, flags);
1903 1910
1904 index = vptr->td_curr[qnum]; 1911 index = vptr->td_curr[qnum];
@@ -1914,8 +1921,6 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
1914 */ 1921 */
1915 if (pktlen < ETH_ZLEN) { 1922 if (pktlen < ETH_ZLEN) {
1916 /* Cannot occur until ZC support */ 1923 /* Cannot occur until ZC support */
1917 if(skb_linearize(skb, GFP_ATOMIC))
1918 return 0;
1919 pktlen = ETH_ZLEN; 1924 pktlen = ETH_ZLEN;
1920 memcpy(tdinfo->buf, skb->data, skb->len); 1925 memcpy(tdinfo->buf, skb->data, skb->len);
1921 memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); 1926 memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len);
@@ -1933,7 +1938,6 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
1933 int nfrags = skb_shinfo(skb)->nr_frags; 1938 int nfrags = skb_shinfo(skb)->nr_frags;
1934 tdinfo->skb = skb; 1939 tdinfo->skb = skb;
1935 if (nfrags > 6) { 1940 if (nfrags > 6) {
1936 skb_linearize(skb, GFP_ATOMIC);
1937 memcpy(tdinfo->buf, skb->data, skb->len); 1941 memcpy(tdinfo->buf, skb->data, skb->len);
1938 tdinfo->skb_dma[0] = tdinfo->buf_dma; 1942 tdinfo->skb_dma[0] = tdinfo->buf_dma;
1939 td_ptr->tdesc0.pktsize = 1943 td_ptr->tdesc0.pktsize =
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index e66fdb1f3cfd..d8f917c21ea4 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -636,6 +636,17 @@ struct bcm43xx_key {
636 u8 algorithm; 636 u8 algorithm;
637}; 637};
638 638
639/* Driver initialization status. */
640enum {
641 BCM43xx_STAT_UNINIT, /* Uninitialized. */
642 BCM43xx_STAT_INITIALIZING, /* init_board() in progress. */
643 BCM43xx_STAT_INITIALIZED, /* Fully operational. */
644 BCM43xx_STAT_SHUTTINGDOWN, /* free_board() in progress. */
645 BCM43xx_STAT_RESTARTING, /* controller_restart() called. */
646};
647#define bcm43xx_status(bcm) atomic_read(&(bcm)->init_status)
648#define bcm43xx_set_status(bcm, stat) atomic_set(&(bcm)->init_status, (stat))
649
639struct bcm43xx_private { 650struct bcm43xx_private {
640 struct ieee80211_device *ieee; 651 struct ieee80211_device *ieee;
641 struct ieee80211softmac_device *softmac; 652 struct ieee80211softmac_device *softmac;
@@ -646,18 +657,17 @@ struct bcm43xx_private {
646 657
647 void __iomem *mmio_addr; 658 void __iomem *mmio_addr;
648 659
649 /* Do not use the lock directly. Use the bcm43xx_lock* helper 660 /* Locking, see "theory of locking" text below. */
650 * functions, to be MMIO-safe. */ 661 spinlock_t irq_lock;
651 spinlock_t _lock; 662 struct mutex mutex;
652 663
653 /* Driver status flags. */ 664 /* Driver initialization status BCM43xx_STAT_*** */
654 u32 initialized:1, /* init_board() succeed */ 665 atomic_t init_status;
655 was_initialized:1, /* for PCI suspend/resume. */ 666
656 shutting_down:1, /* free_board() in progress */ 667 u16 was_initialized:1, /* for PCI suspend/resume. */
657 __using_pio:1, /* Internal, use bcm43xx_using_pio(). */ 668 __using_pio:1, /* Internal, use bcm43xx_using_pio(). */
658 bad_frames_preempt:1, /* Use "Bad Frames Preemption" (default off) */ 669 bad_frames_preempt:1, /* Use "Bad Frames Preemption" (default off) */
659 reg124_set_0x4:1, /* Some variable to keep track of IRQ stuff. */ 670 reg124_set_0x4:1, /* Some variable to keep track of IRQ stuff. */
660 powersaving:1, /* TRUE if we are in PowerSaving mode. FALSE otherwise. */
661 short_preamble:1, /* TRUE, if short preamble is enabled. */ 671 short_preamble:1, /* TRUE, if short preamble is enabled. */
662 firmware_norelease:1; /* Do not release the firmware. Used on suspend. */ 672 firmware_norelease:1; /* Do not release the firmware. Used on suspend. */
663 673
@@ -721,7 +731,7 @@ struct bcm43xx_private {
721 struct tasklet_struct isr_tasklet; 731 struct tasklet_struct isr_tasklet;
722 732
723 /* Periodic tasks */ 733 /* Periodic tasks */
724 struct timer_list periodic_tasks; 734 struct work_struct periodic_work;
725 unsigned int periodic_state; 735 unsigned int periodic_state;
726 736
727 struct work_struct restart_work; 737 struct work_struct restart_work;
@@ -746,21 +756,55 @@ struct bcm43xx_private {
746#endif 756#endif
747}; 757};
748 758
749/* bcm43xx_(un)lock() protect struct bcm43xx_private. 759
750 * Note that _NO_ MMIO writes are allowed. If you want to 760/* *** THEORY OF LOCKING ***
751 * write to the device through MMIO in the critical section, use 761 *
752 * the *_mmio lock functions. 762 * We have two different locks in the bcm43xx driver.
753 * MMIO read-access is allowed, though. 763 * => bcm->mutex: General sleeping mutex. Protects struct bcm43xx_private
754 */ 764 * and the device registers.
755#define bcm43xx_lock(bcm, flags) spin_lock_irqsave(&(bcm)->_lock, flags) 765 * => bcm->irq_lock: IRQ spinlock. Protects against IRQ handler concurrency.
756#define bcm43xx_unlock(bcm, flags) spin_unlock_irqrestore(&(bcm)->_lock, flags) 766 *
757/* bcm43xx_(un)lock_mmio() protect struct bcm43xx_private and MMIO. 767 * We have three types of helper function pairs to utilize these locks.
758 * MMIO write-access to the device is allowed. 768 * (Always use the helper functions.)
759 * All MMIO writes are flushed on unlock, so it is guaranteed to not 769 * 1) bcm43xx_{un}lock_noirq():
760 * interfere with other threads writing MMIO registers. 770 * Takes bcm->mutex. Does _not_ protect against IRQ concurrency,
771 * so it is almost always unsafe, if device IRQs are enabled.
772 * So only use this, if device IRQs are masked.
773 * Locking may sleep.
774 * You can sleep within the critical section.
775 * 2) bcm43xx_{un}lock_irqonly():
776 * Takes bcm->irq_lock. Does _not_ protect against
777 * bcm43xx_lock_noirq() critical sections.
778 * Does only protect against the IRQ handler path and other
779 * irqonly() critical sections.
780 * Locking does not sleep.
781 * You must not sleep within the critical section.
782 * 3) bcm43xx_{un}lock_irqsafe():
783 * This is the cummulative lock and takes both, mutex and irq_lock.
784 * Protects against noirq() and irqonly() critical sections (and
785 * the IRQ handler path).
786 * Locking may sleep.
787 * You must not sleep within the critical section.
761 */ 788 */
762#define bcm43xx_lock_mmio(bcm, flags) bcm43xx_lock(bcm, flags) 789
763#define bcm43xx_unlock_mmio(bcm, flags) do { mmiowb(); bcm43xx_unlock(bcm, flags); } while (0) 790/* Lock type 1 */
791#define bcm43xx_lock_noirq(bcm) mutex_lock(&(bcm)->mutex)
792#define bcm43xx_unlock_noirq(bcm) mutex_unlock(&(bcm)->mutex)
793/* Lock type 2 */
794#define bcm43xx_lock_irqonly(bcm, flags) \
795 spin_lock_irqsave(&(bcm)->irq_lock, flags)
796#define bcm43xx_unlock_irqonly(bcm, flags) \
797 spin_unlock_irqrestore(&(bcm)->irq_lock, flags)
798/* Lock type 3 */
799#define bcm43xx_lock_irqsafe(bcm, flags) do { \
800 bcm43xx_lock_noirq(bcm); \
801 bcm43xx_lock_irqonly(bcm, flags); \
802 } while (0)
803#define bcm43xx_unlock_irqsafe(bcm, flags) do { \
804 bcm43xx_unlock_irqonly(bcm, flags); \
805 bcm43xx_unlock_noirq(bcm); \
806 } while (0)
807
764 808
765static inline 809static inline
766struct bcm43xx_private * bcm43xx_priv(struct net_device *dev) 810struct bcm43xx_private * bcm43xx_priv(struct net_device *dev)
@@ -843,16 +887,6 @@ struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm)
843 return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio); 887 return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio);
844} 888}
845 889
846/* Are we running in init_board() context? */
847static inline
848int bcm43xx_is_initializing(struct bcm43xx_private *bcm)
849{
850 if (bcm->initialized)
851 return 0;
852 if (bcm->shutting_down)
853 return 0;
854 return 1;
855}
856 890
857static inline 891static inline
858struct bcm43xx_lopair * bcm43xx_get_lopair(struct bcm43xx_phyinfo *phy, 892struct bcm43xx_lopair * bcm43xx_get_lopair(struct bcm43xx_phyinfo *phy,
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
index 7497fb16076e..ce2e40b29b4f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
@@ -77,8 +77,8 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
77 77
78 down(&big_buffer_sem); 78 down(&big_buffer_sem);
79 79
80 bcm43xx_lock_mmio(bcm, flags); 80 bcm43xx_lock_irqsafe(bcm, flags);
81 if (!bcm->initialized) { 81 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
82 fappend("Board not initialized.\n"); 82 fappend("Board not initialized.\n");
83 goto out; 83 goto out;
84 } 84 }
@@ -121,7 +121,7 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
121 fappend("\n"); 121 fappend("\n");
122 122
123out: 123out:
124 bcm43xx_unlock_mmio(bcm, flags); 124 bcm43xx_unlock_irqsafe(bcm, flags);
125 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 125 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
126 up(&big_buffer_sem); 126 up(&big_buffer_sem);
127 return res; 127 return res;
@@ -159,8 +159,8 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf,
159 unsigned long flags; 159 unsigned long flags;
160 160
161 down(&big_buffer_sem); 161 down(&big_buffer_sem);
162 bcm43xx_lock_mmio(bcm, flags); 162 bcm43xx_lock_irqsafe(bcm, flags);
163 if (!bcm->initialized) { 163 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
164 fappend("Board not initialized.\n"); 164 fappend("Board not initialized.\n");
165 goto out; 165 goto out;
166 } 166 }
@@ -169,7 +169,7 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf,
169 fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags); 169 fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags);
170 170
171out: 171out:
172 bcm43xx_unlock_mmio(bcm, flags); 172 bcm43xx_unlock_irqsafe(bcm, flags);
173 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 173 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
174 up(&big_buffer_sem); 174 up(&big_buffer_sem);
175 return res; 175 return res;
@@ -188,8 +188,8 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf,
188 u64 tsf; 188 u64 tsf;
189 189
190 down(&big_buffer_sem); 190 down(&big_buffer_sem);
191 bcm43xx_lock_mmio(bcm, flags); 191 bcm43xx_lock_irqsafe(bcm, flags);
192 if (!bcm->initialized) { 192 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
193 fappend("Board not initialized.\n"); 193 fappend("Board not initialized.\n");
194 goto out; 194 goto out;
195 } 195 }
@@ -199,7 +199,7 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf,
199 (unsigned int)(tsf & 0xFFFFFFFFULL)); 199 (unsigned int)(tsf & 0xFFFFFFFFULL));
200 200
201out: 201out:
202 bcm43xx_unlock_mmio(bcm, flags); 202 bcm43xx_unlock_irqsafe(bcm, flags);
203 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 203 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
204 up(&big_buffer_sem); 204 up(&big_buffer_sem);
205 return res; 205 return res;
@@ -221,8 +221,8 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
221 res = -EFAULT; 221 res = -EFAULT;
222 goto out_up; 222 goto out_up;
223 } 223 }
224 bcm43xx_lock_mmio(bcm, flags); 224 bcm43xx_lock_irqsafe(bcm, flags);
225 if (!bcm->initialized) { 225 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
226 printk(KERN_INFO PFX "debugfs: Board not initialized.\n"); 226 printk(KERN_INFO PFX "debugfs: Board not initialized.\n");
227 res = -EFAULT; 227 res = -EFAULT;
228 goto out_unlock; 228 goto out_unlock;
@@ -233,10 +233,11 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
233 goto out_unlock; 233 goto out_unlock;
234 } 234 }
235 bcm43xx_tsf_write(bcm, tsf); 235 bcm43xx_tsf_write(bcm, tsf);
236 mmiowb();
236 res = buf_size; 237 res = buf_size;
237 238
238out_unlock: 239out_unlock:
239 bcm43xx_unlock_mmio(bcm, flags); 240 bcm43xx_unlock_irqsafe(bcm, flags);
240out_up: 241out_up:
241 up(&big_buffer_sem); 242 up(&big_buffer_sem);
242 return res; 243 return res;
@@ -257,7 +258,7 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
257 int i, cnt, j = 0; 258 int i, cnt, j = 0;
258 259
259 down(&big_buffer_sem); 260 down(&big_buffer_sem);
260 bcm43xx_lock(bcm, flags); 261 bcm43xx_lock_irqsafe(bcm, flags);
261 262
262 fappend("Last %d logged xmitstatus blobs (Latest first):\n\n", 263 fappend("Last %d logged xmitstatus blobs (Latest first):\n\n",
263 BCM43xx_NR_LOGGED_XMITSTATUS); 264 BCM43xx_NR_LOGGED_XMITSTATUS);
@@ -293,14 +294,14 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
293 i = BCM43xx_NR_LOGGED_XMITSTATUS - 1; 294 i = BCM43xx_NR_LOGGED_XMITSTATUS - 1;
294 } 295 }
295 296
296 bcm43xx_unlock(bcm, flags); 297 bcm43xx_unlock_irqsafe(bcm, flags);
297 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 298 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
298 bcm43xx_lock(bcm, flags); 299 bcm43xx_lock_irqsafe(bcm, flags);
299 if (*ppos == pos) { 300 if (*ppos == pos) {
300 /* Done. Drop the copied data. */ 301 /* Done. Drop the copied data. */
301 e->xmitstatus_printing = 0; 302 e->xmitstatus_printing = 0;
302 } 303 }
303 bcm43xx_unlock(bcm, flags); 304 bcm43xx_unlock_irqsafe(bcm, flags);
304 up(&big_buffer_sem); 305 up(&big_buffer_sem);
305 return res; 306 return res;
306} 307}
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_leds.c b/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
index 4b2c02c0b31e..ec80692d638a 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
@@ -51,12 +51,12 @@ static void bcm43xx_led_blink(unsigned long d)
51 struct bcm43xx_private *bcm = led->bcm; 51 struct bcm43xx_private *bcm = led->bcm;
52 unsigned long flags; 52 unsigned long flags;
53 53
54 bcm43xx_lock_mmio(bcm, flags); 54 bcm43xx_lock_irqonly(bcm, flags);
55 if (led->blink_interval) { 55 if (led->blink_interval) {
56 bcm43xx_led_changestate(led); 56 bcm43xx_led_changestate(led);
57 mod_timer(&led->blink_timer, jiffies + led->blink_interval); 57 mod_timer(&led->blink_timer, jiffies + led->blink_interval);
58 } 58 }
59 bcm43xx_unlock_mmio(bcm, flags); 59 bcm43xx_unlock_irqonly(bcm, flags);
60} 60}
61 61
62static void bcm43xx_led_blink_start(struct bcm43xx_led *led, 62static void bcm43xx_led_blink_start(struct bcm43xx_led *led,
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 736dde96c4a3..085d7857fe31 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -498,20 +498,31 @@ static inline u32 bcm43xx_interrupt_disable(struct bcm43xx_private *bcm, u32 mas
498 return old_mask; 498 return old_mask;
499} 499}
500 500
501/* Synchronize IRQ top- and bottom-half.
502 * IRQs must be masked before calling this.
503 * This must not be called with the irq_lock held.
504 */
505static void bcm43xx_synchronize_irq(struct bcm43xx_private *bcm)
506{
507 synchronize_irq(bcm->irq);
508 tasklet_disable(&bcm->isr_tasklet);
509}
510
501/* Make sure we don't receive more data from the device. */ 511/* Make sure we don't receive more data from the device. */
502static int bcm43xx_disable_interrupts_sync(struct bcm43xx_private *bcm, u32 *oldstate) 512static int bcm43xx_disable_interrupts_sync(struct bcm43xx_private *bcm, u32 *oldstate)
503{ 513{
504 u32 old;
505 unsigned long flags; 514 unsigned long flags;
515 u32 old;
506 516
507 bcm43xx_lock_mmio(bcm, flags); 517 bcm43xx_lock_irqonly(bcm, flags);
508 if (bcm43xx_is_initializing(bcm) || bcm->shutting_down) { 518 if (unlikely(bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED)) {
509 bcm43xx_unlock_mmio(bcm, flags); 519 bcm43xx_unlock_irqonly(bcm, flags);
510 return -EBUSY; 520 return -EBUSY;
511 } 521 }
512 old = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); 522 old = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL);
513 tasklet_disable(&bcm->isr_tasklet); 523 bcm43xx_unlock_irqonly(bcm, flags);
514 bcm43xx_unlock_mmio(bcm, flags); 524 bcm43xx_synchronize_irq(bcm);
525
515 if (oldstate) 526 if (oldstate)
516 *oldstate = old; 527 *oldstate = old;
517 528
@@ -1389,7 +1400,7 @@ void bcm43xx_wireless_core_reset(struct bcm43xx_private *bcm, int connect_phy)
1389 bcm43xx_dmacontroller_rx_reset(bcm, BCM43xx_MMIO_DMA4_BASE); 1400 bcm43xx_dmacontroller_rx_reset(bcm, BCM43xx_MMIO_DMA4_BASE);
1390#endif 1401#endif
1391 } 1402 }
1392 if (bcm->shutting_down) { 1403 if (bcm43xx_status(bcm) == BCM43xx_STAT_SHUTTINGDOWN) {
1393 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, 1404 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD,
1394 bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) 1405 bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD)
1395 & ~(BCM43xx_SBF_MAC_ENABLED | 0x00000002)); 1406 & ~(BCM43xx_SBF_MAC_ENABLED | 0x00000002));
@@ -1709,7 +1720,7 @@ static void bcm43xx_interrupt_tasklet(struct bcm43xx_private *bcm)
1709# define bcmirq_handled(irq) do { /* nothing */ } while (0) 1720# define bcmirq_handled(irq) do { /* nothing */ } while (0)
1710#endif /* CONFIG_BCM43XX_DEBUG*/ 1721#endif /* CONFIG_BCM43XX_DEBUG*/
1711 1722
1712 bcm43xx_lock_mmio(bcm, flags); 1723 bcm43xx_lock_irqonly(bcm, flags);
1713 reason = bcm->irq_reason; 1724 reason = bcm->irq_reason;
1714 dma_reason[0] = bcm->dma_reason[0]; 1725 dma_reason[0] = bcm->dma_reason[0];
1715 dma_reason[1] = bcm->dma_reason[1]; 1726 dma_reason[1] = bcm->dma_reason[1];
@@ -1734,7 +1745,8 @@ static void bcm43xx_interrupt_tasklet(struct bcm43xx_private *bcm)
1734 dma_reason[0], dma_reason[1], 1745 dma_reason[0], dma_reason[1],
1735 dma_reason[2], dma_reason[3]); 1746 dma_reason[2], dma_reason[3]);
1736 bcm43xx_controller_restart(bcm, "DMA error"); 1747 bcm43xx_controller_restart(bcm, "DMA error");
1737 bcm43xx_unlock_mmio(bcm, flags); 1748 mmiowb();
1749 bcm43xx_unlock_irqonly(bcm, flags);
1738 return; 1750 return;
1739 } 1751 }
1740 if (unlikely((dma_reason[0] & BCM43xx_DMAIRQ_NONFATALMASK) | 1752 if (unlikely((dma_reason[0] & BCM43xx_DMAIRQ_NONFATALMASK) |
@@ -1821,7 +1833,8 @@ static void bcm43xx_interrupt_tasklet(struct bcm43xx_private *bcm)
1821 if (!modparam_noleds) 1833 if (!modparam_noleds)
1822 bcm43xx_leds_update(bcm, activity); 1834 bcm43xx_leds_update(bcm, activity);
1823 bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate); 1835 bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate);
1824 bcm43xx_unlock_mmio(bcm, flags); 1836 mmiowb();
1837 bcm43xx_unlock_irqonly(bcm, flags);
1825} 1838}
1826 1839
1827static void pio_irq_workaround(struct bcm43xx_private *bcm, 1840static void pio_irq_workaround(struct bcm43xx_private *bcm,
@@ -1870,7 +1883,7 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id, struct pt_re
1870 if (!bcm) 1883 if (!bcm)
1871 return IRQ_NONE; 1884 return IRQ_NONE;
1872 1885
1873 spin_lock(&bcm->_lock); 1886 spin_lock(&bcm->irq_lock);
1874 1887
1875 reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); 1888 reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
1876 if (reason == 0xffffffff) { 1889 if (reason == 0xffffffff) {
@@ -1899,7 +1912,7 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id, struct pt_re
1899 * completely, but some careful work is needed to fix this. I think it 1912 * completely, but some careful work is needed to fix this. I think it
1900 * is best to stay with this cheap workaround for now... . 1913 * is best to stay with this cheap workaround for now... .
1901 */ 1914 */
1902 if (likely(bcm->initialized)) { 1915 if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)) {
1903 /* disable all IRQs. They are enabled again in the bottom half. */ 1916 /* disable all IRQs. They are enabled again in the bottom half. */
1904 bcm->irq_savedstate = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); 1917 bcm->irq_savedstate = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL);
1905 /* save the reason code and call our bottom half. */ 1918 /* save the reason code and call our bottom half. */
@@ -1909,7 +1922,7 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id, struct pt_re
1909 1922
1910out: 1923out:
1911 mmiowb(); 1924 mmiowb();
1912 spin_unlock(&bcm->_lock); 1925 spin_unlock(&bcm->irq_lock);
1913 1926
1914 return ret; 1927 return ret;
1915} 1928}
@@ -2133,6 +2146,13 @@ out:
2133 return err; 2146 return err;
2134} 2147}
2135 2148
2149#ifdef CONFIG_BCM947XX
2150static struct pci_device_id bcm43xx_47xx_ids[] = {
2151 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
2152 { 0 }
2153};
2154#endif
2155
2136static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm) 2156static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
2137{ 2157{
2138 int res; 2158 int res;
@@ -2142,11 +2162,15 @@ static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
2142 bcm->irq = bcm->pci_dev->irq; 2162 bcm->irq = bcm->pci_dev->irq;
2143#ifdef CONFIG_BCM947XX 2163#ifdef CONFIG_BCM947XX
2144 if (bcm->pci_dev->bus->number == 0) { 2164 if (bcm->pci_dev->bus->number == 0) {
2145 struct pci_dev *d = NULL; 2165 struct pci_dev *d;
2146 /* FIXME: we will probably need more device IDs here... */ 2166 struct pci_device_id *id;
2147 d = pci_find_device(PCI_VENDOR_ID_BROADCOM, 0x4324, NULL); 2167 for (id = bcm43xx_47xx_ids; id->vendor; id++) {
2148 if (d != NULL) { 2168 d = pci_get_device(id->vendor, id->device, NULL);
2149 bcm->irq = d->irq; 2169 if (d != NULL) {
2170 bcm->irq = d->irq;
2171 pci_dev_put(d);
2172 break;
2173 }
2150 } 2174 }
2151 } 2175 }
2152#endif 2176#endif
@@ -3106,15 +3130,10 @@ static void bcm43xx_periodic_every15sec(struct bcm43xx_private *bcm)
3106 //TODO for APHY (temperature?) 3130 //TODO for APHY (temperature?)
3107} 3131}
3108 3132
3109static void bcm43xx_periodic_task_handler(unsigned long d) 3133static void do_periodic_work(struct bcm43xx_private *bcm)
3110{ 3134{
3111 struct bcm43xx_private *bcm = (struct bcm43xx_private *)d;
3112 unsigned long flags;
3113 unsigned int state; 3135 unsigned int state;
3114 3136
3115 bcm43xx_lock_mmio(bcm, flags);
3116
3117 assert(bcm->initialized);
3118 state = bcm->periodic_state; 3137 state = bcm->periodic_state;
3119 if (state % 8 == 0) 3138 if (state % 8 == 0)
3120 bcm43xx_periodic_every120sec(bcm); 3139 bcm43xx_periodic_every120sec(bcm);
@@ -3122,29 +3141,93 @@ static void bcm43xx_periodic_task_handler(unsigned long d)
3122 bcm43xx_periodic_every60sec(bcm); 3141 bcm43xx_periodic_every60sec(bcm);
3123 if (state % 2 == 0) 3142 if (state % 2 == 0)
3124 bcm43xx_periodic_every30sec(bcm); 3143 bcm43xx_periodic_every30sec(bcm);
3125 bcm43xx_periodic_every15sec(bcm); 3144 if (state % 1 == 0)
3145 bcm43xx_periodic_every15sec(bcm);
3126 bcm->periodic_state = state + 1; 3146 bcm->periodic_state = state + 1;
3127 3147
3128 mod_timer(&bcm->periodic_tasks, jiffies + (HZ * 15)); 3148 schedule_delayed_work(&bcm->periodic_work, HZ * 15);
3149}
3150
3151/* Estimate a "Badness" value based on the periodic work
3152 * state-machine state. "Badness" is worse (bigger), if the
3153 * periodic work will take longer.
3154 */
3155static int estimate_periodic_work_badness(unsigned int state)
3156{
3157 int badness = 0;
3158
3159 if (state % 8 == 0) /* every 120 sec */
3160 badness += 10;
3161 if (state % 4 == 0) /* every 60 sec */
3162 badness += 5;
3163 if (state % 2 == 0) /* every 30 sec */
3164 badness += 1;
3165 if (state % 1 == 0) /* every 15 sec */
3166 badness += 1;
3129 3167
3130 bcm43xx_unlock_mmio(bcm, flags); 3168#define BADNESS_LIMIT 4
3169 return badness;
3170}
3171
3172static void bcm43xx_periodic_work_handler(void *d)
3173{
3174 struct bcm43xx_private *bcm = d;
3175 unsigned long flags;
3176 u32 savedirqs = 0;
3177 int badness;
3178
3179 badness = estimate_periodic_work_badness(bcm->periodic_state);
3180 if (badness > BADNESS_LIMIT) {
3181 /* Periodic work will take a long time, so we want it to
3182 * be preemtible.
3183 */
3184 bcm43xx_lock_irqonly(bcm, flags);
3185 netif_stop_queue(bcm->net_dev);
3186 if (bcm43xx_using_pio(bcm))
3187 bcm43xx_pio_freeze_txqueues(bcm);
3188 savedirqs = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL);
3189 bcm43xx_unlock_irqonly(bcm, flags);
3190 bcm43xx_lock_noirq(bcm);
3191 bcm43xx_synchronize_irq(bcm);
3192 } else {
3193 /* Periodic work should take short time, so we want low
3194 * locking overhead.
3195 */
3196 bcm43xx_lock_irqsafe(bcm, flags);
3197 }
3198
3199 do_periodic_work(bcm);
3200
3201 if (badness > BADNESS_LIMIT) {
3202 bcm43xx_lock_irqonly(bcm, flags);
3203 if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)) {
3204 tasklet_enable(&bcm->isr_tasklet);
3205 bcm43xx_interrupt_enable(bcm, savedirqs);
3206 if (bcm43xx_using_pio(bcm))
3207 bcm43xx_pio_thaw_txqueues(bcm);
3208 }
3209 netif_wake_queue(bcm->net_dev);
3210 mmiowb();
3211 bcm43xx_unlock_irqonly(bcm, flags);
3212 bcm43xx_unlock_noirq(bcm);
3213 } else {
3214 mmiowb();
3215 bcm43xx_unlock_irqsafe(bcm, flags);
3216 }
3131} 3217}
3132 3218
3133static void bcm43xx_periodic_tasks_delete(struct bcm43xx_private *bcm) 3219static void bcm43xx_periodic_tasks_delete(struct bcm43xx_private *bcm)
3134{ 3220{
3135 del_timer_sync(&bcm->periodic_tasks); 3221 cancel_rearming_delayed_work(&bcm->periodic_work);
3136} 3222}
3137 3223
3138static void bcm43xx_periodic_tasks_setup(struct bcm43xx_private *bcm) 3224static void bcm43xx_periodic_tasks_setup(struct bcm43xx_private *bcm)
3139{ 3225{
3140 struct timer_list *timer = &(bcm->periodic_tasks); 3226 struct work_struct *work = &(bcm->periodic_work);
3141 3227
3142 assert(bcm->initialized); 3228 assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
3143 setup_timer(timer, 3229 INIT_WORK(work, bcm43xx_periodic_work_handler, bcm);
3144 bcm43xx_periodic_task_handler, 3230 schedule_work(work);
3145 (unsigned long)bcm);
3146 timer->expires = jiffies;
3147 add_timer(timer);
3148} 3231}
3149 3232
3150static void bcm43xx_security_init(struct bcm43xx_private *bcm) 3233static void bcm43xx_security_init(struct bcm43xx_private *bcm)
@@ -3158,16 +3241,12 @@ static void bcm43xx_security_init(struct bcm43xx_private *bcm)
3158static void bcm43xx_free_board(struct bcm43xx_private *bcm) 3241static void bcm43xx_free_board(struct bcm43xx_private *bcm)
3159{ 3242{
3160 int i, err; 3243 int i, err;
3161 unsigned long flags;
3162 3244
3245 bcm43xx_lock_noirq(bcm);
3163 bcm43xx_sysfs_unregister(bcm); 3246 bcm43xx_sysfs_unregister(bcm);
3164
3165 bcm43xx_periodic_tasks_delete(bcm); 3247 bcm43xx_periodic_tasks_delete(bcm);
3166 3248
3167 bcm43xx_lock(bcm, flags); 3249 bcm43xx_set_status(bcm, BCM43xx_STAT_SHUTTINGDOWN);
3168 bcm->initialized = 0;
3169 bcm->shutting_down = 1;
3170 bcm43xx_unlock(bcm, flags);
3171 3250
3172 for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { 3251 for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
3173 if (!bcm->core_80211[i].available) 3252 if (!bcm->core_80211[i].available)
@@ -3182,23 +3261,19 @@ static void bcm43xx_free_board(struct bcm43xx_private *bcm)
3182 3261
3183 bcm43xx_pctl_set_crystal(bcm, 0); 3262 bcm43xx_pctl_set_crystal(bcm, 0);
3184 3263
3185 bcm43xx_lock(bcm, flags); 3264 bcm43xx_set_status(bcm, BCM43xx_STAT_UNINIT);
3186 bcm->shutting_down = 0; 3265 bcm43xx_unlock_noirq(bcm);
3187 bcm43xx_unlock(bcm, flags);
3188} 3266}
3189 3267
3190static int bcm43xx_init_board(struct bcm43xx_private *bcm) 3268static int bcm43xx_init_board(struct bcm43xx_private *bcm)
3191{ 3269{
3192 int i, err; 3270 int i, err;
3193 int connect_phy; 3271 int connect_phy;
3194 unsigned long flags;
3195 3272
3196 might_sleep(); 3273 might_sleep();
3197 3274
3198 bcm43xx_lock(bcm, flags); 3275 bcm43xx_lock_noirq(bcm);
3199 bcm->initialized = 0; 3276 bcm43xx_set_status(bcm, BCM43xx_STAT_INITIALIZING);
3200 bcm->shutting_down = 0;
3201 bcm43xx_unlock(bcm, flags);
3202 3277
3203 err = bcm43xx_pctl_set_crystal(bcm, 1); 3278 err = bcm43xx_pctl_set_crystal(bcm, 1);
3204 if (err) 3279 if (err)
@@ -3265,9 +3340,7 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm)
3265 } 3340 }
3266 3341
3267 /* Initialization of the board is done. Flag it as such. */ 3342 /* Initialization of the board is done. Flag it as such. */
3268 bcm43xx_lock(bcm, flags); 3343 bcm43xx_set_status(bcm, BCM43xx_STAT_INITIALIZED);
3269 bcm->initialized = 1;
3270 bcm43xx_unlock(bcm, flags);
3271 3344
3272 bcm43xx_periodic_tasks_setup(bcm); 3345 bcm43xx_periodic_tasks_setup(bcm);
3273 bcm43xx_sysfs_register(bcm); 3346 bcm43xx_sysfs_register(bcm);
@@ -3278,6 +3351,8 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm)
3278 3351
3279 assert(err == 0); 3352 assert(err == 0);
3280out: 3353out:
3354 bcm43xx_unlock_noirq(bcm);
3355
3281 return err; 3356 return err;
3282 3357
3283err_80211_unwind: 3358err_80211_unwind:
@@ -3534,8 +3609,8 @@ static void bcm43xx_ieee80211_set_chan(struct net_device *net_dev,
3534 struct bcm43xx_radioinfo *radio; 3609 struct bcm43xx_radioinfo *radio;
3535 unsigned long flags; 3610 unsigned long flags;
3536 3611
3537 bcm43xx_lock_mmio(bcm, flags); 3612 bcm43xx_lock_irqsafe(bcm, flags);
3538 if (bcm->initialized) { 3613 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
3539 bcm43xx_mac_suspend(bcm); 3614 bcm43xx_mac_suspend(bcm);
3540 bcm43xx_radio_selectchannel(bcm, channel, 0); 3615 bcm43xx_radio_selectchannel(bcm, channel, 0);
3541 bcm43xx_mac_enable(bcm); 3616 bcm43xx_mac_enable(bcm);
@@ -3543,7 +3618,7 @@ static void bcm43xx_ieee80211_set_chan(struct net_device *net_dev,
3543 radio = bcm43xx_current_radio(bcm); 3618 radio = bcm43xx_current_radio(bcm);
3544 radio->initial_channel = channel; 3619 radio->initial_channel = channel;
3545 } 3620 }
3546 bcm43xx_unlock_mmio(bcm, flags); 3621 bcm43xx_unlock_irqsafe(bcm, flags);
3547} 3622}
3548 3623
3549/* set_security() callback in struct ieee80211_device */ 3624/* set_security() callback in struct ieee80211_device */
@@ -3557,7 +3632,7 @@ static void bcm43xx_ieee80211_set_security(struct net_device *net_dev,
3557 3632
3558 dprintk(KERN_INFO PFX "set security called"); 3633 dprintk(KERN_INFO PFX "set security called");
3559 3634
3560 bcm43xx_lock_mmio(bcm, flags); 3635 bcm43xx_lock_irqsafe(bcm, flags);
3561 3636
3562 for (keyidx = 0; keyidx<WEP_KEYS; keyidx++) 3637 for (keyidx = 0; keyidx<WEP_KEYS; keyidx++)
3563 if (sec->flags & (1<<keyidx)) { 3638 if (sec->flags & (1<<keyidx)) {
@@ -3587,7 +3662,8 @@ static void bcm43xx_ieee80211_set_security(struct net_device *net_dev,
3587 dprintk(", .encrypt = %d", sec->encrypt); 3662 dprintk(", .encrypt = %d", sec->encrypt);
3588 } 3663 }
3589 dprintk("\n"); 3664 dprintk("\n");
3590 if (bcm->initialized && !bcm->ieee->host_encrypt) { 3665 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED &&
3666 !bcm->ieee->host_encrypt) {
3591 if (secinfo->enabled) { 3667 if (secinfo->enabled) {
3592 /* upload WEP keys to hardware */ 3668 /* upload WEP keys to hardware */
3593 char null_address[6] = { 0 }; 3669 char null_address[6] = { 0 };
@@ -3621,7 +3697,7 @@ static void bcm43xx_ieee80211_set_security(struct net_device *net_dev,
3621 } else 3697 } else
3622 bcm43xx_clear_keys(bcm); 3698 bcm43xx_clear_keys(bcm);
3623 } 3699 }
3624 bcm43xx_unlock_mmio(bcm, flags); 3700 bcm43xx_unlock_irqsafe(bcm, flags);
3625} 3701}
3626 3702
3627/* hard_start_xmit() callback in struct ieee80211_device */ 3703/* hard_start_xmit() callback in struct ieee80211_device */
@@ -3633,10 +3709,10 @@ static int bcm43xx_ieee80211_hard_start_xmit(struct ieee80211_txb *txb,
3633 int err = -ENODEV; 3709 int err = -ENODEV;
3634 unsigned long flags; 3710 unsigned long flags;
3635 3711
3636 bcm43xx_lock_mmio(bcm, flags); 3712 bcm43xx_lock_irqonly(bcm, flags);
3637 if (likely(bcm->initialized)) 3713 if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED))
3638 err = bcm43xx_tx(bcm, txb); 3714 err = bcm43xx_tx(bcm, txb);
3639 bcm43xx_unlock_mmio(bcm, flags); 3715 bcm43xx_unlock_irqonly(bcm, flags);
3640 3716
3641 return err; 3717 return err;
3642} 3718}
@@ -3651,9 +3727,9 @@ static void bcm43xx_net_tx_timeout(struct net_device *net_dev)
3651 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 3727 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
3652 unsigned long flags; 3728 unsigned long flags;
3653 3729
3654 bcm43xx_lock_mmio(bcm, flags); 3730 bcm43xx_lock_irqonly(bcm, flags);
3655 bcm43xx_controller_restart(bcm, "TX timeout"); 3731 bcm43xx_controller_restart(bcm, "TX timeout");
3656 bcm43xx_unlock_mmio(bcm, flags); 3732 bcm43xx_unlock_irqonly(bcm, flags);
3657} 3733}
3658 3734
3659#ifdef CONFIG_NET_POLL_CONTROLLER 3735#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -3678,9 +3754,11 @@ static int bcm43xx_net_open(struct net_device *net_dev)
3678static int bcm43xx_net_stop(struct net_device *net_dev) 3754static int bcm43xx_net_stop(struct net_device *net_dev)
3679{ 3755{
3680 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 3756 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
3757 int err;
3681 3758
3682 ieee80211softmac_stop(net_dev); 3759 ieee80211softmac_stop(net_dev);
3683 bcm43xx_disable_interrupts_sync(bcm, NULL); 3760 err = bcm43xx_disable_interrupts_sync(bcm, NULL);
3761 assert(!err);
3684 bcm43xx_free_board(bcm); 3762 bcm43xx_free_board(bcm);
3685 3763
3686 return 0; 3764 return 0;
@@ -3692,6 +3770,7 @@ static int bcm43xx_init_private(struct bcm43xx_private *bcm,
3692{ 3770{
3693 int err; 3771 int err;
3694 3772
3773 bcm43xx_set_status(bcm, BCM43xx_STAT_UNINIT);
3695 bcm->ieee = netdev_priv(net_dev); 3774 bcm->ieee = netdev_priv(net_dev);
3696 bcm->softmac = ieee80211_priv(net_dev); 3775 bcm->softmac = ieee80211_priv(net_dev);
3697 bcm->softmac->set_channel = bcm43xx_ieee80211_set_chan; 3776 bcm->softmac->set_channel = bcm43xx_ieee80211_set_chan;
@@ -3700,7 +3779,8 @@ static int bcm43xx_init_private(struct bcm43xx_private *bcm,
3700 bcm->pci_dev = pci_dev; 3779 bcm->pci_dev = pci_dev;
3701 bcm->net_dev = net_dev; 3780 bcm->net_dev = net_dev;
3702 bcm->bad_frames_preempt = modparam_bad_frames_preempt; 3781 bcm->bad_frames_preempt = modparam_bad_frames_preempt;
3703 spin_lock_init(&bcm->_lock); 3782 spin_lock_init(&bcm->irq_lock);
3783 mutex_init(&bcm->mutex);
3704 tasklet_init(&bcm->isr_tasklet, 3784 tasklet_init(&bcm->isr_tasklet,
3705 (void (*)(unsigned long))bcm43xx_interrupt_tasklet, 3785 (void (*)(unsigned long))bcm43xx_interrupt_tasklet,
3706 (unsigned long)bcm); 3786 (unsigned long)bcm);
@@ -3831,7 +3911,7 @@ static void bcm43xx_chip_reset(void *_bcm)
3831 struct net_device *net_dev = bcm->net_dev; 3911 struct net_device *net_dev = bcm->net_dev;
3832 struct pci_dev *pci_dev = bcm->pci_dev; 3912 struct pci_dev *pci_dev = bcm->pci_dev;
3833 int err; 3913 int err;
3834 int was_initialized = bcm->initialized; 3914 int was_initialized = (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
3835 3915
3836 netif_stop_queue(bcm->net_dev); 3916 netif_stop_queue(bcm->net_dev);
3837 tasklet_disable(&bcm->isr_tasklet); 3917 tasklet_disable(&bcm->isr_tasklet);
@@ -3866,6 +3946,7 @@ failure:
3866*/ 3946*/
3867void bcm43xx_controller_restart(struct bcm43xx_private *bcm, const char *reason) 3947void bcm43xx_controller_restart(struct bcm43xx_private *bcm, const char *reason)
3868{ 3948{
3949 bcm43xx_set_status(bcm, BCM43xx_STAT_RESTARTING);
3869 bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); 3950 bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL);
3870 bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* dummy read */ 3951 bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* dummy read */
3871 printk(KERN_ERR PFX "Controller RESET (%s) ...\n", reason); 3952 printk(KERN_ERR PFX "Controller RESET (%s) ...\n", reason);
@@ -3884,11 +3965,11 @@ static int bcm43xx_suspend(struct pci_dev *pdev, pm_message_t state)
3884 3965
3885 dprintk(KERN_INFO PFX "Suspending...\n"); 3966 dprintk(KERN_INFO PFX "Suspending...\n");
3886 3967
3887 bcm43xx_lock(bcm, flags); 3968 bcm43xx_lock_irqsafe(bcm, flags);
3888 bcm->was_initialized = bcm->initialized; 3969 bcm->was_initialized = (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
3889 if (bcm->initialized) 3970 if (bcm->was_initialized)
3890 try_to_shutdown = 1; 3971 try_to_shutdown = 1;
3891 bcm43xx_unlock(bcm, flags); 3972 bcm43xx_unlock_irqsafe(bcm, flags);
3892 3973
3893 netif_device_detach(net_dev); 3974 netif_device_detach(net_dev);
3894 if (try_to_shutdown) { 3975 if (try_to_shutdown) {
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index b0abac515530..f8200deecc8a 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -1410,7 +1410,10 @@ static inline
1410u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control) 1410u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control)
1411{ 1411{
1412 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 1412 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1413 u16 ret;
1414 unsigned long flags;
1413 1415
1416 local_irq_save(flags);
1414 if (phy->connected) { 1417 if (phy->connected) {
1415 bcm43xx_phy_write(bcm, 0x15, 0xE300); 1418 bcm43xx_phy_write(bcm, 0x15, 0xE300);
1416 control <<= 8; 1419 control <<= 8;
@@ -1430,8 +1433,10 @@ u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control)
1430 bcm43xx_phy_write(bcm, 0x0015, control | 0xFFE0); 1433 bcm43xx_phy_write(bcm, 0x0015, control | 0xFFE0);
1431 udelay(8); 1434 udelay(8);
1432 } 1435 }
1436 ret = bcm43xx_phy_read(bcm, 0x002D);
1437 local_irq_restore(flags);
1433 1438
1434 return bcm43xx_phy_read(bcm, 0x002D); 1439 return ret;
1435} 1440}
1436 1441
1437static u32 bcm43xx_phy_lo_g_singledeviation(struct bcm43xx_private *bcm, u16 control) 1442static u32 bcm43xx_phy_lo_g_singledeviation(struct bcm43xx_private *bcm, u16 control)
@@ -1648,7 +1653,7 @@ void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm,
1648void bcm43xx_phy_lo_g_measure(struct bcm43xx_private *bcm) 1653void bcm43xx_phy_lo_g_measure(struct bcm43xx_private *bcm)
1649{ 1654{
1650 static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 }; 1655 static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 };
1651 const int is_initializing = bcm43xx_is_initializing(bcm); 1656 const int is_initializing = (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZING);
1652 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 1657 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1653 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); 1658 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1654 u16 h, i, oldi = 0, j; 1659 u16 h, i, oldi = 0, j;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_pio.c b/drivers/net/wireless/bcm43xx/bcm43xx_pio.c
index 0aa1bd269a25..574085c46152 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_pio.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_pio.c
@@ -262,8 +262,10 @@ static void tx_tasklet(unsigned long d)
262 int err; 262 int err;
263 u16 txctl; 263 u16 txctl;
264 264
265 bcm43xx_lock_mmio(bcm, flags); 265 bcm43xx_lock_irqonly(bcm, flags);
266 266
267 if (queue->tx_frozen)
268 goto out_unlock;
267 txctl = bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL); 269 txctl = bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL);
268 if (txctl & BCM43xx_PIO_TXCTL_SUSPEND) 270 if (txctl & BCM43xx_PIO_TXCTL_SUSPEND)
269 goto out_unlock; 271 goto out_unlock;
@@ -298,7 +300,7 @@ static void tx_tasklet(unsigned long d)
298 continue; 300 continue;
299 } 301 }
300out_unlock: 302out_unlock:
301 bcm43xx_unlock_mmio(bcm, flags); 303 bcm43xx_unlock_irqonly(bcm, flags);
302} 304}
303 305
304static void setup_txqueues(struct bcm43xx_pioqueue *queue) 306static void setup_txqueues(struct bcm43xx_pioqueue *queue)
@@ -374,7 +376,6 @@ static void cancel_transfers(struct bcm43xx_pioqueue *queue)
374 struct bcm43xx_pio_txpacket *packet, *tmp_packet; 376 struct bcm43xx_pio_txpacket *packet, *tmp_packet;
375 377
376 netif_tx_disable(queue->bcm->net_dev); 378 netif_tx_disable(queue->bcm->net_dev);
377 assert(queue->bcm->shutting_down);
378 tasklet_disable(&queue->txtask); 379 tasklet_disable(&queue->txtask);
379 380
380 list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list) 381 list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list)
@@ -634,5 +635,40 @@ void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue)
634 bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL) 635 bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL)
635 & ~BCM43xx_PIO_TXCTL_SUSPEND); 636 & ~BCM43xx_PIO_TXCTL_SUSPEND);
636 bcm43xx_power_saving_ctl_bits(queue->bcm, -1, -1); 637 bcm43xx_power_saving_ctl_bits(queue->bcm, -1, -1);
637 tasklet_schedule(&queue->txtask); 638 if (!list_empty(&queue->txqueue))
639 tasklet_schedule(&queue->txtask);
640}
641
642void bcm43xx_pio_freeze_txqueues(struct bcm43xx_private *bcm)
643{
644 struct bcm43xx_pio *pio;
645
646 assert(bcm43xx_using_pio(bcm));
647 pio = bcm43xx_current_pio(bcm);
648 pio->queue0->tx_frozen = 1;
649 pio->queue1->tx_frozen = 1;
650 pio->queue2->tx_frozen = 1;
651 pio->queue3->tx_frozen = 1;
638} 652}
653
654void bcm43xx_pio_thaw_txqueues(struct bcm43xx_private *bcm)
655{
656 struct bcm43xx_pio *pio;
657
658 assert(bcm43xx_using_pio(bcm));
659 pio = bcm43xx_current_pio(bcm);
660 pio->queue0->tx_frozen = 0;
661 pio->queue1->tx_frozen = 0;
662 pio->queue2->tx_frozen = 0;
663 pio->queue3->tx_frozen = 0;
664 if (!list_empty(&pio->queue0->txqueue))
665 tasklet_schedule(&pio->queue0->txtask);
666 if (!list_empty(&pio->queue1->txqueue))
667 tasklet_schedule(&pio->queue1->txtask);
668 if (!list_empty(&pio->queue2->txqueue))
669 tasklet_schedule(&pio->queue2->txtask);
670 if (!list_empty(&pio->queue3->txqueue))
671 tasklet_schedule(&pio->queue3->txtask);
672}
673
674
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_pio.h b/drivers/net/wireless/bcm43xx/bcm43xx_pio.h
index dfc78209e3a3..bc78a3c2cafb 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_pio.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_pio.h
@@ -54,6 +54,7 @@ struct bcm43xx_pioqueue {
54 u16 mmio_base; 54 u16 mmio_base;
55 55
56 u8 tx_suspended:1, 56 u8 tx_suspended:1,
57 tx_frozen:1,
57 need_workarounds:1; /* Workarounds needed for core.rev < 3 */ 58 need_workarounds:1; /* Workarounds needed for core.rev < 3 */
58 59
59 /* Adjusted size of the device internal TX buffer. */ 60 /* Adjusted size of the device internal TX buffer. */
@@ -108,8 +109,12 @@ void bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm,
108 struct bcm43xx_xmitstatus *status); 109 struct bcm43xx_xmitstatus *status);
109void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue); 110void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue);
110 111
112/* Suspend a TX queue on hardware level. */
111void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue); 113void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue);
112void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue); 114void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue);
115/* Suspend (freeze) the TX tasklet (software level). */
116void bcm43xx_pio_freeze_txqueues(struct bcm43xx_private *bcm);
117void bcm43xx_pio_thaw_txqueues(struct bcm43xx_private *bcm);
113 118
114#else /* CONFIG_BCM43XX_PIO */ 119#else /* CONFIG_BCM43XX_PIO */
115 120
@@ -145,6 +150,14 @@ static inline
145void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue) 150void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue)
146{ 151{
147} 152}
153static inline
154void bcm43xx_pio_freeze_txqueues(struct bcm43xx_private *bcm)
155{
156}
157static inline
158void bcm43xx_pio_thaw_txqueues(struct bcm43xx_private *bcm)
159{
160}
148 161
149#endif /* CONFIG_BCM43XX_PIO */ 162#endif /* CONFIG_BCM43XX_PIO */
150#endif /* BCM43xx_PIO_H_ */ 163#endif /* BCM43xx_PIO_H_ */
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
index b438f48e891d..6a23bdc75412 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
@@ -120,12 +120,12 @@ static ssize_t bcm43xx_attr_sprom_show(struct device *dev,
120 GFP_KERNEL); 120 GFP_KERNEL);
121 if (!sprom) 121 if (!sprom)
122 return -ENOMEM; 122 return -ENOMEM;
123 bcm43xx_lock_mmio(bcm, flags); 123 bcm43xx_lock_irqsafe(bcm, flags);
124 assert(bcm->initialized);
125 err = bcm43xx_sprom_read(bcm, sprom); 124 err = bcm43xx_sprom_read(bcm, sprom);
126 if (!err) 125 if (!err)
127 err = sprom2hex(sprom, buf, PAGE_SIZE); 126 err = sprom2hex(sprom, buf, PAGE_SIZE);
128 bcm43xx_unlock_mmio(bcm, flags); 127 mmiowb();
128 bcm43xx_unlock_irqsafe(bcm, flags);
129 kfree(sprom); 129 kfree(sprom);
130 130
131 return err; 131 return err;
@@ -150,10 +150,10 @@ static ssize_t bcm43xx_attr_sprom_store(struct device *dev,
150 err = hex2sprom(sprom, buf, count); 150 err = hex2sprom(sprom, buf, count);
151 if (err) 151 if (err)
152 goto out_kfree; 152 goto out_kfree;
153 bcm43xx_lock_mmio(bcm, flags); 153 bcm43xx_lock_irqsafe(bcm, flags);
154 assert(bcm->initialized);
155 err = bcm43xx_sprom_write(bcm, sprom); 154 err = bcm43xx_sprom_write(bcm, sprom);
156 bcm43xx_unlock_mmio(bcm, flags); 155 mmiowb();
156 bcm43xx_unlock_irqsafe(bcm, flags);
157out_kfree: 157out_kfree:
158 kfree(sprom); 158 kfree(sprom);
159 159
@@ -170,15 +170,13 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev,
170 char *buf) 170 char *buf)
171{ 171{
172 struct bcm43xx_private *bcm = dev_to_bcm(dev); 172 struct bcm43xx_private *bcm = dev_to_bcm(dev);
173 unsigned long flags;
174 int err; 173 int err;
175 ssize_t count = 0; 174 ssize_t count = 0;
176 175
177 if (!capable(CAP_NET_ADMIN)) 176 if (!capable(CAP_NET_ADMIN))
178 return -EPERM; 177 return -EPERM;
179 178
180 bcm43xx_lock(bcm, flags); 179 bcm43xx_lock_noirq(bcm);
181 assert(bcm->initialized);
182 180
183 switch (bcm43xx_current_radio(bcm)->interfmode) { 181 switch (bcm43xx_current_radio(bcm)->interfmode) {
184 case BCM43xx_RADIO_INTERFMODE_NONE: 182 case BCM43xx_RADIO_INTERFMODE_NONE:
@@ -195,7 +193,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev,
195 } 193 }
196 err = 0; 194 err = 0;
197 195
198 bcm43xx_unlock(bcm, flags); 196 bcm43xx_unlock_noirq(bcm);
199 197
200 return err ? err : count; 198 return err ? err : count;
201 199
@@ -231,16 +229,15 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev,
231 return -EINVAL; 229 return -EINVAL;
232 } 230 }
233 231
234 bcm43xx_lock_mmio(bcm, flags); 232 bcm43xx_lock_irqsafe(bcm, flags);
235 assert(bcm->initialized);
236 233
237 err = bcm43xx_radio_set_interference_mitigation(bcm, mode); 234 err = bcm43xx_radio_set_interference_mitigation(bcm, mode);
238 if (err) { 235 if (err) {
239 printk(KERN_ERR PFX "Interference Mitigation not " 236 printk(KERN_ERR PFX "Interference Mitigation not "
240 "supported by device\n"); 237 "supported by device\n");
241 } 238 }
242 239 mmiowb();
243 bcm43xx_unlock_mmio(bcm, flags); 240 bcm43xx_unlock_irqsafe(bcm, flags);
244 241
245 return err ? err : count; 242 return err ? err : count;
246} 243}
@@ -254,15 +251,13 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev,
254 char *buf) 251 char *buf)
255{ 252{
256 struct bcm43xx_private *bcm = dev_to_bcm(dev); 253 struct bcm43xx_private *bcm = dev_to_bcm(dev);
257 unsigned long flags;
258 int err; 254 int err;
259 ssize_t count; 255 ssize_t count;
260 256
261 if (!capable(CAP_NET_ADMIN)) 257 if (!capable(CAP_NET_ADMIN))
262 return -EPERM; 258 return -EPERM;
263 259
264 bcm43xx_lock(bcm, flags); 260 bcm43xx_lock_noirq(bcm);
265 assert(bcm->initialized);
266 261
267 if (bcm->short_preamble) 262 if (bcm->short_preamble)
268 count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n"); 263 count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n");
@@ -270,7 +265,7 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev,
270 count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n"); 265 count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n");
271 266
272 err = 0; 267 err = 0;
273 bcm43xx_unlock(bcm, flags); 268 bcm43xx_unlock_noirq(bcm);
274 269
275 return err ? err : count; 270 return err ? err : count;
276} 271}
@@ -290,13 +285,12 @@ static ssize_t bcm43xx_attr_preamble_store(struct device *dev,
290 value = get_boolean(buf, count); 285 value = get_boolean(buf, count);
291 if (value < 0) 286 if (value < 0)
292 return value; 287 return value;
293 bcm43xx_lock(bcm, flags); 288 bcm43xx_lock_irqsafe(bcm, flags);
294 assert(bcm->initialized);
295 289
296 bcm->short_preamble = !!value; 290 bcm->short_preamble = !!value;
297 291
298 err = 0; 292 err = 0;
299 bcm43xx_unlock(bcm, flags); 293 bcm43xx_unlock_irqsafe(bcm, flags);
300 294
301 return err ? err : count; 295 return err ? err : count;
302} 296}
@@ -310,7 +304,7 @@ int bcm43xx_sysfs_register(struct bcm43xx_private *bcm)
310 struct device *dev = &bcm->pci_dev->dev; 304 struct device *dev = &bcm->pci_dev->dev;
311 int err; 305 int err;
312 306
313 assert(bcm->initialized); 307 assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
314 308
315 err = device_create_file(dev, &dev_attr_sprom); 309 err = device_create_file(dev, &dev_attr_sprom);
316 if (err) 310 if (err)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index b45063974ae9..c35cb3a0777e 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -55,13 +55,13 @@ static int bcm43xx_wx_get_name(struct net_device *net_dev,
55 char *extra) 55 char *extra)
56{ 56{
57 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 57 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
58 unsigned long flags;
59 int i; 58 int i;
59 unsigned long flags;
60 struct bcm43xx_phyinfo *phy; 60 struct bcm43xx_phyinfo *phy;
61 char suffix[7] = { 0 }; 61 char suffix[7] = { 0 };
62 int have_a = 0, have_b = 0, have_g = 0; 62 int have_a = 0, have_b = 0, have_g = 0;
63 63
64 bcm43xx_lock(bcm, flags); 64 bcm43xx_lock_irqsafe(bcm, flags);
65 for (i = 0; i < bcm->nr_80211_available; i++) { 65 for (i = 0; i < bcm->nr_80211_available; i++) {
66 phy = &(bcm->core_80211_ext[i].phy); 66 phy = &(bcm->core_80211_ext[i].phy);
67 switch (phy->type) { 67 switch (phy->type) {
@@ -77,7 +77,7 @@ static int bcm43xx_wx_get_name(struct net_device *net_dev,
77 assert(0); 77 assert(0);
78 } 78 }
79 } 79 }
80 bcm43xx_unlock(bcm, flags); 80 bcm43xx_unlock_irqsafe(bcm, flags);
81 81
82 i = 0; 82 i = 0;
83 if (have_a) { 83 if (have_a) {
@@ -111,7 +111,7 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
111 int freq; 111 int freq;
112 int err = -EINVAL; 112 int err = -EINVAL;
113 113
114 bcm43xx_lock_mmio(bcm, flags); 114 bcm43xx_lock_irqsafe(bcm, flags);
115 if ((data->freq.m >= 0) && (data->freq.m <= 1000)) { 115 if ((data->freq.m >= 0) && (data->freq.m <= 1000)) {
116 channel = data->freq.m; 116 channel = data->freq.m;
117 freq = bcm43xx_channel_to_freq(bcm, channel); 117 freq = bcm43xx_channel_to_freq(bcm, channel);
@@ -121,7 +121,7 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
121 } 121 }
122 if (!bcm43xx_is_valid_channel(bcm, channel)) 122 if (!bcm43xx_is_valid_channel(bcm, channel))
123 goto out_unlock; 123 goto out_unlock;
124 if (bcm->initialized) { 124 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
125 //ieee80211softmac_disassoc(softmac, $REASON); 125 //ieee80211softmac_disassoc(softmac, $REASON);
126 bcm43xx_mac_suspend(bcm); 126 bcm43xx_mac_suspend(bcm);
127 err = bcm43xx_radio_selectchannel(bcm, channel, 0); 127 err = bcm43xx_radio_selectchannel(bcm, channel, 0);
@@ -131,7 +131,7 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
131 err = 0; 131 err = 0;
132 } 132 }
133out_unlock: 133out_unlock:
134 bcm43xx_unlock_mmio(bcm, flags); 134 bcm43xx_unlock_irqsafe(bcm, flags);
135 135
136 return err; 136 return err;
137} 137}
@@ -147,11 +147,10 @@ static int bcm43xx_wx_get_channelfreq(struct net_device *net_dev,
147 int err = -ENODEV; 147 int err = -ENODEV;
148 u16 channel; 148 u16 channel;
149 149
150 bcm43xx_lock(bcm, flags); 150 bcm43xx_lock_irqsafe(bcm, flags);
151 radio = bcm43xx_current_radio(bcm); 151 radio = bcm43xx_current_radio(bcm);
152 channel = radio->channel; 152 channel = radio->channel;
153 if (channel == 0xFF) { 153 if (channel == 0xFF) {
154 assert(!bcm->initialized);
155 channel = radio->initial_channel; 154 channel = radio->initial_channel;
156 if (channel == 0xFF) 155 if (channel == 0xFF)
157 goto out_unlock; 156 goto out_unlock;
@@ -163,7 +162,7 @@ static int bcm43xx_wx_get_channelfreq(struct net_device *net_dev,
163 162
164 err = 0; 163 err = 0;
165out_unlock: 164out_unlock:
166 bcm43xx_unlock(bcm, flags); 165 bcm43xx_unlock_irqsafe(bcm, flags);
167 166
168 return err; 167 return err;
169} 168}
@@ -181,13 +180,13 @@ static int bcm43xx_wx_set_mode(struct net_device *net_dev,
181 if (mode == IW_MODE_AUTO) 180 if (mode == IW_MODE_AUTO)
182 mode = BCM43xx_INITIAL_IWMODE; 181 mode = BCM43xx_INITIAL_IWMODE;
183 182
184 bcm43xx_lock_mmio(bcm, flags); 183 bcm43xx_lock_irqsafe(bcm, flags);
185 if (bcm->initialized) { 184 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
186 if (bcm->ieee->iw_mode != mode) 185 if (bcm->ieee->iw_mode != mode)
187 bcm43xx_set_iwmode(bcm, mode); 186 bcm43xx_set_iwmode(bcm, mode);
188 } else 187 } else
189 bcm->ieee->iw_mode = mode; 188 bcm->ieee->iw_mode = mode;
190 bcm43xx_unlock_mmio(bcm, flags); 189 bcm43xx_unlock_irqsafe(bcm, flags);
191 190
192 return 0; 191 return 0;
193} 192}
@@ -200,9 +199,9 @@ static int bcm43xx_wx_get_mode(struct net_device *net_dev,
200 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 199 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
201 unsigned long flags; 200 unsigned long flags;
202 201
203 bcm43xx_lock(bcm, flags); 202 bcm43xx_lock_irqsafe(bcm, flags);
204 data->mode = bcm->ieee->iw_mode; 203 data->mode = bcm->ieee->iw_mode;
205 bcm43xx_unlock(bcm, flags); 204 bcm43xx_unlock_irqsafe(bcm, flags);
206 205
207 return 0; 206 return 0;
208} 207}
@@ -255,7 +254,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
255 IW_ENC_CAPA_CIPHER_TKIP | 254 IW_ENC_CAPA_CIPHER_TKIP |
256 IW_ENC_CAPA_CIPHER_CCMP; 255 IW_ENC_CAPA_CIPHER_CCMP;
257 256
258 bcm43xx_lock(bcm, flags); 257 bcm43xx_lock_irqsafe(bcm, flags);
259 phy = bcm43xx_current_phy(bcm); 258 phy = bcm43xx_current_phy(bcm);
260 259
261 range->num_bitrates = 0; 260 range->num_bitrates = 0;
@@ -302,7 +301,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
302 } 301 }
303 range->num_frequency = j; 302 range->num_frequency = j;
304 303
305 bcm43xx_unlock(bcm, flags); 304 bcm43xx_unlock_irqsafe(bcm, flags);
306 305
307 return 0; 306 return 0;
308} 307}
@@ -313,14 +312,13 @@ static int bcm43xx_wx_set_nick(struct net_device *net_dev,
313 char *extra) 312 char *extra)
314{ 313{
315 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 314 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
316 unsigned long flags;
317 size_t len; 315 size_t len;
318 316
319 bcm43xx_lock(bcm, flags); 317 bcm43xx_lock_noirq(bcm);
320 len = min((size_t)data->data.length, (size_t)IW_ESSID_MAX_SIZE); 318 len = min((size_t)data->data.length, (size_t)IW_ESSID_MAX_SIZE);
321 memcpy(bcm->nick, extra, len); 319 memcpy(bcm->nick, extra, len);
322 bcm->nick[len] = '\0'; 320 bcm->nick[len] = '\0';
323 bcm43xx_unlock(bcm, flags); 321 bcm43xx_unlock_noirq(bcm);
324 322
325 return 0; 323 return 0;
326} 324}
@@ -331,15 +329,14 @@ static int bcm43xx_wx_get_nick(struct net_device *net_dev,
331 char *extra) 329 char *extra)
332{ 330{
333 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 331 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
334 unsigned long flags;
335 size_t len; 332 size_t len;
336 333
337 bcm43xx_lock(bcm, flags); 334 bcm43xx_lock_noirq(bcm);
338 len = strlen(bcm->nick) + 1; 335 len = strlen(bcm->nick) + 1;
339 memcpy(extra, bcm->nick, len); 336 memcpy(extra, bcm->nick, len);
340 data->data.length = (__u16)len; 337 data->data.length = (__u16)len;
341 data->data.flags = 1; 338 data->data.flags = 1;
342 bcm43xx_unlock(bcm, flags); 339 bcm43xx_unlock_noirq(bcm);
343 340
344 return 0; 341 return 0;
345} 342}
@@ -353,7 +350,7 @@ static int bcm43xx_wx_set_rts(struct net_device *net_dev,
353 unsigned long flags; 350 unsigned long flags;
354 int err = -EINVAL; 351 int err = -EINVAL;
355 352
356 bcm43xx_lock(bcm, flags); 353 bcm43xx_lock_irqsafe(bcm, flags);
357 if (data->rts.disabled) { 354 if (data->rts.disabled) {
358 bcm->rts_threshold = BCM43xx_MAX_RTS_THRESHOLD; 355 bcm->rts_threshold = BCM43xx_MAX_RTS_THRESHOLD;
359 err = 0; 356 err = 0;
@@ -364,7 +361,7 @@ static int bcm43xx_wx_set_rts(struct net_device *net_dev,
364 err = 0; 361 err = 0;
365 } 362 }
366 } 363 }
367 bcm43xx_unlock(bcm, flags); 364 bcm43xx_unlock_irqsafe(bcm, flags);
368 365
369 return err; 366 return err;
370} 367}
@@ -377,11 +374,11 @@ static int bcm43xx_wx_get_rts(struct net_device *net_dev,
377 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 374 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
378 unsigned long flags; 375 unsigned long flags;
379 376
380 bcm43xx_lock(bcm, flags); 377 bcm43xx_lock_irqsafe(bcm, flags);
381 data->rts.value = bcm->rts_threshold; 378 data->rts.value = bcm->rts_threshold;
382 data->rts.fixed = 0; 379 data->rts.fixed = 0;
383 data->rts.disabled = (bcm->rts_threshold == BCM43xx_MAX_RTS_THRESHOLD); 380 data->rts.disabled = (bcm->rts_threshold == BCM43xx_MAX_RTS_THRESHOLD);
384 bcm43xx_unlock(bcm, flags); 381 bcm43xx_unlock_irqsafe(bcm, flags);
385 382
386 return 0; 383 return 0;
387} 384}
@@ -395,7 +392,7 @@ static int bcm43xx_wx_set_frag(struct net_device *net_dev,
395 unsigned long flags; 392 unsigned long flags;
396 int err = -EINVAL; 393 int err = -EINVAL;
397 394
398 bcm43xx_lock(bcm, flags); 395 bcm43xx_lock_irqsafe(bcm, flags);
399 if (data->frag.disabled) { 396 if (data->frag.disabled) {
400 bcm->ieee->fts = MAX_FRAG_THRESHOLD; 397 bcm->ieee->fts = MAX_FRAG_THRESHOLD;
401 err = 0; 398 err = 0;
@@ -406,7 +403,7 @@ static int bcm43xx_wx_set_frag(struct net_device *net_dev,
406 err = 0; 403 err = 0;
407 } 404 }
408 } 405 }
409 bcm43xx_unlock(bcm, flags); 406 bcm43xx_unlock_irqsafe(bcm, flags);
410 407
411 return err; 408 return err;
412} 409}
@@ -419,11 +416,11 @@ static int bcm43xx_wx_get_frag(struct net_device *net_dev,
419 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 416 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
420 unsigned long flags; 417 unsigned long flags;
421 418
422 bcm43xx_lock(bcm, flags); 419 bcm43xx_lock_irqsafe(bcm, flags);
423 data->frag.value = bcm->ieee->fts; 420 data->frag.value = bcm->ieee->fts;
424 data->frag.fixed = 0; 421 data->frag.fixed = 0;
425 data->frag.disabled = (bcm->ieee->fts == MAX_FRAG_THRESHOLD); 422 data->frag.disabled = (bcm->ieee->fts == MAX_FRAG_THRESHOLD);
426 bcm43xx_unlock(bcm, flags); 423 bcm43xx_unlock_irqsafe(bcm, flags);
427 424
428 return 0; 425 return 0;
429} 426}
@@ -445,8 +442,8 @@ static int bcm43xx_wx_set_xmitpower(struct net_device *net_dev,
445 return -EOPNOTSUPP; 442 return -EOPNOTSUPP;
446 } 443 }
447 444
448 bcm43xx_lock_mmio(bcm, flags); 445 bcm43xx_lock_irqsafe(bcm, flags);
449 if (!bcm->initialized) 446 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED)
450 goto out_unlock; 447 goto out_unlock;
451 radio = bcm43xx_current_radio(bcm); 448 radio = bcm43xx_current_radio(bcm);
452 phy = bcm43xx_current_phy(bcm); 449 phy = bcm43xx_current_phy(bcm);
@@ -469,7 +466,7 @@ static int bcm43xx_wx_set_xmitpower(struct net_device *net_dev,
469 err = 0; 466 err = 0;
470 467
471out_unlock: 468out_unlock:
472 bcm43xx_unlock_mmio(bcm, flags); 469 bcm43xx_unlock_irqsafe(bcm, flags);
473 470
474 return err; 471 return err;
475} 472}
@@ -484,8 +481,8 @@ static int bcm43xx_wx_get_xmitpower(struct net_device *net_dev,
484 unsigned long flags; 481 unsigned long flags;
485 int err = -ENODEV; 482 int err = -ENODEV;
486 483
487 bcm43xx_lock(bcm, flags); 484 bcm43xx_lock_irqsafe(bcm, flags);
488 if (!bcm->initialized) 485 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED)
489 goto out_unlock; 486 goto out_unlock;
490 radio = bcm43xx_current_radio(bcm); 487 radio = bcm43xx_current_radio(bcm);
491 /* desired dBm value is in Q5.2 */ 488 /* desired dBm value is in Q5.2 */
@@ -496,7 +493,7 @@ static int bcm43xx_wx_get_xmitpower(struct net_device *net_dev,
496 493
497 err = 0; 494 err = 0;
498out_unlock: 495out_unlock:
499 bcm43xx_unlock(bcm, flags); 496 bcm43xx_unlock_irqsafe(bcm, flags);
500 497
501 return err; 498 return err;
502} 499}
@@ -583,8 +580,8 @@ static int bcm43xx_wx_set_interfmode(struct net_device *net_dev,
583 return -EINVAL; 580 return -EINVAL;
584 } 581 }
585 582
586 bcm43xx_lock_mmio(bcm, flags); 583 bcm43xx_lock_irqsafe(bcm, flags);
587 if (bcm->initialized) { 584 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
588 err = bcm43xx_radio_set_interference_mitigation(bcm, mode); 585 err = bcm43xx_radio_set_interference_mitigation(bcm, mode);
589 if (err) { 586 if (err) {
590 printk(KERN_ERR PFX "Interference Mitigation not " 587 printk(KERN_ERR PFX "Interference Mitigation not "
@@ -598,7 +595,7 @@ static int bcm43xx_wx_set_interfmode(struct net_device *net_dev,
598 } else 595 } else
599 bcm43xx_current_radio(bcm)->interfmode = mode; 596 bcm43xx_current_radio(bcm)->interfmode = mode;
600 } 597 }
601 bcm43xx_unlock_mmio(bcm, flags); 598 bcm43xx_unlock_irqsafe(bcm, flags);
602 599
603 return err; 600 return err;
604} 601}
@@ -612,9 +609,9 @@ static int bcm43xx_wx_get_interfmode(struct net_device *net_dev,
612 unsigned long flags; 609 unsigned long flags;
613 int mode; 610 int mode;
614 611
615 bcm43xx_lock(bcm, flags); 612 bcm43xx_lock_irqsafe(bcm, flags);
616 mode = bcm43xx_current_radio(bcm)->interfmode; 613 mode = bcm43xx_current_radio(bcm)->interfmode;
617 bcm43xx_unlock(bcm, flags); 614 bcm43xx_unlock_irqsafe(bcm, flags);
618 615
619 switch (mode) { 616 switch (mode) {
620 case BCM43xx_RADIO_INTERFMODE_NONE: 617 case BCM43xx_RADIO_INTERFMODE_NONE:
@@ -644,9 +641,9 @@ static int bcm43xx_wx_set_shortpreamble(struct net_device *net_dev,
644 int on; 641 int on;
645 642
646 on = *((int *)extra); 643 on = *((int *)extra);
647 bcm43xx_lock(bcm, flags); 644 bcm43xx_lock_irqsafe(bcm, flags);
648 bcm->short_preamble = !!on; 645 bcm->short_preamble = !!on;
649 bcm43xx_unlock(bcm, flags); 646 bcm43xx_unlock_irqsafe(bcm, flags);
650 647
651 return 0; 648 return 0;
652} 649}
@@ -660,9 +657,9 @@ static int bcm43xx_wx_get_shortpreamble(struct net_device *net_dev,
660 unsigned long flags; 657 unsigned long flags;
661 int on; 658 int on;
662 659
663 bcm43xx_lock(bcm, flags); 660 bcm43xx_lock_irqsafe(bcm, flags);
664 on = bcm->short_preamble; 661 on = bcm->short_preamble;
665 bcm43xx_unlock(bcm, flags); 662 bcm43xx_unlock_irqsafe(bcm, flags);
666 663
667 if (on) 664 if (on)
668 strncpy(extra, "1 (Short Preamble enabled)", MAX_WX_STRING); 665 strncpy(extra, "1 (Short Preamble enabled)", MAX_WX_STRING);
@@ -684,11 +681,11 @@ static int bcm43xx_wx_set_swencryption(struct net_device *net_dev,
684 681
685 on = *((int *)extra); 682 on = *((int *)extra);
686 683
687 bcm43xx_lock(bcm, flags); 684 bcm43xx_lock_irqsafe(bcm, flags);
688 bcm->ieee->host_encrypt = !!on; 685 bcm->ieee->host_encrypt = !!on;
689 bcm->ieee->host_decrypt = !!on; 686 bcm->ieee->host_decrypt = !!on;
690 bcm->ieee->host_build_iv = !on; 687 bcm->ieee->host_build_iv = !on;
691 bcm43xx_unlock(bcm, flags); 688 bcm43xx_unlock_irqsafe(bcm, flags);
692 689
693 return 0; 690 return 0;
694} 691}
@@ -702,9 +699,9 @@ static int bcm43xx_wx_get_swencryption(struct net_device *net_dev,
702 unsigned long flags; 699 unsigned long flags;
703 int on; 700 int on;
704 701
705 bcm43xx_lock(bcm, flags); 702 bcm43xx_lock_irqsafe(bcm, flags);
706 on = bcm->ieee->host_encrypt; 703 on = bcm->ieee->host_encrypt;
707 bcm43xx_unlock(bcm, flags); 704 bcm43xx_unlock_irqsafe(bcm, flags);
708 705
709 if (on) 706 if (on)
710 strncpy(extra, "1 (SW encryption enabled) ", MAX_WX_STRING); 707 strncpy(extra, "1 (SW encryption enabled) ", MAX_WX_STRING);
@@ -767,11 +764,11 @@ static int bcm43xx_wx_sprom_read(struct net_device *net_dev,
767 if (!sprom) 764 if (!sprom)
768 goto out; 765 goto out;
769 766
770 bcm43xx_lock_mmio(bcm, flags); 767 bcm43xx_lock_irqsafe(bcm, flags);
771 err = -ENODEV; 768 err = -ENODEV;
772 if (bcm->initialized) 769 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)
773 err = bcm43xx_sprom_read(bcm, sprom); 770 err = bcm43xx_sprom_read(bcm, sprom);
774 bcm43xx_unlock_mmio(bcm, flags); 771 bcm43xx_unlock_irqsafe(bcm, flags);
775 if (!err) 772 if (!err)
776 data->data.length = sprom2hex(sprom, extra); 773 data->data.length = sprom2hex(sprom, extra);
777 kfree(sprom); 774 kfree(sprom);
@@ -812,11 +809,11 @@ static int bcm43xx_wx_sprom_write(struct net_device *net_dev,
812 if (err) 809 if (err)
813 goto out_kfree; 810 goto out_kfree;
814 811
815 bcm43xx_lock_mmio(bcm, flags); 812 bcm43xx_lock_irqsafe(bcm, flags);
816 err = -ENODEV; 813 err = -ENODEV;
817 if (bcm->initialized) 814 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)
818 err = bcm43xx_sprom_write(bcm, sprom); 815 err = bcm43xx_sprom_write(bcm, sprom);
819 bcm43xx_unlock_mmio(bcm, flags); 816 bcm43xx_unlock_irqsafe(bcm, flags);
820out_kfree: 817out_kfree:
821 kfree(sprom); 818 kfree(sprom);
822out: 819out:
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 39f82f219749..081a8999666e 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -533,7 +533,7 @@ static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask)
533 ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); 533 ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask);
534} 534}
535 535
536static inline void ipw_enable_interrupts(struct ipw_priv *priv) 536static inline void __ipw_enable_interrupts(struct ipw_priv *priv)
537{ 537{
538 if (priv->status & STATUS_INT_ENABLED) 538 if (priv->status & STATUS_INT_ENABLED)
539 return; 539 return;
@@ -541,7 +541,7 @@ static inline void ipw_enable_interrupts(struct ipw_priv *priv)
541 ipw_write32(priv, IPW_INTA_MASK_R, IPW_INTA_MASK_ALL); 541 ipw_write32(priv, IPW_INTA_MASK_R, IPW_INTA_MASK_ALL);
542} 542}
543 543
544static inline void ipw_disable_interrupts(struct ipw_priv *priv) 544static inline void __ipw_disable_interrupts(struct ipw_priv *priv)
545{ 545{
546 if (!(priv->status & STATUS_INT_ENABLED)) 546 if (!(priv->status & STATUS_INT_ENABLED))
547 return; 547 return;
@@ -549,6 +549,24 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv)
549 ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); 549 ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL);
550} 550}
551 551
552static inline void ipw_enable_interrupts(struct ipw_priv *priv)
553{
554 unsigned long flags;
555
556 spin_lock_irqsave(&priv->irq_lock, flags);
557 __ipw_enable_interrupts(priv);
558 spin_unlock_irqrestore(&priv->irq_lock, flags);
559}
560
561static inline void ipw_disable_interrupts(struct ipw_priv *priv)
562{
563 unsigned long flags;
564
565 spin_lock_irqsave(&priv->irq_lock, flags);
566 __ipw_disable_interrupts(priv);
567 spin_unlock_irqrestore(&priv->irq_lock, flags);
568}
569
552#ifdef CONFIG_IPW2200_DEBUG 570#ifdef CONFIG_IPW2200_DEBUG
553static char *ipw_error_desc(u32 val) 571static char *ipw_error_desc(u32 val)
554{ 572{
@@ -1856,7 +1874,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
1856 unsigned long flags; 1874 unsigned long flags;
1857 int rc = 0; 1875 int rc = 0;
1858 1876
1859 spin_lock_irqsave(&priv->lock, flags); 1877 spin_lock_irqsave(&priv->irq_lock, flags);
1860 1878
1861 inta = ipw_read32(priv, IPW_INTA_RW); 1879 inta = ipw_read32(priv, IPW_INTA_RW);
1862 inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); 1880 inta_mask = ipw_read32(priv, IPW_INTA_MASK_R);
@@ -1865,6 +1883,10 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
1865 /* Add any cached INTA values that need to be handled */ 1883 /* Add any cached INTA values that need to be handled */
1866 inta |= priv->isr_inta; 1884 inta |= priv->isr_inta;
1867 1885
1886 spin_unlock_irqrestore(&priv->irq_lock, flags);
1887
1888 spin_lock_irqsave(&priv->lock, flags);
1889
1868 /* handle all the justifications for the interrupt */ 1890 /* handle all the justifications for the interrupt */
1869 if (inta & IPW_INTA_BIT_RX_TRANSFER) { 1891 if (inta & IPW_INTA_BIT_RX_TRANSFER) {
1870 ipw_rx(priv); 1892 ipw_rx(priv);
@@ -1993,10 +2015,10 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
1993 IPW_ERROR("Unhandled INTA bits 0x%08x\n", inta & ~handled); 2015 IPW_ERROR("Unhandled INTA bits 0x%08x\n", inta & ~handled);
1994 } 2016 }
1995 2017
2018 spin_unlock_irqrestore(&priv->lock, flags);
2019
1996 /* enable all interrupts */ 2020 /* enable all interrupts */
1997 ipw_enable_interrupts(priv); 2021 ipw_enable_interrupts(priv);
1998
1999 spin_unlock_irqrestore(&priv->lock, flags);
2000} 2022}
2001 2023
2002#define IPW_CMD(x) case IPW_CMD_ ## x : return #x 2024#define IPW_CMD(x) case IPW_CMD_ ## x : return #x
@@ -10460,7 +10482,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
10460 if (!priv) 10482 if (!priv)
10461 return IRQ_NONE; 10483 return IRQ_NONE;
10462 10484
10463 spin_lock(&priv->lock); 10485 spin_lock(&priv->irq_lock);
10464 10486
10465 if (!(priv->status & STATUS_INT_ENABLED)) { 10487 if (!(priv->status & STATUS_INT_ENABLED)) {
10466 /* Shared IRQ */ 10488 /* Shared IRQ */
@@ -10482,7 +10504,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
10482 } 10504 }
10483 10505
10484 /* tell the device to stop sending interrupts */ 10506 /* tell the device to stop sending interrupts */
10485 ipw_disable_interrupts(priv); 10507 __ipw_disable_interrupts(priv);
10486 10508
10487 /* ack current interrupts */ 10509 /* ack current interrupts */
10488 inta &= (IPW_INTA_MASK_ALL & inta_mask); 10510 inta &= (IPW_INTA_MASK_ALL & inta_mask);
@@ -10493,11 +10515,11 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
10493 10515
10494 tasklet_schedule(&priv->irq_tasklet); 10516 tasklet_schedule(&priv->irq_tasklet);
10495 10517
10496 spin_unlock(&priv->lock); 10518 spin_unlock(&priv->irq_lock);
10497 10519
10498 return IRQ_HANDLED; 10520 return IRQ_HANDLED;
10499 none: 10521 none:
10500 spin_unlock(&priv->lock); 10522 spin_unlock(&priv->irq_lock);
10501 return IRQ_NONE; 10523 return IRQ_NONE;
10502} 10524}
10503 10525
@@ -11477,6 +11499,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11477#ifdef CONFIG_IPW2200_DEBUG 11499#ifdef CONFIG_IPW2200_DEBUG
11478 ipw_debug_level = debug; 11500 ipw_debug_level = debug;
11479#endif 11501#endif
11502 spin_lock_init(&priv->irq_lock);
11480 spin_lock_init(&priv->lock); 11503 spin_lock_init(&priv->lock);
11481 for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) 11504 for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++)
11482 INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); 11505 INIT_LIST_HEAD(&priv->ibss_mac_hash[i]);
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
index 6044c0be2c80..ea12ad66b8e8 100644
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -1173,6 +1173,7 @@ struct ipw_priv {
1173 struct ieee80211_device *ieee; 1173 struct ieee80211_device *ieee;
1174 1174
1175 spinlock_t lock; 1175 spinlock_t lock;
1176 spinlock_t irq_lock;
1176 struct mutex mutex; 1177 struct mutex mutex;
1177 1178
1178 /* basic pci-network driver stuff */ 1179 /* basic pci-network driver stuff */
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index b563decf599e..8a31b591a901 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -1787,7 +1787,9 @@ static int __orinoco_program_rids(struct net_device *dev)
1787 /* Set promiscuity / multicast*/ 1787 /* Set promiscuity / multicast*/
1788 priv->promiscuous = 0; 1788 priv->promiscuous = 0;
1789 priv->mc_count = 0; 1789 priv->mc_count = 0;
1790 __orinoco_set_multicast_list(dev); /* FIXME: what about the xmit_lock */ 1790
1791 /* FIXME: what about netif_tx_lock */
1792 __orinoco_set_multicast_list(dev);
1791 1793
1792 return 0; 1794 return 0;
1793} 1795}
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 1456759936c5..10e1a905c144 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -285,9 +285,9 @@ static int pci_device_suspend(struct device * dev, pm_message_t state)
285 * Default resume method for devices that have no driver provided resume, 285 * Default resume method for devices that have no driver provided resume,
286 * or not even a driver at all. 286 * or not even a driver at all.
287 */ 287 */
288static void pci_default_resume(struct pci_dev *pci_dev) 288static int pci_default_resume(struct pci_dev *pci_dev)
289{ 289{
290 int retval; 290 int retval = 0;
291 291
292 /* restore the PCI config space */ 292 /* restore the PCI config space */
293 pci_restore_state(pci_dev); 293 pci_restore_state(pci_dev);
@@ -297,18 +297,21 @@ static void pci_default_resume(struct pci_dev *pci_dev)
297 /* if the device was busmaster before the suspend, make it busmaster again */ 297 /* if the device was busmaster before the suspend, make it busmaster again */
298 if (pci_dev->is_busmaster) 298 if (pci_dev->is_busmaster)
299 pci_set_master(pci_dev); 299 pci_set_master(pci_dev);
300
301 return retval;
300} 302}
301 303
302static int pci_device_resume(struct device * dev) 304static int pci_device_resume(struct device * dev)
303{ 305{
306 int error;
304 struct pci_dev * pci_dev = to_pci_dev(dev); 307 struct pci_dev * pci_dev = to_pci_dev(dev);
305 struct pci_driver * drv = pci_dev->driver; 308 struct pci_driver * drv = pci_dev->driver;
306 309
307 if (drv && drv->resume) 310 if (drv && drv->resume)
308 drv->resume(pci_dev); 311 error = drv->resume(pci_dev);
309 else 312 else
310 pci_default_resume(pci_dev); 313 error = pci_default_resume(pci_dev);
311 return 0; 314 return error;
312} 315}
313 316
314static void pci_device_shutdown(struct device *dev) 317static void pci_device_shutdown(struct device *dev)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8d107c6c2c70..fde41cc14734 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -460,9 +460,23 @@ int
460pci_restore_state(struct pci_dev *dev) 460pci_restore_state(struct pci_dev *dev)
461{ 461{
462 int i; 462 int i;
463 int val;
463 464
464 for (i = 0; i < 16; i++) 465 /*
465 pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); 466 * The Base Address register should be programmed before the command
467 * register(s)
468 */
469 for (i = 15; i >= 0; i--) {
470 pci_read_config_dword(dev, i * 4, &val);
471 if (val != dev->saved_config_space[i]) {
472 printk(KERN_DEBUG "PM: Writing back config space on "
473 "device %s at offset %x (was %x, writing %x)\n",
474 pci_name(dev), i,
475 val, (int)dev->saved_config_space[i]);
476 pci_write_config_dword(dev,i * 4,
477 dev->saved_config_space[i]);
478 }
479 }
466 pci_restore_msi_state(dev); 480 pci_restore_msi_state(dev);
467 pci_restore_msix_state(dev); 481 pci_restore_msix_state(dev);
468 return 0; 482 return 0;
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index b046ffa22101..de9ba7890b5a 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -4297,6 +4297,7 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev)
4297int ata_device_resume(struct ata_port *ap, struct ata_device *dev) 4297int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
4298{ 4298{
4299 if (ap->flags & ATA_FLAG_SUSPENDED) { 4299 if (ap->flags & ATA_FLAG_SUSPENDED) {
4300 ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
4300 ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 200000); 4301 ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 200000);
4301 ap->flags &= ~ATA_FLAG_SUSPENDED; 4302 ap->flags &= ~ATA_FLAG_SUSPENDED;
4302 ata_set_mode(ap); 4303 ata_set_mode(ap);
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 9b8bca1ac1f0..f16f92a6ec0f 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -2035,6 +2035,7 @@ static void mv_phy_reset(struct ata_port *ap)
2035static void mv_eng_timeout(struct ata_port *ap) 2035static void mv_eng_timeout(struct ata_port *ap)
2036{ 2036{
2037 struct ata_queued_cmd *qc; 2037 struct ata_queued_cmd *qc;
2038 unsigned long flags;
2038 2039
2039 printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); 2040 printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id);
2040 DPRINTK("All regs @ start of eng_timeout\n"); 2041 DPRINTK("All regs @ start of eng_timeout\n");
@@ -2046,8 +2047,10 @@ static void mv_eng_timeout(struct ata_port *ap)
2046 ap->host_set->mmio_base, ap, qc, qc->scsicmd, 2047 ap->host_set->mmio_base, ap, qc, qc->scsicmd,
2047 &qc->scsicmd->cmnd); 2048 &qc->scsicmd->cmnd);
2048 2049
2050 spin_lock_irqsave(&ap->host_set->lock, flags);
2049 mv_err_intr(ap, 0); 2051 mv_err_intr(ap, 0);
2050 mv_stop_and_reset(ap); 2052 mv_stop_and_reset(ap);
2053 spin_unlock_irqrestore(&ap->host_set->lock, flags);
2051 2054
2052 WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE)); 2055 WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE));
2053 if (qc->flags & ATA_QCFLAG_ACTIVE) { 2056 if (qc->flags & ATA_QCFLAG_ACTIVE) {
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index acde8868da21..fafe7c1265b3 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -185,6 +185,9 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
185 /* Select Power Management Mode */ 185 /* Select Power Management Mode */
186 pxa27x_ohci_select_pmm(inf->port_mode); 186 pxa27x_ohci_select_pmm(inf->port_mode);
187 187
188 if (inf->power_budget)
189 hcd->power_budget = inf->power_budget;
190
188 ohci_hcd_init(hcd_to_ohci(hcd)); 191 ohci_hcd_init(hcd_to_ohci(hcd));
189 192
190 retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); 193 retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4587087d777a..5641498725d0 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -743,7 +743,7 @@ config FB_I810_I2C
743 743
744config FB_INTEL 744config FB_INTEL
745 tristate "Intel 830M/845G/852GM/855GM/865G support (EXPERIMENTAL)" 745 tristate "Intel 830M/845G/852GM/855GM/865G support (EXPERIMENTAL)"
746 depends on FB && EXPERIMENTAL && PCI && X86_32 746 depends on FB && EXPERIMENTAL && PCI && X86
747 select AGP 747 select AGP
748 select AGP_INTEL 748 select AGP_INTEL
749 select FB_MODE_HELPERS 749 select FB_MODE_HELPERS
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 953eb8c171d6..47ba1a79adcd 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -1745,7 +1745,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
1745 fbcon_redraw_move(vc, p, 0, t, count); 1745 fbcon_redraw_move(vc, p, 0, t, count);
1746 ypan_up_redraw(vc, t, count); 1746 ypan_up_redraw(vc, t, count);
1747 if (vc->vc_rows - b > 0) 1747 if (vc->vc_rows - b > 0)
1748 fbcon_redraw_move(vc, p, b - count, 1748 fbcon_redraw_move(vc, p, b,
1749 vc->vc_rows - b, b); 1749 vc->vc_rows - b, b);
1750 } else 1750 } else
1751 fbcon_redraw_move(vc, p, t + count, b - t - count, t); 1751 fbcon_redraw_move(vc, p, t + count, b - t - count, t);
diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/intelfb/intelfb.h
index da29d007f215..469b06c29180 100644
--- a/drivers/video/intelfb/intelfb.h
+++ b/drivers/video/intelfb/intelfb.h
@@ -8,9 +8,9 @@
8 8
9 9
10/*** Version/name ***/ 10/*** Version/name ***/
11#define INTELFB_VERSION "0.9.2" 11#define INTELFB_VERSION "0.9.4"
12#define INTELFB_MODULE_NAME "intelfb" 12#define INTELFB_MODULE_NAME "intelfb"
13#define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM" 13#define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM"
14 14
15 15
16/*** Debug/feature defines ***/ 16/*** Debug/feature defines ***/
@@ -52,11 +52,14 @@
52#define PCI_DEVICE_ID_INTEL_865G 0x2572 52#define PCI_DEVICE_ID_INTEL_865G 0x2572
53#define PCI_DEVICE_ID_INTEL_915G 0x2582 53#define PCI_DEVICE_ID_INTEL_915G 0x2582
54#define PCI_DEVICE_ID_INTEL_915GM 0x2592 54#define PCI_DEVICE_ID_INTEL_915GM 0x2592
55#define PCI_DEVICE_ID_INTEL_945G 0x2772
56#define PCI_DEVICE_ID_INTEL_945GM 0x27A2
55 57
56/* Size of MMIO region */ 58/* Size of MMIO region */
57#define INTEL_REG_SIZE 0x80000 59#define INTEL_REG_SIZE 0x80000
58 60
59#define STRIDE_ALIGNMENT 16 61#define STRIDE_ALIGNMENT 16
62#define STRIDE_ALIGNMENT_I9XX 64
60 63
61#define PALETTE_8_ENTRIES 256 64#define PALETTE_8_ENTRIES 256
62 65
@@ -125,7 +128,9 @@ enum intel_chips {
125 INTEL_855GME, 128 INTEL_855GME,
126 INTEL_865G, 129 INTEL_865G,
127 INTEL_915G, 130 INTEL_915G,
128 INTEL_915GM 131 INTEL_915GM,
132 INTEL_945G,
133 INTEL_945GM,
129}; 134};
130 135
131struct intelfb_hwstate { 136struct intelfb_hwstate {
@@ -277,8 +282,13 @@ struct intelfb_info {
277 282
278 /* driver registered */ 283 /* driver registered */
279 int registered; 284 int registered;
285
286 /* index into plls */
287 int pll_index;
280}; 288};
281 289
290#define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G)||(dinfo->chipset == INTEL_915GM)||((dinfo)->chipset == INTEL_945G)||(dinfo->chipset==INTEL_945GM))
291
282/*** function prototypes ***/ 292/*** function prototypes ***/
283 293
284extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var); 294extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var);
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 995b47c165a7..076fa56be192 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -1,11 +1,12 @@
1/* 1/*
2 * intelfb 2 * intelfb
3 * 3 *
4 * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM 4 * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/
5 * integrated graphics chips. 5 * 945G/945GM integrated graphics chips.
6 * 6 *
7 * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org> 7 * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org>
8 * 2004 Sylvain Meyer 8 * 2004 Sylvain Meyer
9 * 2006 David Airlie
9 * 10 *
10 * This driver consists of two parts. The first part (intelfbdrv.c) provides 11 * This driver consists of two parts. The first part (intelfbdrv.c) provides
11 * the basic fbdev interfaces, is derived in part from the radeonfb and 12 * the basic fbdev interfaces, is derived in part from the radeonfb and
@@ -131,6 +132,7 @@
131 132
132#include "intelfb.h" 133#include "intelfb.h"
133#include "intelfbhw.h" 134#include "intelfbhw.h"
135#include "../edid.h"
134 136
135static void __devinit get_initial_mode(struct intelfb_info *dinfo); 137static void __devinit get_initial_mode(struct intelfb_info *dinfo);
136static void update_dinfo(struct intelfb_info *dinfo, 138static void update_dinfo(struct intelfb_info *dinfo,
@@ -182,6 +184,8 @@ static struct pci_device_id intelfb_pci_table[] __devinitdata = {
182 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_865G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_865G }, 184 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_865G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_865G },
183 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915G }, 185 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915G },
184 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915GM }, 186 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915GM },
187 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945G },
188 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945GM },
185 { 0, } 189 { 0, }
186}; 190};
187 191
@@ -261,7 +265,7 @@ MODULE_PARM_DESC(mode,
261 265
262#ifndef MODULE 266#ifndef MODULE
263#define OPT_EQUAL(opt, name) (!strncmp(opt, name, strlen(name))) 267#define OPT_EQUAL(opt, name) (!strncmp(opt, name, strlen(name)))
264#define OPT_INTVAL(opt, name) simple_strtoul(opt + strlen(name), NULL, 0) 268#define OPT_INTVAL(opt, name) simple_strtoul(opt + strlen(name) + 1, NULL, 0)
265#define OPT_STRVAL(opt, name) (opt + strlen(name)) 269#define OPT_STRVAL(opt, name) (opt + strlen(name))
266 270
267static __inline__ char * 271static __inline__ char *
@@ -546,11 +550,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
546 550
547 /* Set base addresses. */ 551 /* Set base addresses. */
548 if ((ent->device == PCI_DEVICE_ID_INTEL_915G) || 552 if ((ent->device == PCI_DEVICE_ID_INTEL_915G) ||
549 (ent->device == PCI_DEVICE_ID_INTEL_915GM)) { 553 (ent->device == PCI_DEVICE_ID_INTEL_915GM) ||
554 (ent->device == PCI_DEVICE_ID_INTEL_945G) ||
555 (ent->device == PCI_DEVICE_ID_INTEL_945GM)) {
550 aperture_bar = 2; 556 aperture_bar = 2;
551 mmio_bar = 0; 557 mmio_bar = 0;
552 /* Disable HW cursor on 915G/M (not implemented yet) */
553 hwcursor = 0;
554 } 558 }
555 dinfo->aperture.physical = pci_resource_start(pdev, aperture_bar); 559 dinfo->aperture.physical = pci_resource_start(pdev, aperture_bar);
556 dinfo->aperture.size = pci_resource_len(pdev, aperture_bar); 560 dinfo->aperture.size = pci_resource_len(pdev, aperture_bar);
@@ -584,8 +588,7 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
584 /* Get the chipset info. */ 588 /* Get the chipset info. */
585 dinfo->pci_chipset = pdev->device; 589 dinfo->pci_chipset = pdev->device;
586 590
587 if (intelfbhw_get_chipset(pdev, &dinfo->name, &dinfo->chipset, 591 if (intelfbhw_get_chipset(pdev, dinfo)) {
588 &dinfo->mobile)) {
589 cleanup(dinfo); 592 cleanup(dinfo);
590 return -ENODEV; 593 return -ENODEV;
591 } 594 }
@@ -1029,17 +1032,44 @@ intelfb_init_var(struct intelfb_info *dinfo)
1029 sizeof(struct fb_var_screeninfo)); 1032 sizeof(struct fb_var_screeninfo));
1030 msrc = 5; 1033 msrc = 5;
1031 } else { 1034 } else {
1035 const u8 *edid_s = fb_firmware_edid(&dinfo->pdev->dev);
1036 u8 *edid_d = NULL;
1037
1038 if (edid_s) {
1039 edid_d = kmalloc(EDID_LENGTH, GFP_KERNEL);
1040
1041 if (edid_d) {
1042 memcpy(edid_d, edid_s, EDID_LENGTH);
1043 fb_edid_to_monspecs(edid_d,
1044 &dinfo->info->monspecs);
1045 kfree(edid_d);
1046 }
1047 }
1048
1032 if (mode) { 1049 if (mode) {
1050 printk("intelfb: Looking for mode in private "
1051 "database\n");
1033 msrc = fb_find_mode(var, dinfo->info, mode, 1052 msrc = fb_find_mode(var, dinfo->info, mode,
1034 vesa_modes, VESA_MODEDB_SIZE, 1053 dinfo->info->monspecs.modedb,
1054 dinfo->info->monspecs.modedb_len,
1035 NULL, 0); 1055 NULL, 0);
1036 if (msrc) 1056
1037 msrc |= 8; 1057 if (msrc && msrc > 1) {
1058 printk("intelfb: No mode in private database, "
1059 "intelfb: looking for mode in global "
1060 "database ");
1061 msrc = fb_find_mode(var, dinfo->info, mode,
1062 NULL, 0, NULL, 0);
1063
1064 if (msrc)
1065 msrc |= 8;
1066 }
1067
1038 } 1068 }
1069
1039 if (!msrc) { 1070 if (!msrc) {
1040 msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE, 1071 msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE,
1041 vesa_modes, VESA_MODEDB_SIZE, 1072 NULL, 0, NULL, 0);
1042 NULL, 0);
1043 } 1073 }
1044 } 1074 }
1045 1075
@@ -1139,7 +1169,10 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
1139 } 1169 }
1140 1170
1141 /* Make sure the line length is a aligned correctly. */ 1171 /* Make sure the line length is a aligned correctly. */
1142 dinfo->pitch = ROUND_UP_TO(dinfo->pitch, STRIDE_ALIGNMENT); 1172 if (IS_I9XX(dinfo))
1173 dinfo->pitch = ROUND_UP_TO(dinfo->pitch, STRIDE_ALIGNMENT_I9XX);
1174 else
1175 dinfo->pitch = ROUND_UP_TO(dinfo->pitch, STRIDE_ALIGNMENT);
1143 1176
1144 if (FIXED_MODE(dinfo)) 1177 if (FIXED_MODE(dinfo))
1145 dinfo->pitch = dinfo->initial_pitch; 1178 dinfo->pitch = dinfo->initial_pitch;
@@ -1162,16 +1195,33 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1162 struct fb_var_screeninfo v; 1195 struct fb_var_screeninfo v;
1163 struct intelfb_info *dinfo; 1196 struct intelfb_info *dinfo;
1164 static int first = 1; 1197 static int first = 1;
1198 int i;
1199 /* Good pitches to allow tiling. Don't care about pitches < 1024. */
1200 static const int pitches[] = {
1201 128 * 8,
1202 128 * 16,
1203 128 * 32,
1204 128 * 64,
1205 0
1206 };
1165 1207
1166 DBG_MSG("intelfb_check_var: accel_flags is %d\n", var->accel_flags); 1208 DBG_MSG("intelfb_check_var: accel_flags is %d\n", var->accel_flags);
1167 1209
1168 dinfo = GET_DINFO(info); 1210 dinfo = GET_DINFO(info);
1169 1211
1212 /* update the pitch */
1170 if (intelfbhw_validate_mode(dinfo, var) != 0) 1213 if (intelfbhw_validate_mode(dinfo, var) != 0)
1171 return -EINVAL; 1214 return -EINVAL;
1172 1215
1173 v = *var; 1216 v = *var;
1174 1217
1218 for (i = 0; pitches[i] != 0; i++) {
1219 if (pitches[i] >= v.xres_virtual) {
1220 v.xres_virtual = pitches[i];
1221 break;
1222 }
1223 }
1224
1175 /* Check for a supported bpp. */ 1225 /* Check for a supported bpp. */
1176 if (v.bits_per_pixel <= 8) { 1226 if (v.bits_per_pixel <= 8) {
1177 v.bits_per_pixel = 8; 1227 v.bits_per_pixel = 8;
@@ -1467,7 +1517,7 @@ static int
1467intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor) 1517intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1468{ 1518{
1469 struct intelfb_info *dinfo = GET_DINFO(info); 1519 struct intelfb_info *dinfo = GET_DINFO(info);
1470 1520 u32 physical;
1471#if VERBOSE > 0 1521#if VERBOSE > 0
1472 DBG_MSG("intelfb_cursor\n"); 1522 DBG_MSG("intelfb_cursor\n");
1473#endif 1523#endif
@@ -1478,7 +1528,10 @@ intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1478 intelfbhw_cursor_hide(dinfo); 1528 intelfbhw_cursor_hide(dinfo);
1479 1529
1480 /* If XFree killed the cursor - restore it */ 1530 /* If XFree killed the cursor - restore it */
1481 if (INREG(CURSOR_A_BASEADDR) != dinfo->cursor.offset << 12) { 1531 physical = (dinfo->mobile || IS_I9XX(dinfo)) ? dinfo->cursor.physical :
1532 (dinfo->cursor.offset << 12);
1533
1534 if (INREG(CURSOR_A_BASEADDR) != physical) {
1482 u32 fg, bg; 1535 u32 fg, bg;
1483 1536
1484 DBG_MSG("the cursor was killed - restore it !!\n"); 1537 DBG_MSG("the cursor was killed - restore it !!\n");
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index 624c4bc96f0d..426b7430b125 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -40,68 +40,110 @@
40#include "intelfb.h" 40#include "intelfb.h"
41#include "intelfbhw.h" 41#include "intelfbhw.h"
42 42
43struct pll_min_max {
44 int min_m, max_m, min_m1, max_m1;
45 int min_m2, max_m2, min_n, max_n;
46 int min_p, max_p, min_p1, max_p1;
47 int min_vco, max_vco, p_transition_clk, ref_clk;
48 int p_inc_lo, p_inc_hi;
49};
50
51#define PLLS_I8xx 0
52#define PLLS_I9xx 1
53#define PLLS_MAX 2
54
55static struct pll_min_max plls[PLLS_MAX] = {
56 { 108, 140, 18, 26,
57 6, 16, 3, 16,
58 4, 128, 0, 31,
59 930000, 1400000, 165000, 48000,
60 4, 2 }, //I8xx
61
62 { 75, 120, 10, 20,
63 5, 9, 4, 7,
64 5, 80, 1, 8,
65 1400000, 2800000, 200000, 96000,
66 10, 5 } //I9xx
67};
68
43int 69int
44intelfbhw_get_chipset(struct pci_dev *pdev, const char **name, int *chipset, 70intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo)
45 int *mobile)
46{ 71{
47 u32 tmp; 72 u32 tmp;
48 73 if (!pdev || !dinfo)
49 if (!pdev || !name || !chipset || !mobile)
50 return 1; 74 return 1;
51 75
52 switch (pdev->device) { 76 switch (pdev->device) {
53 case PCI_DEVICE_ID_INTEL_830M: 77 case PCI_DEVICE_ID_INTEL_830M:
54 *name = "Intel(R) 830M"; 78 dinfo->name = "Intel(R) 830M";
55 *chipset = INTEL_830M; 79 dinfo->chipset = INTEL_830M;
56 *mobile = 1; 80 dinfo->mobile = 1;
81 dinfo->pll_index = PLLS_I8xx;
57 return 0; 82 return 0;
58 case PCI_DEVICE_ID_INTEL_845G: 83 case PCI_DEVICE_ID_INTEL_845G:
59 *name = "Intel(R) 845G"; 84 dinfo->name = "Intel(R) 845G";
60 *chipset = INTEL_845G; 85 dinfo->chipset = INTEL_845G;
61 *mobile = 0; 86 dinfo->mobile = 0;
87 dinfo->pll_index = PLLS_I8xx;
62 return 0; 88 return 0;
63 case PCI_DEVICE_ID_INTEL_85XGM: 89 case PCI_DEVICE_ID_INTEL_85XGM:
64 tmp = 0; 90 tmp = 0;
65 *mobile = 1; 91 dinfo->mobile = 1;
92 dinfo->pll_index = PLLS_I8xx;
66 pci_read_config_dword(pdev, INTEL_85X_CAPID, &tmp); 93 pci_read_config_dword(pdev, INTEL_85X_CAPID, &tmp);
67 switch ((tmp >> INTEL_85X_VARIANT_SHIFT) & 94 switch ((tmp >> INTEL_85X_VARIANT_SHIFT) &
68 INTEL_85X_VARIANT_MASK) { 95 INTEL_85X_VARIANT_MASK) {
69 case INTEL_VAR_855GME: 96 case INTEL_VAR_855GME:
70 *name = "Intel(R) 855GME"; 97 dinfo->name = "Intel(R) 855GME";
71 *chipset = INTEL_855GME; 98 dinfo->chipset = INTEL_855GME;
72 return 0; 99 return 0;
73 case INTEL_VAR_855GM: 100 case INTEL_VAR_855GM:
74 *name = "Intel(R) 855GM"; 101 dinfo->name = "Intel(R) 855GM";
75 *chipset = INTEL_855GM; 102 dinfo->chipset = INTEL_855GM;
76 return 0; 103 return 0;
77 case INTEL_VAR_852GME: 104 case INTEL_VAR_852GME:
78 *name = "Intel(R) 852GME"; 105 dinfo->name = "Intel(R) 852GME";
79 *chipset = INTEL_852GME; 106 dinfo->chipset = INTEL_852GME;
80 return 0; 107 return 0;
81 case INTEL_VAR_852GM: 108 case INTEL_VAR_852GM:
82 *name = "Intel(R) 852GM"; 109 dinfo->name = "Intel(R) 852GM";
83 *chipset = INTEL_852GM; 110 dinfo->chipset = INTEL_852GM;
84 return 0; 111 return 0;
85 default: 112 default:
86 *name = "Intel(R) 852GM/855GM"; 113 dinfo->name = "Intel(R) 852GM/855GM";
87 *chipset = INTEL_85XGM; 114 dinfo->chipset = INTEL_85XGM;
88 return 0; 115 return 0;
89 } 116 }
90 break; 117 break;
91 case PCI_DEVICE_ID_INTEL_865G: 118 case PCI_DEVICE_ID_INTEL_865G:
92 *name = "Intel(R) 865G"; 119 dinfo->name = "Intel(R) 865G";
93 *chipset = INTEL_865G; 120 dinfo->chipset = INTEL_865G;
94 *mobile = 0; 121 dinfo->mobile = 0;
122 dinfo->pll_index = PLLS_I8xx;
95 return 0; 123 return 0;
96 case PCI_DEVICE_ID_INTEL_915G: 124 case PCI_DEVICE_ID_INTEL_915G:
97 *name = "Intel(R) 915G"; 125 dinfo->name = "Intel(R) 915G";
98 *chipset = INTEL_915G; 126 dinfo->chipset = INTEL_915G;
99 *mobile = 0; 127 dinfo->mobile = 0;
128 dinfo->pll_index = PLLS_I9xx;
100 return 0; 129 return 0;
101 case PCI_DEVICE_ID_INTEL_915GM: 130 case PCI_DEVICE_ID_INTEL_915GM:
102 *name = "Intel(R) 915GM"; 131 dinfo->name = "Intel(R) 915GM";
103 *chipset = INTEL_915GM; 132 dinfo->chipset = INTEL_915GM;
104 *mobile = 1; 133 dinfo->mobile = 1;
134 dinfo->pll_index = PLLS_I9xx;
135 return 0;
136 case PCI_DEVICE_ID_INTEL_945G:
137 dinfo->name = "Intel(R) 945G";
138 dinfo->chipset = INTEL_945G;
139 dinfo->mobile = 0;
140 dinfo->pll_index = PLLS_I9xx;
141 return 0;
142 case PCI_DEVICE_ID_INTEL_945GM:
143 dinfo->name = "Intel(R) 945GM";
144 dinfo->chipset = INTEL_945GM;
145 dinfo->mobile = 1;
146 dinfo->pll_index = PLLS_I9xx;
105 return 0; 147 return 0;
106 default: 148 default:
107 return 1; 149 return 1;
@@ -114,6 +156,7 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
114{ 156{
115 struct pci_dev *bridge_dev; 157 struct pci_dev *bridge_dev;
116 u16 tmp; 158 u16 tmp;
159 int stolen_overhead;
117 160
118 if (!pdev || !aperture_size || !stolen_size) 161 if (!pdev || !aperture_size || !stolen_size)
119 return 1; 162 return 1;
@@ -128,21 +171,41 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
128 tmp = 0; 171 tmp = 0;
129 pci_read_config_word(bridge_dev, INTEL_GMCH_CTRL, &tmp); 172 pci_read_config_word(bridge_dev, INTEL_GMCH_CTRL, &tmp);
130 switch (pdev->device) { 173 switch (pdev->device) {
131 case PCI_DEVICE_ID_INTEL_830M: 174 case PCI_DEVICE_ID_INTEL_915G:
132 case PCI_DEVICE_ID_INTEL_845G: 175 case PCI_DEVICE_ID_INTEL_915GM:
176 case PCI_DEVICE_ID_INTEL_945G:
177 case PCI_DEVICE_ID_INTEL_945GM:
178 /* 915 and 945 chipsets support a 256MB aperture.
179 Aperture size is determined by inspected the
180 base address of the aperture. */
181 if (pci_resource_start(pdev, 2) & 0x08000000)
182 *aperture_size = MB(128);
183 else
184 *aperture_size = MB(256);
185 break;
186 default:
133 if ((tmp & INTEL_GMCH_MEM_MASK) == INTEL_GMCH_MEM_64M) 187 if ((tmp & INTEL_GMCH_MEM_MASK) == INTEL_GMCH_MEM_64M)
134 *aperture_size = MB(64); 188 *aperture_size = MB(64);
135 else 189 else
136 *aperture_size = MB(128); 190 *aperture_size = MB(128);
191 break;
192 }
193
194 /* Stolen memory size is reduced by the GTT and the popup.
195 GTT is 1K per MB of aperture size, and popup is 4K. */
196 stolen_overhead = (*aperture_size / MB(1)) + 4;
197 switch(pdev->device) {
198 case PCI_DEVICE_ID_INTEL_830M:
199 case PCI_DEVICE_ID_INTEL_845G:
137 switch (tmp & INTEL_830_GMCH_GMS_MASK) { 200 switch (tmp & INTEL_830_GMCH_GMS_MASK) {
138 case INTEL_830_GMCH_GMS_STOLEN_512: 201 case INTEL_830_GMCH_GMS_STOLEN_512:
139 *stolen_size = KB(512) - KB(132); 202 *stolen_size = KB(512) - KB(stolen_overhead);
140 return 0; 203 return 0;
141 case INTEL_830_GMCH_GMS_STOLEN_1024: 204 case INTEL_830_GMCH_GMS_STOLEN_1024:
142 *stolen_size = MB(1) - KB(132); 205 *stolen_size = MB(1) - KB(stolen_overhead);
143 return 0; 206 return 0;
144 case INTEL_830_GMCH_GMS_STOLEN_8192: 207 case INTEL_830_GMCH_GMS_STOLEN_8192:
145 *stolen_size = MB(8) - KB(132); 208 *stolen_size = MB(8) - KB(stolen_overhead);
146 return 0; 209 return 0;
147 case INTEL_830_GMCH_GMS_LOCAL: 210 case INTEL_830_GMCH_GMS_LOCAL:
148 ERR_MSG("only local memory found\n"); 211 ERR_MSG("only local memory found\n");
@@ -157,28 +220,27 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
157 } 220 }
158 break; 221 break;
159 default: 222 default:
160 *aperture_size = MB(128);
161 switch (tmp & INTEL_855_GMCH_GMS_MASK) { 223 switch (tmp & INTEL_855_GMCH_GMS_MASK) {
162 case INTEL_855_GMCH_GMS_STOLEN_1M: 224 case INTEL_855_GMCH_GMS_STOLEN_1M:
163 *stolen_size = MB(1) - KB(132); 225 *stolen_size = MB(1) - KB(stolen_overhead);
164 return 0; 226 return 0;
165 case INTEL_855_GMCH_GMS_STOLEN_4M: 227 case INTEL_855_GMCH_GMS_STOLEN_4M:
166 *stolen_size = MB(4) - KB(132); 228 *stolen_size = MB(4) - KB(stolen_overhead);
167 return 0; 229 return 0;
168 case INTEL_855_GMCH_GMS_STOLEN_8M: 230 case INTEL_855_GMCH_GMS_STOLEN_8M:
169 *stolen_size = MB(8) - KB(132); 231 *stolen_size = MB(8) - KB(stolen_overhead);
170 return 0; 232 return 0;
171 case INTEL_855_GMCH_GMS_STOLEN_16M: 233 case INTEL_855_GMCH_GMS_STOLEN_16M:
172 *stolen_size = MB(16) - KB(132); 234 *stolen_size = MB(16) - KB(stolen_overhead);
173 return 0; 235 return 0;
174 case INTEL_855_GMCH_GMS_STOLEN_32M: 236 case INTEL_855_GMCH_GMS_STOLEN_32M:
175 *stolen_size = MB(32) - KB(132); 237 *stolen_size = MB(32) - KB(stolen_overhead);
176 return 0; 238 return 0;
177 case INTEL_915G_GMCH_GMS_STOLEN_48M: 239 case INTEL_915G_GMCH_GMS_STOLEN_48M:
178 *stolen_size = MB(48) - KB(132); 240 *stolen_size = MB(48) - KB(stolen_overhead);
179 return 0; 241 return 0;
180 case INTEL_915G_GMCH_GMS_STOLEN_64M: 242 case INTEL_915G_GMCH_GMS_STOLEN_64M:
181 *stolen_size = MB(64) - KB(132); 243 *stolen_size = MB(64) - KB(stolen_overhead);
182 return 0; 244 return 0;
183 case INTEL_855_GMCH_GMS_DISABLED: 245 case INTEL_855_GMCH_GMS_DISABLED:
184 ERR_MSG("video memory is disabled\n"); 246 ERR_MSG("video memory is disabled\n");
@@ -529,12 +591,63 @@ intelfbhw_read_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
529} 591}
530 592
531 593
594static int calc_vclock3(int index, int m, int n, int p)
595{
596 if (p == 0 || n == 0)
597 return 0;
598 return plls[index].ref_clk * m / n / p;
599}
600
601static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2, int lvds)
602{
603 struct pll_min_max *pll = &plls[index];
604 u32 m, vco, p;
605
606 m = (5 * (m1 + 2)) + (m2 + 2);
607 n += 2;
608 vco = pll->ref_clk * m / n;
609
610 if (index == PLLS_I8xx) {
611 p = ((p1 + 2) * (1 << (p2 + 1)));
612 } else {
613 p = ((p1) * (p2 ? 5 : 10));
614 }
615 return vco / p;
616}
617
618static void
619intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2)
620{
621 int p1, p2;
622
623 if (IS_I9XX(dinfo)) {
624 if (dpll & DPLL_P1_FORCE_DIV2)
625 p1 = 1;
626 else
627 p1 = (dpll >> DPLL_P1_SHIFT) & 0xff;
628
629 p1 = ffs(p1);
630
631 p2 = (dpll >> DPLL_I9XX_P2_SHIFT) & DPLL_P2_MASK;
632 } else {
633 if (dpll & DPLL_P1_FORCE_DIV2)
634 p1 = 0;
635 else
636 p1 = (dpll >> DPLL_P1_SHIFT) & DPLL_P1_MASK;
637 p2 = (dpll >> DPLL_P2_SHIFT) & DPLL_P2_MASK;
638 }
639
640 *o_p1 = p1;
641 *o_p2 = p2;
642}
643
644
532void 645void
533intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) 646intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
534{ 647{
535#if REGDUMP 648#if REGDUMP
536 int i, m1, m2, n, p1, p2; 649 int i, m1, m2, n, p1, p2;
537 650 int index = dinfo->pll_index;
538 DBG_MSG("intelfbhw_print_hw_state\n"); 651 DBG_MSG("intelfbhw_print_hw_state\n");
539 652
540 if (!hw || !dinfo) 653 if (!hw || !dinfo)
@@ -547,26 +660,22 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
547 n = (hw->vga0_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 660 n = (hw->vga0_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
548 m1 = (hw->vga0_divisor >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 661 m1 = (hw->vga0_divisor >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
549 m2 = (hw->vga0_divisor >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 662 m2 = (hw->vga0_divisor >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
550 if (hw->vga_pd & VGAPD_0_P1_FORCE_DIV2) 663
551 p1 = 0; 664 intelfbhw_get_p1p2(dinfo, hw->vga_pd, &p1, &p2);
552 else 665
553 p1 = (hw->vga_pd >> VGAPD_0_P1_SHIFT) & DPLL_P1_MASK;
554 p2 = (hw->vga_pd >> VGAPD_0_P2_SHIFT) & DPLL_P2_MASK;
555 printk(" VGA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", 666 printk(" VGA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n",
556 m1, m2, n, p1, p2); 667 m1, m2, n, p1, p2);
557 printk(" VGA0: clock is %d\n", CALC_VCLOCK(m1, m2, n, p1, p2)); 668 printk(" VGA0: clock is %d\n",
669 calc_vclock(index, m1, m2, n, p1, p2, 0));
558 670
559 n = (hw->vga1_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 671 n = (hw->vga1_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
560 m1 = (hw->vga1_divisor >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 672 m1 = (hw->vga1_divisor >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
561 m2 = (hw->vga1_divisor >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 673 m2 = (hw->vga1_divisor >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
562 if (hw->vga_pd & VGAPD_1_P1_FORCE_DIV2) 674
563 p1 = 0; 675 intelfbhw_get_p1p2(dinfo, hw->vga_pd, &p1, &p2);
564 else
565 p1 = (hw->vga_pd >> VGAPD_1_P1_SHIFT) & DPLL_P1_MASK;
566 p2 = (hw->vga_pd >> VGAPD_1_P2_SHIFT) & DPLL_P2_MASK;
567 printk(" VGA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", 676 printk(" VGA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n",
568 m1, m2, n, p1, p2); 677 m1, m2, n, p1, p2);
569 printk(" VGA1: clock is %d\n", CALC_VCLOCK(m1, m2, n, p1, p2)); 678 printk(" VGA1: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0));
570 679
571 printk(" DPLL_A: 0x%08x\n", hw->dpll_a); 680 printk(" DPLL_A: 0x%08x\n", hw->dpll_a);
572 printk(" DPLL_B: 0x%08x\n", hw->dpll_b); 681 printk(" DPLL_B: 0x%08x\n", hw->dpll_b);
@@ -578,34 +687,30 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
578 n = (hw->fpa0 >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 687 n = (hw->fpa0 >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
579 m1 = (hw->fpa0 >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 688 m1 = (hw->fpa0 >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
580 m2 = (hw->fpa0 >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 689 m2 = (hw->fpa0 >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
581 if (hw->dpll_a & DPLL_P1_FORCE_DIV2) 690
582 p1 = 0; 691 intelfbhw_get_p1p2(dinfo, hw->dpll_a, &p1, &p2);
583 else 692
584 p1 = (hw->dpll_a >> DPLL_P1_SHIFT) & DPLL_P1_MASK;
585 p2 = (hw->dpll_a >> DPLL_P2_SHIFT) & DPLL_P2_MASK;
586 printk(" PLLA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", 693 printk(" PLLA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n",
587 m1, m2, n, p1, p2); 694 m1, m2, n, p1, p2);
588 printk(" PLLA0: clock is %d\n", CALC_VCLOCK(m1, m2, n, p1, p2)); 695 printk(" PLLA0: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0));
589 696
590 n = (hw->fpa1 >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 697 n = (hw->fpa1 >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
591 m1 = (hw->fpa1 >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 698 m1 = (hw->fpa1 >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
592 m2 = (hw->fpa1 >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 699 m2 = (hw->fpa1 >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
593 if (hw->dpll_a & DPLL_P1_FORCE_DIV2) 700
594 p1 = 0; 701 intelfbhw_get_p1p2(dinfo, hw->dpll_a, &p1, &p2);
595 else 702
596 p1 = (hw->dpll_a >> DPLL_P1_SHIFT) & DPLL_P1_MASK;
597 p2 = (hw->dpll_a >> DPLL_P2_SHIFT) & DPLL_P2_MASK;
598 printk(" PLLA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", 703 printk(" PLLA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n",
599 m1, m2, n, p1, p2); 704 m1, m2, n, p1, p2);
600 printk(" PLLA1: clock is %d\n", CALC_VCLOCK(m1, m2, n, p1, p2)); 705 printk(" PLLA1: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0));
601 706
602#if 0 707#if 0
603 printk(" PALETTE_A:\n"); 708 printk(" PALETTE_A:\n");
604 for (i = 0; i < PALETTE_8_ENTRIES) 709 for (i = 0; i < PALETTE_8_ENTRIES)
605 printk(" %3d: 0x%08x\n", i, hw->palette_a[i]; 710 printk(" %3d: 0x%08x\n", i, hw->palette_a[i]);
606 printk(" PALETTE_B:\n"); 711 printk(" PALETTE_B:\n");
607 for (i = 0; i < PALETTE_8_ENTRIES) 712 for (i = 0; i < PALETTE_8_ENTRIES)
608 printk(" %3d: 0x%08x\n", i, hw->palette_b[i]; 713 printk(" %3d: 0x%08x\n", i, hw->palette_b[i]);
609#endif 714#endif
610 715
611 printk(" HTOTAL_A: 0x%08x\n", hw->htotal_a); 716 printk(" HTOTAL_A: 0x%08x\n", hw->htotal_a);
@@ -680,11 +785,11 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
680 } 785 }
681 for (i = 0; i < 3; i++) { 786 for (i = 0; i < 3; i++) {
682 printk(" SWF3%d 0x%08x\n", i, 787 printk(" SWF3%d 0x%08x\n", i,
683 hw->swf3x[i]); 788 hw->swf3x[i]);
684 } 789 }
685 for (i = 0; i < 8; i++) 790 for (i = 0; i < 8; i++)
686 printk(" FENCE%d 0x%08x\n", i, 791 printk(" FENCE%d 0x%08x\n", i,
687 hw->fence[i]); 792 hw->fence[i]);
688 793
689 printk(" INSTPM 0x%08x\n", hw->instpm); 794 printk(" INSTPM 0x%08x\n", hw->instpm);
690 printk(" MEM_MODE 0x%08x\n", hw->mem_mode); 795 printk(" MEM_MODE 0x%08x\n", hw->mem_mode);
@@ -695,43 +800,58 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
695#endif 800#endif
696} 801}
697 802
803
804
698/* Split the M parameter into M1 and M2. */ 805/* Split the M parameter into M1 and M2. */
699static int 806static int
700splitm(unsigned int m, unsigned int *retm1, unsigned int *retm2) 807splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2)
701{ 808{
702 int m1, m2; 809 int m1, m2;
703 810 int testm;
704 m1 = (m - 2 - (MIN_M2 + MAX_M2) / 2) / 5 - 2; 811 struct pll_min_max *pll = &plls[index];
705 if (m1 < MIN_M1) 812
706 m1 = MIN_M1; 813 /* no point optimising too much - brute force m */
707 if (m1 > MAX_M1) 814 for (m1 = pll->min_m1; m1 < pll->max_m1 + 1; m1++) {
708 m1 = MAX_M1; 815 for (m2 = pll->min_m2; m2 < pll->max_m2 + 1; m2++) {
709 m2 = m - 5 * (m1 + 2) - 2; 816 testm = (5 * (m1 + 2)) + (m2 + 2);
710 if (m2 < MIN_M2 || m2 > MAX_M2 || m2 >= m1) { 817 if (testm == m) {
711 return 1; 818 *retm1 = (unsigned int)m1;
712 } else { 819 *retm2 = (unsigned int)m2;
713 *retm1 = (unsigned int)m1; 820 return 0;
714 *retm2 = (unsigned int)m2; 821 }
715 return 0; 822 }
716 } 823 }
824 return 1;
717} 825}
718 826
719/* Split the P parameter into P1 and P2. */ 827/* Split the P parameter into P1 and P2. */
720static int 828static int
721splitp(unsigned int p, unsigned int *retp1, unsigned int *retp2) 829splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2)
722{ 830{
723 int p1, p2; 831 int p1, p2;
832 struct pll_min_max *pll = &plls[index];
833
834 if (index == PLLS_I9xx) {
835 p2 = (p % 10) ? 1 : 0;
836
837 p1 = p / (p2 ? 5 : 10);
838
839 *retp1 = (unsigned int)p1;
840 *retp2 = (unsigned int)p2;
841 return 0;
842 }
724 843
725 if (p % 4 == 0) 844 if (p % 4 == 0)
726 p2 = 1; 845 p2 = 1;
727 else 846 else
728 p2 = 0; 847 p2 = 0;
729 p1 = (p / (1 << (p2 + 1))) - 2; 848 p1 = (p / (1 << (p2 + 1))) - 2;
730 if (p % 4 == 0 && p1 < MIN_P1) { 849 if (p % 4 == 0 && p1 < pll->min_p1) {
731 p2 = 0; 850 p2 = 0;
732 p1 = (p / (1 << (p2 + 1))) - 2; 851 p1 = (p / (1 << (p2 + 1))) - 2;
733 } 852 }
734 if (p1 < MIN_P1 || p1 > MAX_P1 || (p1 + 2) * (1 << (p2 + 1)) != p) { 853 if (p1 < pll->min_p1 || p1 > pll->max_p1 ||
854 (p1 + 2) * (1 << (p2 + 1)) != p) {
735 return 1; 855 return 1;
736 } else { 856 } else {
737 *retp1 = (unsigned int)p1; 857 *retp1 = (unsigned int)p1;
@@ -741,14 +861,15 @@ splitp(unsigned int p, unsigned int *retp1, unsigned int *retp2)
741} 861}
742 862
743static int 863static int
744calc_pll_params(int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *retp1, 864calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *retp1,
745 u32 *retp2, u32 *retclock) 865 u32 *retp2, u32 *retclock)
746{ 866{
747 u32 m1, m2, n, p1, p2, n1; 867 u32 m1, m2, n, p1, p2, n1, testm;
748 u32 f_vco, p, p_best = 0, m, f_out; 868 u32 f_vco, p, p_best = 0, m, f_out = 0;
749 u32 err_max, err_target, err_best = 10000000; 869 u32 err_max, err_target, err_best = 10000000;
750 u32 n_best = 0, m_best = 0, f_best, f_err; 870 u32 n_best = 0, m_best = 0, f_best, f_err;
751 u32 p_min, p_max, p_inc, div_min, div_max; 871 u32 p_min, p_max, p_inc, div_max;
872 struct pll_min_max *pll = &plls[index];
752 873
753 /* Accept 0.5% difference, but aim for 0.1% */ 874 /* Accept 0.5% difference, but aim for 0.1% */
754 err_max = 5 * clock / 1000; 875 err_max = 5 * clock / 1000;
@@ -756,58 +877,56 @@ calc_pll_params(int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *retp1,
756 877
757 DBG_MSG("Clock is %d\n", clock); 878 DBG_MSG("Clock is %d\n", clock);
758 879
759 div_max = MAX_VCO_FREQ / clock; 880 div_max = pll->max_vco / clock;
760 div_min = ROUND_UP_TO(MIN_VCO_FREQ, clock) / clock;
761 881
762 if (clock <= P_TRANSITION_CLOCK) 882 p_inc = (clock <= pll->p_transition_clk) ? pll->p_inc_lo : pll->p_inc_hi;
763 p_inc = 4; 883 p_min = p_inc;
764 else
765 p_inc = 2;
766 p_min = ROUND_UP_TO(div_min, p_inc);
767 p_max = ROUND_DOWN_TO(div_max, p_inc); 884 p_max = ROUND_DOWN_TO(div_max, p_inc);
768 if (p_min < MIN_P) 885 if (p_min < pll->min_p)
769 p_min = 4; 886 p_min = pll->min_p;
770 if (p_max > MAX_P) 887 if (p_max > pll->max_p)
771 p_max = 128; 888 p_max = pll->max_p;
772 889
773 DBG_MSG("p range is %d-%d (%d)\n", p_min, p_max, p_inc); 890 DBG_MSG("p range is %d-%d (%d)\n", p_min, p_max, p_inc);
774 891
775 p = p_min; 892 p = p_min;
776 do { 893 do {
777 if (splitp(p, &p1, &p2)) { 894 if (splitp(index, p, &p1, &p2)) {
778 WRN_MSG("cannot split p = %d\n", p); 895 WRN_MSG("cannot split p = %d\n", p);
779 p += p_inc; 896 p += p_inc;
780 continue; 897 continue;
781 } 898 }
782 n = MIN_N; 899 n = pll->min_n;
783 f_vco = clock * p; 900 f_vco = clock * p;
784 901
785 do { 902 do {
786 m = ROUND_UP_TO(f_vco * n, PLL_REFCLK) / PLL_REFCLK; 903 m = ROUND_UP_TO(f_vco * n, pll->ref_clk) / pll->ref_clk;
787 if (m < MIN_M) 904 if (m < pll->min_m)
788 m = MIN_M; 905 m = pll->min_m + 1;
789 if (m > MAX_M) 906 if (m > pll->max_m)
790 m = MAX_M; 907 m = pll->max_m - 1;
791 f_out = CALC_VCLOCK3(m, n, p); 908 for (testm = m - 1; testm <= m; testm++) {
792 if (splitm(m, &m1, &m2)) { 909 f_out = calc_vclock3(index, m, n, p);
793 WRN_MSG("cannot split m = %d\n", m); 910 if (splitm(index, testm, &m1, &m2)) {
794 n++; 911 WRN_MSG("cannot split m = %d\n", m);
795 continue; 912 n++;
796 } 913 continue;
797 if (clock > f_out) 914 }
798 f_err = clock - f_out; 915 if (clock > f_out)
799 else 916 f_err = clock - f_out;
800 f_err = f_out - clock; 917 else/* slightly bias the error for bigger clocks */
801 918 f_err = f_out - clock + 1;
802 if (f_err < err_best) { 919
803 m_best = m; 920 if (f_err < err_best) {
804 n_best = n; 921 m_best = testm;
805 p_best = p; 922 n_best = n;
806 f_best = f_out; 923 p_best = p;
807 err_best = f_err; 924 f_best = f_out;
925 err_best = f_err;
926 }
808 } 927 }
809 n++; 928 n++;
810 } while ((n <= MAX_N) && (f_out >= clock)); 929 } while ((n <= pll->max_n) && (f_out >= clock));
811 p += p_inc; 930 p += p_inc;
812 } while ((p <= p_max)); 931 } while ((p <= p_max));
813 932
@@ -818,21 +937,22 @@ calc_pll_params(int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *retp1,
818 m = m_best; 937 m = m_best;
819 n = n_best; 938 n = n_best;
820 p = p_best; 939 p = p_best;
821 splitm(m, &m1, &m2); 940 splitm(index, m, &m1, &m2);
822 splitp(p, &p1, &p2); 941 splitp(index, p, &p1, &p2);
823 n1 = n - 2; 942 n1 = n - 2;
824 943
825 DBG_MSG("m, n, p: %d (%d,%d), %d (%d), %d (%d,%d), " 944 DBG_MSG("m, n, p: %d (%d,%d), %d (%d), %d (%d,%d), "
826 "f: %d (%d), VCO: %d\n", 945 "f: %d (%d), VCO: %d\n",
827 m, m1, m2, n, n1, p, p1, p2, 946 m, m1, m2, n, n1, p, p1, p2,
828 CALC_VCLOCK3(m, n, p), CALC_VCLOCK(m1, m2, n1, p1, p2), 947 calc_vclock3(index, m, n, p),
829 CALC_VCLOCK3(m, n, p) * p); 948 calc_vclock(index, m1, m2, n1, p1, p2, 0),
949 calc_vclock3(index, m, n, p) * p);
830 *retm1 = m1; 950 *retm1 = m1;
831 *retm2 = m2; 951 *retm2 = m2;
832 *retn = n1; 952 *retn = n1;
833 *retp1 = p1; 953 *retp1 = p1;
834 *retp2 = p2; 954 *retp2 = p2;
835 *retclock = CALC_VCLOCK(m1, m2, n1, p1, p2); 955 *retclock = calc_vclock(index, m1, m2, n1, p1, p2, 0);
836 956
837 return 0; 957 return 0;
838} 958}
@@ -860,6 +980,7 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
860 u32 vsync_start, vsync_end, vblank_start, vblank_end, vtotal, vactive; 980 u32 vsync_start, vsync_end, vblank_start, vblank_end, vtotal, vactive;
861 u32 vsync_pol, hsync_pol; 981 u32 vsync_pol, hsync_pol;
862 u32 *vs, *vb, *vt, *hs, *hb, *ht, *ss, *pipe_conf; 982 u32 *vs, *vb, *vt, *hs, *hb, *ht, *ss, *pipe_conf;
983 u32 stride_alignment;
863 984
864 DBG_MSG("intelfbhw_mode_to_hw\n"); 985 DBG_MSG("intelfbhw_mode_to_hw\n");
865 986
@@ -929,7 +1050,8 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
929 /* Desired clock in kHz */ 1050 /* Desired clock in kHz */
930 clock_target = 1000000000 / var->pixclock; 1051 clock_target = 1000000000 / var->pixclock;
931 1052
932 if (calc_pll_params(clock_target, &m1, &m2, &n, &p1, &p2, &clock)) { 1053 if (calc_pll_params(dinfo->pll_index, clock_target, &m1, &m2,
1054 &n, &p1, &p2, &clock)) {
933 WRN_MSG("calc_pll_params failed\n"); 1055 WRN_MSG("calc_pll_params failed\n");
934 return 1; 1056 return 1;
935 } 1057 }
@@ -949,7 +1071,14 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
949 *dpll &= ~DPLL_P1_FORCE_DIV2; 1071 *dpll &= ~DPLL_P1_FORCE_DIV2;
950 *dpll &= ~((DPLL_P2_MASK << DPLL_P2_SHIFT) | 1072 *dpll &= ~((DPLL_P2_MASK << DPLL_P2_SHIFT) |
951 (DPLL_P1_MASK << DPLL_P1_SHIFT)); 1073 (DPLL_P1_MASK << DPLL_P1_SHIFT));
952 *dpll |= (p2 << DPLL_P2_SHIFT) | (p1 << DPLL_P1_SHIFT); 1074
1075 if (IS_I9XX(dinfo)) {
1076 *dpll |= (p2 << DPLL_I9XX_P2_SHIFT);
1077 *dpll |= (1 << (p1 - 1)) << DPLL_P1_SHIFT;
1078 } else {
1079 *dpll |= (p2 << DPLL_P2_SHIFT) | (p1 << DPLL_P1_SHIFT);
1080 }
1081
953 *fp0 = (n << FP_N_DIVISOR_SHIFT) | 1082 *fp0 = (n << FP_N_DIVISOR_SHIFT) |
954 (m1 << FP_M1_DIVISOR_SHIFT) | 1083 (m1 << FP_M1_DIVISOR_SHIFT) |
955 (m2 << FP_M2_DIVISOR_SHIFT); 1084 (m2 << FP_M2_DIVISOR_SHIFT);
@@ -1054,7 +1183,7 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
1054 *ss = (hactive << SRC_SIZE_HORIZ_SHIFT) | 1183 *ss = (hactive << SRC_SIZE_HORIZ_SHIFT) |
1055 (vactive << SRC_SIZE_VERT_SHIFT); 1184 (vactive << SRC_SIZE_VERT_SHIFT);
1056 1185
1057 hw->disp_a_stride = var->xres_virtual * var->bits_per_pixel / 8; 1186 hw->disp_a_stride = dinfo->pitch;
1058 DBG_MSG("pitch is %d\n", hw->disp_a_stride); 1187 DBG_MSG("pitch is %d\n", hw->disp_a_stride);
1059 1188
1060 hw->disp_a_base = hw->disp_a_stride * var->yoffset + 1189 hw->disp_a_base = hw->disp_a_stride * var->yoffset +
@@ -1063,9 +1192,11 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
1063 hw->disp_a_base += dinfo->fb.offset << 12; 1192 hw->disp_a_base += dinfo->fb.offset << 12;
1064 1193
1065 /* Check stride alignment. */ 1194 /* Check stride alignment. */
1066 if (hw->disp_a_stride % STRIDE_ALIGNMENT != 0) { 1195 stride_alignment = IS_I9XX(dinfo) ? STRIDE_ALIGNMENT_I9XX :
1196 STRIDE_ALIGNMENT;
1197 if (hw->disp_a_stride % stride_alignment != 0) {
1067 WRN_MSG("display stride %d has bad alignment %d\n", 1198 WRN_MSG("display stride %d has bad alignment %d\n",
1068 hw->disp_a_stride, STRIDE_ALIGNMENT); 1199 hw->disp_a_stride, stride_alignment);
1069 return 1; 1200 return 1;
1070 } 1201 }
1071 1202
@@ -1087,6 +1218,7 @@ intelfbhw_program_mode(struct intelfb_info *dinfo,
1087 u32 hsync_reg, htotal_reg, hblank_reg; 1218 u32 hsync_reg, htotal_reg, hblank_reg;
1088 u32 vsync_reg, vtotal_reg, vblank_reg; 1219 u32 vsync_reg, vtotal_reg, vblank_reg;
1089 u32 src_size_reg; 1220 u32 src_size_reg;
1221 u32 count, tmp_val[3];
1090 1222
1091 /* Assume single pipe, display plane A, analog CRT. */ 1223 /* Assume single pipe, display plane A, analog CRT. */
1092 1224
@@ -1155,6 +1287,27 @@ intelfbhw_program_mode(struct intelfb_info *dinfo,
1155 src_size_reg = SRC_SIZE_A; 1287 src_size_reg = SRC_SIZE_A;
1156 } 1288 }
1157 1289
1290 /* turn off pipe */
1291 tmp = INREG(pipe_conf_reg);
1292 tmp &= ~PIPECONF_ENABLE;
1293 OUTREG(pipe_conf_reg, tmp);
1294
1295 count = 0;
1296 do {
1297 tmp_val[count%3] = INREG(0x70000);
1298 if ((tmp_val[0] == tmp_val[1]) && (tmp_val[1]==tmp_val[2]))
1299 break;
1300 count++;
1301 udelay(1);
1302 if (count % 200 == 0) {
1303 tmp = INREG(pipe_conf_reg);
1304 tmp &= ~PIPECONF_ENABLE;
1305 OUTREG(pipe_conf_reg, tmp);
1306 }
1307 } while(count < 2000);
1308
1309 OUTREG(ADPA, INREG(ADPA) & ~ADPA_DAC_ENABLE);
1310
1158 /* Disable planes A and B. */ 1311 /* Disable planes A and B. */
1159 tmp = INREG(DSPACNTR); 1312 tmp = INREG(DSPACNTR);
1160 tmp &= ~DISPPLANE_PLANE_ENABLE; 1313 tmp &= ~DISPPLANE_PLANE_ENABLE;
@@ -1163,19 +1316,21 @@ intelfbhw_program_mode(struct intelfb_info *dinfo,
1163 tmp &= ~DISPPLANE_PLANE_ENABLE; 1316 tmp &= ~DISPPLANE_PLANE_ENABLE;
1164 OUTREG(DSPBCNTR, tmp); 1317 OUTREG(DSPBCNTR, tmp);
1165 1318
1166 /* Wait for vblank. For now, just wait for a 50Hz cycle (20ms)) */ 1319 /* Wait for vblank. For now, just wait for a 50Hz cycle (20ms)) */
1167 mdelay(20); 1320 mdelay(20);
1168 1321
1322 OUTREG(DVOB, INREG(DVOB) & ~PORT_ENABLE);
1323 OUTREG(DVOC, INREG(DVOC) & ~PORT_ENABLE);
1324 OUTREG(ADPA, INREG(ADPA) & ~ADPA_DAC_ENABLE);
1325
1169 /* Disable Sync */ 1326 /* Disable Sync */
1170 tmp = INREG(ADPA); 1327 tmp = INREG(ADPA);
1171 tmp &= ~ADPA_DPMS_CONTROL_MASK; 1328 tmp &= ~ADPA_DPMS_CONTROL_MASK;
1172 tmp |= ADPA_DPMS_D3; 1329 tmp |= ADPA_DPMS_D3;
1173 OUTREG(ADPA, tmp); 1330 OUTREG(ADPA, tmp);
1174 1331
1175 /* turn off pipe */ 1332 /* do some funky magic - xyzzy */
1176 tmp = INREG(pipe_conf_reg); 1333 OUTREG(0x61204, 0xabcd0000);
1177 tmp &= ~PIPECONF_ENABLE;
1178 OUTREG(pipe_conf_reg, tmp);
1179 1334
1180 /* turn off PLL */ 1335 /* turn off PLL */
1181 tmp = INREG(dpll_reg); 1336 tmp = INREG(dpll_reg);
@@ -1183,30 +1338,31 @@ intelfbhw_program_mode(struct intelfb_info *dinfo,
1183 OUTREG(dpll_reg, tmp); 1338 OUTREG(dpll_reg, tmp);
1184 1339
1185 /* Set PLL parameters */ 1340 /* Set PLL parameters */
1186 OUTREG(dpll_reg, *dpll & ~DPLL_VCO_ENABLE);
1187 OUTREG(fp0_reg, *fp0); 1341 OUTREG(fp0_reg, *fp0);
1188 OUTREG(fp1_reg, *fp1); 1342 OUTREG(fp1_reg, *fp1);
1189 1343
1190 /* Set pipe parameters */ 1344 /* Enable PLL */
1191 OUTREG(hsync_reg, *hs); 1345 OUTREG(dpll_reg, *dpll);
1192 OUTREG(hblank_reg, *hb);
1193 OUTREG(htotal_reg, *ht);
1194 OUTREG(vsync_reg, *vs);
1195 OUTREG(vblank_reg, *vb);
1196 OUTREG(vtotal_reg, *vt);
1197 OUTREG(src_size_reg, *ss);
1198 1346
1199 /* Set DVOs B/C */ 1347 /* Set DVOs B/C */
1200 OUTREG(DVOB, hw->dvob); 1348 OUTREG(DVOB, hw->dvob);
1201 OUTREG(DVOC, hw->dvoc); 1349 OUTREG(DVOC, hw->dvoc);
1202 1350
1351 /* undo funky magic */
1352 OUTREG(0x61204, 0x00000000);
1353
1203 /* Set ADPA */ 1354 /* Set ADPA */
1355 OUTREG(ADPA, INREG(ADPA) | ADPA_DAC_ENABLE);
1204 OUTREG(ADPA, (hw->adpa & ~(ADPA_DPMS_CONTROL_MASK)) | ADPA_DPMS_D3); 1356 OUTREG(ADPA, (hw->adpa & ~(ADPA_DPMS_CONTROL_MASK)) | ADPA_DPMS_D3);
1205 1357
1206 /* Enable PLL */ 1358 /* Set pipe parameters */
1207 tmp = INREG(dpll_reg); 1359 OUTREG(hsync_reg, *hs);
1208 tmp |= DPLL_VCO_ENABLE; 1360 OUTREG(hblank_reg, *hb);
1209 OUTREG(dpll_reg, tmp); 1361 OUTREG(htotal_reg, *ht);
1362 OUTREG(vsync_reg, *vs);
1363 OUTREG(vblank_reg, *vb);
1364 OUTREG(vtotal_reg, *vt);
1365 OUTREG(src_size_reg, *ss);
1210 1366
1211 /* Enable pipe */ 1367 /* Enable pipe */
1212 OUTREG(pipe_conf_reg, *pipe_conf | PIPECONF_ENABLE); 1368 OUTREG(pipe_conf_reg, *pipe_conf | PIPECONF_ENABLE);
@@ -1231,7 +1387,7 @@ intelfbhw_program_mode(struct intelfb_info *dinfo,
1231 OUTREG(DSPACNTR, 1387 OUTREG(DSPACNTR,
1232 hw->disp_a_ctrl|DISPPLANE_PLANE_ENABLE); 1388 hw->disp_a_ctrl|DISPPLANE_PLANE_ENABLE);
1233 mdelay(1); 1389 mdelay(1);
1234 } 1390 }
1235 } 1391 }
1236 1392
1237 OUTREG(DSPACNTR, hw->disp_a_ctrl & ~DISPPLANE_PLANE_ENABLE); 1393 OUTREG(DSPACNTR, hw->disp_a_ctrl & ~DISPPLANE_PLANE_ENABLE);
@@ -1616,7 +1772,7 @@ intelfbhw_cursor_init(struct intelfb_info *dinfo)
1616 DBG_MSG("intelfbhw_cursor_init\n"); 1772 DBG_MSG("intelfbhw_cursor_init\n");
1617#endif 1773#endif
1618 1774
1619 if (dinfo->mobile) { 1775 if (dinfo->mobile || IS_I9XX(dinfo)) {
1620 if (!dinfo->cursor.physical) 1776 if (!dinfo->cursor.physical)
1621 return; 1777 return;
1622 tmp = INREG(CURSOR_A_CONTROL); 1778 tmp = INREG(CURSOR_A_CONTROL);
@@ -1649,7 +1805,7 @@ intelfbhw_cursor_hide(struct intelfb_info *dinfo)
1649#endif 1805#endif
1650 1806
1651 dinfo->cursor_on = 0; 1807 dinfo->cursor_on = 0;
1652 if (dinfo->mobile) { 1808 if (dinfo->mobile || IS_I9XX(dinfo)) {
1653 if (!dinfo->cursor.physical) 1809 if (!dinfo->cursor.physical)
1654 return; 1810 return;
1655 tmp = INREG(CURSOR_A_CONTROL); 1811 tmp = INREG(CURSOR_A_CONTROL);
@@ -1679,7 +1835,7 @@ intelfbhw_cursor_show(struct intelfb_info *dinfo)
1679 if (dinfo->cursor_blanked) 1835 if (dinfo->cursor_blanked)
1680 return; 1836 return;
1681 1837
1682 if (dinfo->mobile) { 1838 if (dinfo->mobile || IS_I9XX(dinfo)) {
1683 if (!dinfo->cursor.physical) 1839 if (!dinfo->cursor.physical)
1684 return; 1840 return;
1685 tmp = INREG(CURSOR_A_CONTROL); 1841 tmp = INREG(CURSOR_A_CONTROL);
@@ -1705,14 +1861,18 @@ intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y)
1705#endif 1861#endif
1706 1862
1707 /* 1863 /*
1708 * Sets the position. The coordinates are assumed to already 1864 * Sets the position. The coordinates are assumed to already
1709 * have any offset adjusted. Assume that the cursor is never 1865 * have any offset adjusted. Assume that the cursor is never
1710 * completely off-screen, and that x, y are always >= 0. 1866 * completely off-screen, and that x, y are always >= 0.
1711 */ 1867 */
1712 1868
1713 tmp = ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT) | 1869 tmp = ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT) |
1714 ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT); 1870 ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT);
1715 OUTREG(CURSOR_A_POSITION, tmp); 1871 OUTREG(CURSOR_A_POSITION, tmp);
1872
1873 if (IS_I9XX(dinfo)) {
1874 OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.physical);
1875 }
1716} 1876}
1717 1877
1718void 1878void
diff --git a/drivers/video/intelfb/intelfbhw.h b/drivers/video/intelfb/intelfbhw.h
index ba1920159f52..10acda098b71 100644
--- a/drivers/video/intelfb/intelfbhw.h
+++ b/drivers/video/intelfb/intelfbhw.h
@@ -133,6 +133,7 @@
133#define DPLL_VGA_MODE_DISABLE (1 << 28) 133#define DPLL_VGA_MODE_DISABLE (1 << 28)
134#define DPLL_P2_MASK 1 134#define DPLL_P2_MASK 1
135#define DPLL_P2_SHIFT 23 135#define DPLL_P2_SHIFT 23
136#define DPLL_I9XX_P2_SHIFT 24
136#define DPLL_P1_FORCE_DIV2 (1 << 21) 137#define DPLL_P1_FORCE_DIV2 (1 << 21)
137#define DPLL_P1_MASK 0x1f 138#define DPLL_P1_MASK 0x1f
138#define DPLL_P1_SHIFT 16 139#define DPLL_P1_SHIFT 16
@@ -155,29 +156,8 @@
155/* PLL parameters (these are for 852GM/855GM/865G, check earlier chips). */ 156/* PLL parameters (these are for 852GM/855GM/865G, check earlier chips). */
156/* Clock values are in units of kHz */ 157/* Clock values are in units of kHz */
157#define PLL_REFCLK 48000 158#define PLL_REFCLK 48000
158#define MIN_VCO_FREQ 930000
159#define MAX_VCO_FREQ 1400000
160#define MIN_CLOCK 25000 159#define MIN_CLOCK 25000
161#define MAX_CLOCK 350000 160#define MAX_CLOCK 350000
162#define P_TRANSITION_CLOCK 165000
163#define MIN_M 108
164#define MAX_M 140
165#define MIN_M1 18
166#define MAX_M1 26
167#define MIN_M2 6
168#define MAX_M2 16
169#define MIN_P 4
170#define MAX_P 128
171#define MIN_P1 0
172#define MAX_P1 31
173#define MIN_N 3
174#define MAX_N 16
175
176#define CALC_VCLOCK(m1, m2, n, p1, p2) \
177 ((PLL_REFCLK * (5 * ((m1) + 2) + ((m2) + 2)) / ((n) + 2)) / \
178 (((p1) + 2) * (1 << (p2 + 1))))
179
180#define CALC_VCLOCK3(m, n, p) ((PLL_REFCLK * (m) / (n)) / (p))
181 161
182/* Two pipes */ 162/* Two pipes */
183#define PIPE_A 0 163#define PIPE_A 0
@@ -522,8 +502,7 @@
522 502
523 503
524/* function protoypes */ 504/* function protoypes */
525extern int intelfbhw_get_chipset(struct pci_dev *pdev, const char **name, 505extern int intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo);
526 int *chipset, int *mobile);
527extern int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, 506extern int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
528 int *stolen_size); 507 int *stolen_size);
529extern int intelfbhw_check_non_crt(struct intelfb_info *dinfo); 508extern int intelfbhw_check_non_crt(struct intelfb_info *dinfo);
diff --git a/fs/bio.c b/fs/bio.c
index 098c12b2d60a..6a0b9ad8f8c9 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -654,9 +654,10 @@ static struct bio *__bio_map_user_iov(request_queue_t *q,
654 write_to_vm, 0, &pages[cur_page], NULL); 654 write_to_vm, 0, &pages[cur_page], NULL);
655 up_read(&current->mm->mmap_sem); 655 up_read(&current->mm->mmap_sem);
656 656
657 if (ret < local_nr_pages) 657 if (ret < local_nr_pages) {
658 ret = -EFAULT;
658 goto out_unmap; 659 goto out_unmap;
659 660 }
660 661
661 offset = uaddr & ~PAGE_MASK; 662 offset = uaddr & ~PAGE_MASK;
662 for (j = cur_page; j < page_limit; j++) { 663 for (j = cur_page; j < page_limit; j++) {
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 85d166cdcae4..b55b4ea9a676 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -67,12 +67,13 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
67static int debugfs_mknod(struct inode *dir, struct dentry *dentry, 67static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
68 int mode, dev_t dev) 68 int mode, dev_t dev)
69{ 69{
70 struct inode *inode = debugfs_get_inode(dir->i_sb, mode, dev); 70 struct inode *inode;
71 int error = -EPERM; 71 int error = -EPERM;
72 72
73 if (dentry->d_inode) 73 if (dentry->d_inode)
74 return -EEXIST; 74 return -EEXIST;
75 75
76 inode = debugfs_get_inode(dir->i_sb, mode, dev);
76 if (inode) { 77 if (inode) {
77 d_instantiate(dentry, inode); 78 d_instantiate(dentry, inode);
78 dget(dentry); 79 dget(dentry);
diff --git a/fs/locks.c b/fs/locks.c
index 6f99c0a6f836..ab61a8b54829 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -755,6 +755,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
755 if (request->fl_type == F_UNLCK) 755 if (request->fl_type == F_UNLCK)
756 goto out; 756 goto out;
757 757
758 error = -ENOMEM;
758 new_fl = locks_alloc_lock(); 759 new_fl = locks_alloc_lock();
759 if (new_fl == NULL) 760 if (new_fl == NULL)
760 goto out; 761 goto out;
@@ -781,6 +782,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
781 locks_copy_lock(new_fl, request); 782 locks_copy_lock(new_fl, request);
782 locks_insert_lock(&inode->i_flock, new_fl); 783 locks_insert_lock(&inode->i_flock, new_fl);
783 new_fl = NULL; 784 new_fl = NULL;
785 error = 0;
784 786
785out: 787out:
786 unlock_kernel(); 788 unlock_kernel();
diff --git a/include/asm-arm/arch-pxa/ohci.h b/include/asm-arm/arch-pxa/ohci.h
index 7da89569061e..e848a47128cd 100644
--- a/include/asm-arm/arch-pxa/ohci.h
+++ b/include/asm-arm/arch-pxa/ohci.h
@@ -11,6 +11,8 @@ struct pxaohci_platform_data {
11#define PMM_NPS_MODE 1 11#define PMM_NPS_MODE 1
12#define PMM_GLOBAL_MODE 2 12#define PMM_GLOBAL_MODE 2
13#define PMM_PERPORT_MODE 3 13#define PMM_PERPORT_MODE 3
14
15 int power_budget;
14}; 16};
15 17
16extern void pxa_set_ohci_info(struct pxaohci_platform_data *info); 18extern void pxa_set_ohci_info(struct pxaohci_platform_data *info);
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index 1386af1cb7d9..0cc6c7060f3c 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -133,57 +133,22 @@
133 || defined (CONFIG_CPU_NEVADA) \ 133 || defined (CONFIG_CPU_NEVADA) \
134 || defined (CONFIG_CPU_TX49XX) \ 134 || defined (CONFIG_CPU_TX49XX) \
135 || defined (CONFIG_CPU_MIPS64) 135 || defined (CONFIG_CPU_MIPS64)
136#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
137#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
138#define K0SIZE _LLCONST_(0x0000001000000000) /* 2^^36 */
139#define K1SIZE _LLCONST_(0x0000001000000000) /* 2^^36 */
140#define K2SIZE _LLCONST_(0x000000ff80000000)
141#define KSEGSIZE _LLCONST_(0x000000ff80000000) /* max syssegsz */
142#define TO_PHYS_MASK _LLCONST_(0x0000000fffffffff) /* 2^^36 - 1 */ 136#define TO_PHYS_MASK _LLCONST_(0x0000000fffffffff) /* 2^^36 - 1 */
143#endif 137#endif
144 138
145#if defined (CONFIG_CPU_R8000) 139#if defined (CONFIG_CPU_R8000)
146/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */ 140/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
147#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
148#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
149#define K0SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
150#define K1SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
151#define K2SIZE _LLCONST_(0x0001000000000000)
152#define KSEGSIZE _LLCONST_(0x0000010000000000) /* max syssegsz */
153#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */ 141#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */
154#endif 142#endif
155 143
156#if defined (CONFIG_CPU_R10000) 144#if defined (CONFIG_CPU_R10000)
157#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
158#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
159#define K0SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
160#define K1SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
161#define K2SIZE _LLCONST_(0x00000fff80000000)
162#define KSEGSIZE _LLCONST_(0x00000fff80000000) /* max syssegsz */
163#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */ 145#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */
164#endif 146#endif
165 147
166#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A) 148#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A)
167#define KUSIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
168#define KUSIZE_64 _LLCONST_(0x0000100000000000) /* 2^^44 */
169#define K0SIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
170#define K1SIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
171#define K2SIZE _LLCONST_(0x0000ffff80000000)
172#define KSEGSIZE _LLCONST_(0x0000ffff80000000) /* max syssegsz */
173#define TO_PHYS_MASK _LLCONST_(0x00000fffffffffff) /* 2^^44 - 1 */ 149#define TO_PHYS_MASK _LLCONST_(0x00000fffffffffff) /* 2^^44 - 1 */
174#endif 150#endif
175 151
176/*
177 * Further names for SGI source compatibility. These are stolen from
178 * IRIX's <sys/mips_addrspace.h>.
179 */
180#define KUBASE _LLCONST_(0)
181#define KUSIZE_32 _LLCONST_(0x0000000080000000) /* KUSIZE
182 for a 32 bit proc */
183#define K0BASE_EXL_WR _LLCONST_(0xa800000000000000) /* exclusive on write */
184#define K0BASE_NONCOH _LLCONST_(0x9800000000000000) /* noncoherent */
185#define K0BASE_EXL _LLCONST_(0xa000000000000000) /* exclusive */
186
187#ifndef CONFIG_CPU_R8000 152#ifndef CONFIG_CPU_R8000
188 153
189/* 154/*
diff --git a/include/asm-mips/apm.h b/include/asm-mips/apm.h
new file mode 100644
index 000000000000..e8c69208f63a
--- /dev/null
+++ b/include/asm-mips/apm.h
@@ -0,0 +1,65 @@
1/* -*- linux-c -*-
2 *
3 * (C) 2003 zecke@handhelds.org
4 *
5 * GPL version 2
6 *
7 * based on arch/arm/kernel/apm.c
8 * factor out the information needed by architectures to provide
9 * apm status
10 *
11 *
12 */
13#ifndef MIPS_ASM_SA1100_APM_H
14#define MIPS_ASM_SA1100_APM_H
15
16#include <linux/config.h>
17#include <linux/apm_bios.h>
18
19/*
20 * This structure gets filled in by the machine specific 'get_power_status'
21 * implementation. Any fields which are not set default to a safe value.
22 */
23struct apm_power_info {
24 unsigned char ac_line_status;
25#define APM_AC_OFFLINE 0
26#define APM_AC_ONLINE 1
27#define APM_AC_BACKUP 2
28#define APM_AC_UNKNOWN 0xff
29
30 unsigned char battery_status;
31#define APM_BATTERY_STATUS_HIGH 0
32#define APM_BATTERY_STATUS_LOW 1
33#define APM_BATTERY_STATUS_CRITICAL 2
34#define APM_BATTERY_STATUS_CHARGING 3
35#define APM_BATTERY_STATUS_NOT_PRESENT 4
36#define APM_BATTERY_STATUS_UNKNOWN 0xff
37
38 unsigned char battery_flag;
39#define APM_BATTERY_FLAG_HIGH (1 << 0)
40#define APM_BATTERY_FLAG_LOW (1 << 1)
41#define APM_BATTERY_FLAG_CRITICAL (1 << 2)
42#define APM_BATTERY_FLAG_CHARGING (1 << 3)
43#define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7)
44#define APM_BATTERY_FLAG_UNKNOWN 0xff
45
46 int battery_life;
47 int time;
48 int units;
49#define APM_UNITS_MINS 0
50#define APM_UNITS_SECS 1
51#define APM_UNITS_UNKNOWN -1
52
53};
54
55/*
56 * This allows machines to provide their own "apm get power status" function.
57 */
58extern void (*apm_get_power_status)(struct apm_power_info *);
59
60/*
61 * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND)
62 */
63void apm_queue_event(apm_event_t event);
64
65#endif
diff --git a/include/asm-mips/asmmacro-32.h b/include/asm-mips/asmmacro-32.h
index 11daf5ceb7b4..5de3963f511e 100644
--- a/include/asm-mips/asmmacro-32.h
+++ b/include/asm-mips/asmmacro-32.h
@@ -12,7 +12,7 @@
12#include <asm/fpregdef.h> 12#include <asm/fpregdef.h>
13#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
14 14
15 .macro fpu_save_double thread status tmp1=t0 tmp2 15 .macro fpu_save_double thread status tmp1=t0
16 cfc1 \tmp1, fcr31 16 cfc1 \tmp1, fcr31
17 sdc1 $f0, THREAD_FPR0(\thread) 17 sdc1 $f0, THREAD_FPR0(\thread)
18 sdc1 $f2, THREAD_FPR2(\thread) 18 sdc1 $f2, THREAD_FPR2(\thread)
@@ -70,7 +70,7 @@
70 sw \tmp, THREAD_FCR31(\thread) 70 sw \tmp, THREAD_FCR31(\thread)
71 .endm 71 .endm
72 72
73 .macro fpu_restore_double thread tmp=t0 73 .macro fpu_restore_double thread status tmp=t0
74 lw \tmp, THREAD_FCR31(\thread) 74 lw \tmp, THREAD_FCR31(\thread)
75 ldc1 $f0, THREAD_FPR0(\thread) 75 ldc1 $f0, THREAD_FPR0(\thread)
76 ldc1 $f2, THREAD_FPR2(\thread) 76 ldc1 $f2, THREAD_FPR2(\thread)
diff --git a/include/asm-mips/asmmacro-64.h b/include/asm-mips/asmmacro-64.h
index 559c355b9b86..225feefcb25d 100644
--- a/include/asm-mips/asmmacro-64.h
+++ b/include/asm-mips/asmmacro-64.h
@@ -53,12 +53,12 @@
53 sdc1 $f31, THREAD_FPR31(\thread) 53 sdc1 $f31, THREAD_FPR31(\thread)
54 .endm 54 .endm
55 55
56 .macro fpu_save_double thread status tmp1 tmp2 56 .macro fpu_save_double thread status tmp
57 sll \tmp2, \tmp1, 5 57 sll \tmp, \status, 5
58 bgez \tmp2, 2f 58 bgez \tmp, 2f
59 fpu_save_16odd \thread 59 fpu_save_16odd \thread
602: 602:
61 fpu_save_16even \thread \tmp1 # clobbers t1 61 fpu_save_16even \thread \tmp
62 .endm 62 .endm
63 63
64 .macro fpu_restore_16even thread tmp=t0 64 .macro fpu_restore_16even thread tmp=t0
@@ -101,13 +101,12 @@
101 ldc1 $f31, THREAD_FPR31(\thread) 101 ldc1 $f31, THREAD_FPR31(\thread)
102 .endm 102 .endm
103 103
104 .macro fpu_restore_double thread tmp 104 .macro fpu_restore_double thread status tmp
105 mfc0 t0, CP0_STATUS 105 sll \tmp, \status, 5
106 sll t1, t0, 5 106 bgez \tmp, 1f # 16 register mode?
107 bgez t1, 1f # 16 register mode?
108 107
109 fpu_restore_16odd a0 108 fpu_restore_16odd \thread
1101: fpu_restore_16even a0, t0 # clobbers t0 1091: fpu_restore_16even \thread \tmp
111 .endm 110 .endm
112 111
113 .macro cpu_save_nonscratch thread 112 .macro cpu_save_nonscratch thread
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index 14fc88f27226..3b745e76f429 100644
--- a/include/asm-mips/bootinfo.h
+++ b/include/asm-mips/bootinfo.h
@@ -217,6 +217,13 @@
217 */ 217 */
218#define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */ 218#define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
219#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */ 219#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
220#define MACH_TITAN_EXCITE 2 /* Basler eXcite */
221
222/*
223 * Valid machtype for group NEC EMMA2RH
224 */
225#define MACH_GROUP_NEC_EMMA2RH 25 /* NEC EMMA2RH (was 23) */
226#define MACH_NEC_MARKEINS 0 /* NEC EMMA2RH Mark-eins */
220 227
221#define CL_SIZE COMMAND_LINE_SIZE 228#define CL_SIZE COMMAND_LINE_SIZE
222 229
@@ -258,4 +265,10 @@ extern char arcs_cmdline[CL_SIZE];
258 * Registers a0, a1, a3 and a4 as passed to the kenrel entry by firmware 265 * Registers a0, a1, a3 and a4 as passed to the kenrel entry by firmware
259 */ 266 */
260extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3; 267extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
268
269/*
270 * Platform memory detection hook called by setup_arch
271 */
272extern void plat_mem_setup(void);
273
261#endif /* _ASM_BOOTINFO_H */ 274#endif /* _ASM_BOOTINFO_H */
diff --git a/include/asm-mips/ddb5074.h b/include/asm-mips/ddb5074.h
deleted file mode 100644
index 0d09ac27f9a5..000000000000
--- a/include/asm-mips/ddb5074.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * include/asm-mips/ddb5074.h -- NEC DDB Vrc-5074 definitions
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7
8extern void ddb5074_led_hex(int hex);
9extern void ddb5074_led_d2(int on);
10extern void ddb5074_led_d3(int on);
11
diff --git a/include/asm-mips/ddb5xxx/ddb5074.h b/include/asm-mips/ddb5xxx/ddb5074.h
deleted file mode 100644
index 58d88306af65..000000000000
--- a/include/asm-mips/ddb5xxx/ddb5074.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * include/asm-mips/ddb5074.h -- NEC DDB Vrc-5074 definitions
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7
8#ifndef _ASM_DDB5XXX_DDB5074_H
9#define _ASM_DDB5XXX_DDB5074_H
10
11#include <asm/nile4.h>
12
13#define DDB_SDRAM_SIZE 0x04000000 /* 64MB */
14
15#define DDB_PCI_IO_BASE 0x06000000
16#define DDB_PCI_IO_SIZE 0x02000000 /* 32 MB */
17
18#define DDB_PCI_MEM_BASE 0x08000000
19#define DDB_PCI_MEM_SIZE 0x08000000 /* 128 MB */
20
21#define DDB_PCI_CONFIG_BASE DDB_PCI_MEM_BASE
22#define DDB_PCI_CONFIG_SIZE DDB_PCI_MEM_SIZE
23
24#define NILE4_PCI_IO_BASE 0xa6000000
25#define NILE4_PCI_MEM_BASE 0xa8000000
26#define NILE4_PCI_CFG_BASE NILE4_PCI_MEM_BASE
27#define DDB_PCI_IACK_BASE NILE4_PCI_IO_BASE
28
29#define NILE4_IRQ_BASE NUM_I8259_INTERRUPTS
30#define CPU_IRQ_BASE (NUM_NILE4_INTERRUPTS + NILE4_IRQ_BASE)
31#define CPU_NILE4_CASCADE 2
32
33extern void ddb5074_led_hex(int hex);
34extern void ddb5074_led_d2(int on);
35extern void ddb5074_led_d3(int on);
36
37extern void nile4_irq_setup(u32 base);
38#endif
diff --git a/include/asm-mips/ddb5xxx/ddb5476.h b/include/asm-mips/ddb5xxx/ddb5476.h
deleted file mode 100644
index 4c23390d9354..000000000000
--- a/include/asm-mips/ddb5xxx/ddb5476.h
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 * header file specific for ddb5476
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14/*
15 * Memory map (physical address)
16 *
17 * Note most of the following address must be properly aligned by the
18 * corresponding size. For example, if PCI_IO_SIZE is 16MB, then
19 * PCI_IO_BASE must be aligned along 16MB boundary.
20 */
21#define DDB_SDRAM_BASE 0x00000000
22#define DDB_SDRAM_SIZE 0x04000000 /* 64MB */
23
24#define DDB_DCS3_BASE 0x04000000 /* flash 1 */
25#define DDB_DCS3_SIZE 0x01000000 /* 16MB */
26
27#define DDB_DCS2_BASE 0x05000000 /* flash 2 */
28#define DDB_DCS2_SIZE 0x01000000 /* 16MB */
29
30#define DDB_PCI_IO_BASE 0x06000000
31#define DDB_PCI_IO_SIZE 0x02000000 /* 32 MB */
32
33#define DDB_PCI_MEM_BASE 0x08000000
34#define DDB_PCI_MEM_SIZE 0x08000000 /* 128 MB */
35
36#define DDB_DCS5_BASE 0x13000000 /* DDB status regs */
37#define DDB_DCS5_SIZE 0x00200000 /* 2MB, 8-bit */
38
39#define DDB_DCS4_BASE 0x14000000 /* DDB control regs */
40#define DDB_DCS4_SIZE 0x00200000 /* 2MB, 8-bit */
41
42#define DDB_INTCS_BASE 0x1fa00000 /* VRC5476 control regs */
43#define DDB_INTCS_SIZE 0x00200000 /* 2MB */
44
45#define DDB_BOOTCS_BASE 0x1fc00000 /* Boot ROM / EPROM /Flash */
46#define DDB_BOOTCS_SIZE 0x00200000 /* 2 MB - doc says 4MB */
47
48
49/* aliases */
50#define DDB_PCI_CONFIG_BASE DDB_PCI_MEM_BASE
51#define DDB_PCI_CONFIG_SIZE DDB_PCI_MEM_SIZE
52
53/* PCI intr ack share PCIW0 with PCI IO */
54#define DDB_PCI_IACK_BASE DDB_PCI_IO_BASE
55
56/*
57 * Interrupt mapping
58 *
59 * We have three interrupt controllers:
60 *
61 * . CPU itself - 8 sources
62 * . i8259 - 16 sources
63 * . vrc5476 - 16 sources
64 *
65 * They connected as follows:
66 * all vrc5476 interrupts are routed to cpu IP2 (by software setting)
67 * all i2869 are routed to INTC in vrc5476 (by hardware connection)
68 *
69 * All VRC5476 PCI interrupts are level-triggered (no ack needed).
70 * All PCI irq but INTC are active low.
71 */
72
73/*
74 * irq number block assignment
75 */
76
77#define NUM_CPU_IRQ 8
78#define NUM_I8259_IRQ 16
79#define NUM_VRC5476_IRQ 16
80
81#define DDB_IRQ_BASE 0
82
83#define I8259_IRQ_BASE DDB_IRQ_BASE
84#define VRC5476_IRQ_BASE (I8259_IRQ_BASE + NUM_I8259_IRQ)
85#define CPU_IRQ_BASE (VRC5476_IRQ_BASE + NUM_VRC5476_IRQ)
86
87/*
88 * vrc5476 irq defs, see page 52-64 of Vrc5074 system controller manual
89 */
90
91#define VRC5476_IRQ_CPCE 0 /* cpu parity error */
92#define VRC5476_IRQ_CNTD 1 /* cpu no target */
93#define VRC5476_IRQ_MCE 2 /* memory check error */
94#define VRC5476_IRQ_DMA 3 /* DMA */
95#define VRC5476_IRQ_UART 4 /* vrc5476 builtin UART, not used */
96#define VRC5476_IRQ_WDOG 5 /* watchdog timer */
97#define VRC5476_IRQ_GPT 6 /* general purpose timer */
98#define VRC5476_IRQ_LBRT 7 /* local bus read timeout */
99#define VRC5476_IRQ_INTA 8 /* PCI INT #A */
100#define VRC5476_IRQ_INTB 9 /* PCI INT #B */
101#define VRC5476_IRQ_INTC 10 /* PCI INT #C */
102#define VRC5476_IRQ_INTD 11 /* PCI INT #D */
103#define VRC5476_IRQ_INTE 12 /* PCI INT #E */
104#define VRC5476_IRQ_RESERVED_13 13 /* reserved */
105#define VRC5476_IRQ_PCIS 14 /* PCI SERR # */
106#define VRC5476_IRQ_PCI 15 /* PCI internal error */
107
108/*
109 * i2859 irq assignment
110 */
111#define I8259_IRQ_RESERVED_0 0
112#define I8259_IRQ_KEYBOARD 1 /* M1543 default */
113#define I8259_IRQ_CASCADE 2
114#define I8259_IRQ_UART_B 3 /* M1543 default, may conflict with RTC according to schematic diagram */
115#define I8259_IRQ_UART_A 4 /* M1543 default */
116#define I8259_IRQ_PARALLEL 5 /* M1543 default */
117#define I8259_IRQ_RESERVED_6 6
118#define I8259_IRQ_RESERVED_7 7
119#define I8259_IRQ_RTC 8 /* who set this? */
120#define I8259_IRQ_USB 9 /* ddb_setup */
121#define I8259_IRQ_PMU 10 /* ddb_setup */
122#define I8259_IRQ_RESERVED_11 11
123#define I8259_IRQ_RESERVED_12 12 /* m1543_irq_setup */
124#define I8259_IRQ_RESERVED_13 13
125#define I8259_IRQ_HDC1 14 /* default and ddb_setup */
126#define I8259_IRQ_HDC2 15 /* default */
127
128
129/*
130 * misc
131 */
132#define VRC5476_I8259_CASCADE VRC5476_IRQ_INTC
133#define CPU_VRC5476_CASCADE 2
134
135#define is_i8259_irq(irq) ((irq) < NUM_I8259_IRQ)
136#define nile4_to_irq(n) ((n)+NUM_I8259_IRQ)
137#define irq_to_nile4(n) ((n)-NUM_I8259_IRQ)
138
139/*
140 * low-level irq functions
141 */
142#ifndef __ASSEMBLY__
143extern void nile4_map_irq(int nile4_irq, int cpu_irq);
144extern void nile4_map_irq_all(int cpu_irq);
145extern void nile4_enable_irq(int nile4_irq);
146extern void nile4_disable_irq(int nile4_irq);
147extern void nile4_disable_irq_all(void);
148extern u16 nile4_get_irq_stat(int cpu_irq);
149extern void nile4_enable_irq_output(int cpu_irq);
150extern void nile4_disable_irq_output(int cpu_irq);
151extern void nile4_set_pci_irq_polarity(int pci_irq, int high);
152extern void nile4_set_pci_irq_level_or_edge(int pci_irq, int level);
153extern void nile4_clear_irq(int nile4_irq);
154extern void nile4_clear_irq_mask(u32 mask);
155extern u8 nile4_i8259_iack(void);
156extern void nile4_dump_irq_status(void); /* Debug */
157#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-mips/ddb5xxx/ddb5xxx.h b/include/asm-mips/ddb5xxx/ddb5xxx.h
index 873c03f2c5fe..2f1b191c6fff 100644
--- a/include/asm-mips/ddb5xxx/ddb5xxx.h
+++ b/include/asm-mips/ddb5xxx/ddb5xxx.h
@@ -174,13 +174,8 @@
174 174
175static inline void ddb_sync(void) 175static inline void ddb_sync(void)
176{ 176{
177/* The DDB5074 doesn't seem to like these accesses. They kill the board on
178 * interrupt load
179 */
180#ifndef CONFIG_DDB5074
181 volatile u32 *p = (volatile u32 *)0xbfc00000; 177 volatile u32 *p = (volatile u32 *)0xbfc00000;
182 (void)(*p); 178 (void)(*p);
183#endif
184} 179}
185 180
186static inline void ddb_out32(u32 offset, u32 val) 181static inline void ddb_out32(u32 offset, u32 val)
@@ -260,11 +255,7 @@ extern void ddb_pci_reset_bus(void);
260/* 255/*
261 * include the board dependent part 256 * include the board dependent part
262 */ 257 */
263#if defined(CONFIG_DDB5074) 258#if defined(CONFIG_DDB5477)
264#include <asm/ddb5xxx/ddb5074.h>
265#elif defined(CONFIG_DDB5476)
266#include <asm/ddb5xxx/ddb5476.h>
267#elif defined(CONFIG_DDB5477)
268#include <asm/ddb5xxx/ddb5477.h> 259#include <asm/ddb5xxx/ddb5477.h>
269#else 260#else
270#error "Unknown DDB board!" 261#error "Unknown DDB board!"
diff --git a/include/asm-mips/emma2rh/emma2rh.h b/include/asm-mips/emma2rh/emma2rh.h
new file mode 100644
index 000000000000..4fb8df71caa9
--- /dev/null
+++ b/include/asm-mips/emma2rh/emma2rh.h
@@ -0,0 +1,330 @@
1/*
2 * include/asm-mips/emma2rh/emma2rh.h
3 * This file is EMMA2RH common header.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file based on include/asm-mips/ddb5xxx/ddb5xxx.h
8 * Copyright 2001 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24#ifndef __ASM_EMMA2RH_EMMA2RH_H
25#define __ASM_EMMA2RH_EMMA2RH_H
26
27/*
28 * EMMA2RH registers
29 */
30#define REGBASE 0x10000000
31
32#define EMMA2RH_BHIF_STRAP_0 (0x000010+REGBASE)
33#define EMMA2RH_BHIF_INT_ST_0 (0x000030+REGBASE)
34#define EMMA2RH_BHIF_INT_ST_1 (0x000034+REGBASE)
35#define EMMA2RH_BHIF_INT_ST_2 (0x000038+REGBASE)
36#define EMMA2RH_BHIF_INT_EN_0 (0x000040+REGBASE)
37#define EMMA2RH_BHIF_INT_EN_1 (0x000044+REGBASE)
38#define EMMA2RH_BHIF_INT_EN_2 (0x000048+REGBASE)
39#define EMMA2RH_BHIF_INT1_EN_0 (0x000050+REGBASE)
40#define EMMA2RH_BHIF_INT1_EN_1 (0x000054+REGBASE)
41#define EMMA2RH_BHIF_INT1_EN_2 (0x000058+REGBASE)
42#define EMMA2RH_BHIF_SW_INT (0x000070+REGBASE)
43#define EMMA2RH_BHIF_SW_INT_EN (0x000080+REGBASE)
44#define EMMA2RH_BHIF_SW_INT_CLR (0x000090+REGBASE)
45#define EMMA2RH_BHIF_MAIN_CTRL (0x0000b4+REGBASE)
46#define EMMA2RH_BHIF_EXCEPT_VECT_BASE_ADDRESS (0x0000c0+REGBASE)
47#define EMMA2RH_GPIO_DIR (0x110d20+REGBASE)
48#define EMMA2RH_GPIO_INT_ST (0x110d30+REGBASE)
49#define EMMA2RH_GPIO_INT_MASK (0x110d3c+REGBASE)
50#define EMMA2RH_GPIO_INT_MODE (0x110d48+REGBASE)
51#define EMMA2RH_GPIO_INT_CND_A (0x110d54+REGBASE)
52#define EMMA2RH_GPIO_INT_CND_B (0x110d60+REGBASE)
53#define EMMA2RH_PBRD_INT_EN (0x100010+REGBASE)
54#define EMMA2RH_PBRD_CLKSEL (0x100028+REGBASE)
55#define EMMA2RH_PFUR0_BASE (0x101000+REGBASE)
56#define EMMA2RH_PFUR1_BASE (0x102000+REGBASE)
57#define EMMA2RH_PFUR2_BASE (0x103000+REGBASE)
58#define EMMA2RH_PIIC0_BASE (0x107000+REGBASE)
59#define EMMA2RH_PIIC1_BASE (0x108000+REGBASE)
60#define EMMA2RH_PIIC2_BASE (0x109000+REGBASE)
61#define EMMA2RH_PCI_CONTROL (0x200000+REGBASE)
62#define EMMA2RH_PCI_ARBIT_CTR (0x200004+REGBASE)
63#define EMMA2RH_PCI_IWIN0_CTR (0x200010+REGBASE)
64#define EMMA2RH_PCI_IWIN1_CTR (0x200014+REGBASE)
65#define EMMA2RH_PCI_INIT_ESWP (0x200018+REGBASE)
66#define EMMA2RH_PCI_INT (0x200020+REGBASE)
67#define EMMA2RH_PCI_INT_EN (0x200024+REGBASE)
68#define EMMA2RH_PCI_TWIN_CTR (0x200030+REGBASE)
69#define EMMA2RH_PCI_TWIN_BADR (0x200034+REGBASE)
70#define EMMA2RH_PCI_TWIN0_DADR (0x200038+REGBASE)
71#define EMMA2RH_PCI_TWIN1_DADR (0x20003c+REGBASE)
72
73/*
74 * Memory map (physical address)
75 *
76 * Note most of the following address must be properly aligned by the
77 * corresponding size. For example, if PCI_IO_SIZE is 16MB, then
78 * PCI_IO_BASE must be aligned along 16MB boundary.
79 */
80
81/* the actual ram size is detected at run-time */
82#define EMMA2RH_RAM_BASE 0x00000000
83#define EMMA2RH_RAM_SIZE 0x10000000 /* less than 256MB */
84
85#define EMMA2RH_IO_BASE 0x10000000
86#define EMMA2RH_IO_SIZE 0x01000000 /* 16 MB */
87
88#define EMMA2RH_GENERALIO_BASE 0x11000000
89#define EMMA2RH_GENERALIO_SIZE 0x01000000 /* 16 MB */
90
91#define EMMA2RH_PCI_IO_BASE 0x12000000
92#define EMMA2RH_PCI_IO_SIZE 0x02000000 /* 32 MB */
93
94#define EMMA2RH_PCI_MEM_BASE 0x14000000
95#define EMMA2RH_PCI_MEM_SIZE 0x08000000 /* 128 MB */
96
97#define EMMA2RH_ROM_BASE 0x1c000000
98#define EMMA2RH_ROM_SIZE 0x04000000 /* 64 MB */
99
100#define EMMA2RH_PCI_CONFIG_BASE EMMA2RH_PCI_IO_BASE
101#define EMMA2RH_PCI_CONFIG_SIZE EMMA2RH_PCI_IO_SIZE
102
103#define NUM_CPU_IRQ 8
104#define NUM_EMMA2RH_IRQ 96
105
106#define CPU_EMMA2RH_CASCADE 2
107#define EMMA2RH_IRQ_BASE 0
108
109/*
110 * emma2rh irq defs
111 */
112
113#define EMMA2RH_IRQ_INT0 (0 + EMMA2RH_IRQ_BASE)
114#define EMMA2RH_IRQ_INT1 (1 + EMMA2RH_IRQ_BASE)
115#define EMMA2RH_IRQ_INT2 (2 + EMMA2RH_IRQ_BASE)
116#define EMMA2RH_IRQ_INT3 (3 + EMMA2RH_IRQ_BASE)
117#define EMMA2RH_IRQ_INT4 (4 + EMMA2RH_IRQ_BASE)
118#define EMMA2RH_IRQ_INT5 (5 + EMMA2RH_IRQ_BASE)
119#define EMMA2RH_IRQ_INT6 (6 + EMMA2RH_IRQ_BASE)
120#define EMMA2RH_IRQ_INT7 (7 + EMMA2RH_IRQ_BASE)
121#define EMMA2RH_IRQ_INT8 (8 + EMMA2RH_IRQ_BASE)
122#define EMMA2RH_IRQ_INT9 (9 + EMMA2RH_IRQ_BASE)
123#define EMMA2RH_IRQ_INT10 (10 + EMMA2RH_IRQ_BASE)
124#define EMMA2RH_IRQ_INT11 (11 + EMMA2RH_IRQ_BASE)
125#define EMMA2RH_IRQ_INT12 (12 + EMMA2RH_IRQ_BASE)
126#define EMMA2RH_IRQ_INT13 (13 + EMMA2RH_IRQ_BASE)
127#define EMMA2RH_IRQ_INT14 (14 + EMMA2RH_IRQ_BASE)
128#define EMMA2RH_IRQ_INT15 (15 + EMMA2RH_IRQ_BASE)
129#define EMMA2RH_IRQ_INT16 (16 + EMMA2RH_IRQ_BASE)
130#define EMMA2RH_IRQ_INT17 (17 + EMMA2RH_IRQ_BASE)
131#define EMMA2RH_IRQ_INT18 (18 + EMMA2RH_IRQ_BASE)
132#define EMMA2RH_IRQ_INT19 (19 + EMMA2RH_IRQ_BASE)
133#define EMMA2RH_IRQ_INT20 (20 + EMMA2RH_IRQ_BASE)
134#define EMMA2RH_IRQ_INT21 (21 + EMMA2RH_IRQ_BASE)
135#define EMMA2RH_IRQ_INT22 (22 + EMMA2RH_IRQ_BASE)
136#define EMMA2RH_IRQ_INT23 (23 + EMMA2RH_IRQ_BASE)
137#define EMMA2RH_IRQ_INT24 (24 + EMMA2RH_IRQ_BASE)
138#define EMMA2RH_IRQ_INT25 (25 + EMMA2RH_IRQ_BASE)
139#define EMMA2RH_IRQ_INT26 (26 + EMMA2RH_IRQ_BASE)
140#define EMMA2RH_IRQ_INT27 (27 + EMMA2RH_IRQ_BASE)
141#define EMMA2RH_IRQ_INT28 (28 + EMMA2RH_IRQ_BASE)
142#define EMMA2RH_IRQ_INT29 (29 + EMMA2RH_IRQ_BASE)
143#define EMMA2RH_IRQ_INT30 (30 + EMMA2RH_IRQ_BASE)
144#define EMMA2RH_IRQ_INT31 (31 + EMMA2RH_IRQ_BASE)
145#define EMMA2RH_IRQ_INT32 (32 + EMMA2RH_IRQ_BASE)
146#define EMMA2RH_IRQ_INT33 (33 + EMMA2RH_IRQ_BASE)
147#define EMMA2RH_IRQ_INT34 (34 + EMMA2RH_IRQ_BASE)
148#define EMMA2RH_IRQ_INT35 (35 + EMMA2RH_IRQ_BASE)
149#define EMMA2RH_IRQ_INT36 (36 + EMMA2RH_IRQ_BASE)
150#define EMMA2RH_IRQ_INT37 (37 + EMMA2RH_IRQ_BASE)
151#define EMMA2RH_IRQ_INT38 (38 + EMMA2RH_IRQ_BASE)
152#define EMMA2RH_IRQ_INT39 (39 + EMMA2RH_IRQ_BASE)
153#define EMMA2RH_IRQ_INT40 (40 + EMMA2RH_IRQ_BASE)
154#define EMMA2RH_IRQ_INT41 (41 + EMMA2RH_IRQ_BASE)
155#define EMMA2RH_IRQ_INT42 (42 + EMMA2RH_IRQ_BASE)
156#define EMMA2RH_IRQ_INT43 (43 + EMMA2RH_IRQ_BASE)
157#define EMMA2RH_IRQ_INT44 (44 + EMMA2RH_IRQ_BASE)
158#define EMMA2RH_IRQ_INT45 (45 + EMMA2RH_IRQ_BASE)
159#define EMMA2RH_IRQ_INT46 (46 + EMMA2RH_IRQ_BASE)
160#define EMMA2RH_IRQ_INT47 (47 + EMMA2RH_IRQ_BASE)
161#define EMMA2RH_IRQ_INT48 (48 + EMMA2RH_IRQ_BASE)
162#define EMMA2RH_IRQ_INT49 (49 + EMMA2RH_IRQ_BASE)
163#define EMMA2RH_IRQ_INT50 (50 + EMMA2RH_IRQ_BASE)
164#define EMMA2RH_IRQ_INT51 (51 + EMMA2RH_IRQ_BASE)
165#define EMMA2RH_IRQ_INT52 (52 + EMMA2RH_IRQ_BASE)
166#define EMMA2RH_IRQ_INT53 (53 + EMMA2RH_IRQ_BASE)
167#define EMMA2RH_IRQ_INT54 (54 + EMMA2RH_IRQ_BASE)
168#define EMMA2RH_IRQ_INT55 (55 + EMMA2RH_IRQ_BASE)
169#define EMMA2RH_IRQ_INT56 (56 + EMMA2RH_IRQ_BASE)
170#define EMMA2RH_IRQ_INT57 (57 + EMMA2RH_IRQ_BASE)
171#define EMMA2RH_IRQ_INT58 (58 + EMMA2RH_IRQ_BASE)
172#define EMMA2RH_IRQ_INT59 (59 + EMMA2RH_IRQ_BASE)
173#define EMMA2RH_IRQ_INT60 (60 + EMMA2RH_IRQ_BASE)
174#define EMMA2RH_IRQ_INT61 (61 + EMMA2RH_IRQ_BASE)
175#define EMMA2RH_IRQ_INT62 (62 + EMMA2RH_IRQ_BASE)
176#define EMMA2RH_IRQ_INT63 (63 + EMMA2RH_IRQ_BASE)
177
178#define EMMA2RH_IRQ_PFUR0 EMMA2RH_IRQ_INT49
179#define EMMA2RH_IRQ_PFUR1 EMMA2RH_IRQ_INT50
180#define EMMA2RH_IRQ_PFUR2 EMMA2RH_IRQ_INT51
181#define EMMA2RH_IRQ_PIIC0 EMMA2RH_IRQ_INT56
182#define EMMA2RH_IRQ_PIIC1 EMMA2RH_IRQ_INT57
183#define EMMA2RH_IRQ_PIIC2 EMMA2RH_IRQ_INT58
184
185/*
186 * EMMA2RH Register Access
187 */
188
189#define EMMA2RH_BASE (0xa0000000)
190
191static inline void emma2rh_sync(void)
192{
193 volatile u32 *p = (volatile u32 *)0xbfc00000;
194 (void)(*p);
195}
196
197static inline void emma2rh_out32(u32 offset, u32 val)
198{
199 *(volatile u32 *)(EMMA2RH_BASE | offset) = val;
200 emma2rh_sync();
201}
202
203static inline u32 emma2rh_in32(u32 offset)
204{
205 u32 val = *(volatile u32 *)(EMMA2RH_BASE | offset);
206 emma2rh_sync();
207 return val;
208}
209
210static inline void emma2rh_out16(u32 offset, u16 val)
211{
212 *(volatile u16 *)(EMMA2RH_BASE | offset) = val;
213 emma2rh_sync();
214}
215
216static inline u16 emma2rh_in16(u32 offset)
217{
218 u16 val = *(volatile u16 *)(EMMA2RH_BASE | offset);
219 emma2rh_sync();
220 return val;
221}
222
223static inline void emma2rh_out8(u32 offset, u8 val)
224{
225 *(volatile u8 *)(EMMA2RH_BASE | offset) = val;
226 emma2rh_sync();
227}
228
229static inline u8 emma2rh_in8(u32 offset)
230{
231 u8 val = *(volatile u8 *)(EMMA2RH_BASE | offset);
232 emma2rh_sync();
233 return val;
234}
235
236/**
237 * IIC registers map
238 **/
239
240/*---------------------------------------------------------------------------*/
241/* CNT - Control register (00H R/W) */
242/*---------------------------------------------------------------------------*/
243#define SPT 0x00000001
244#define STT 0x00000002
245#define ACKE 0x00000004
246#define WTIM 0x00000008
247#define SPIE 0x00000010
248#define WREL 0x00000020
249#define LREL 0x00000040
250#define IICE 0x00000080
251#define CNT_RESERVED 0x000000ff /* reserved bit 0 */
252
253#define I2C_EMMA_START (IICE | STT)
254#define I2C_EMMA_STOP (IICE | SPT)
255#define I2C_EMMA_REPSTART I2C_EMMA_START
256
257/*---------------------------------------------------------------------------*/
258/* STA - Status register (10H Read) */
259/*---------------------------------------------------------------------------*/
260#define MSTS 0x00000080
261#define ALD 0x00000040
262#define EXC 0x00000020
263#define COI 0x00000010
264#define TRC 0x00000008
265#define ACKD 0x00000004
266#define STD 0x00000002
267#define SPD 0x00000001
268
269/*---------------------------------------------------------------------------*/
270/* CSEL - Clock select register (20H R/W) */
271/*---------------------------------------------------------------------------*/
272#define FCL 0x00000080
273#define ND50 0x00000040
274#define CLD 0x00000020
275#define DAD 0x00000010
276#define SMC 0x00000008
277#define DFC 0x00000004
278#define CL 0x00000003
279#define CSEL_RESERVED 0x000000ff /* reserved bit 0 */
280
281#define FAST397 0x0000008b
282#define FAST297 0x0000008a
283#define FAST347 0x0000000b
284#define FAST260 0x0000000a
285#define FAST130 0x00000008
286#define STANDARD108 0x00000083
287#define STANDARD83 0x00000082
288#define STANDARD95 0x00000003
289#define STANDARD73 0x00000002
290#define STANDARD36 0x00000001
291#define STANDARD71 0x00000000
292
293/*---------------------------------------------------------------------------*/
294/* SVA - Slave address register (30H R/W) */
295/*---------------------------------------------------------------------------*/
296#define SVA 0x000000fe
297
298/*---------------------------------------------------------------------------*/
299/* SHR - Shift register (40H R/W) */
300/*---------------------------------------------------------------------------*/
301#define SR 0x000000ff
302
303/*---------------------------------------------------------------------------*/
304/* INT - Interrupt register (50H R/W) */
305/* INTM - Interrupt mask register (60H R/W) */
306/*---------------------------------------------------------------------------*/
307#define INTE0 0x00000001
308
309/***********************************************************************
310 * I2C registers
311 ***********************************************************************
312 */
313#define I2C_EMMA_CNT 0x00
314#define I2C_EMMA_STA 0x10
315#define I2C_EMMA_CSEL 0x20
316#define I2C_EMMA_SVA 0x30
317#define I2C_EMMA_SHR 0x40
318#define I2C_EMMA_INT 0x50
319#define I2C_EMMA_INTM 0x60
320
321/*
322 * include the board dependent part
323 */
324#if defined(CONFIG_MARKEINS)
325#include <asm/emma2rh/markeins.h>
326#else
327#error "Unknown EMMA2RH board!"
328#endif
329
330#endif /* __ASM_EMMA2RH_EMMA2RH_H */
diff --git a/include/asm-mips/emma2rh/markeins.h b/include/asm-mips/emma2rh/markeins.h
new file mode 100644
index 000000000000..8fa766795078
--- /dev/null
+++ b/include/asm-mips/emma2rh/markeins.h
@@ -0,0 +1,76 @@
1/*
2 * include/asm-mips/emma2rh/markeins.h
3 * This file is EMMA2RH board depended header.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file based on include/asm-mips/ddb5xxx/ddb5xxx.h
8 * Copyright 2001 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#ifndef MARKEINS_H
26#define MARKEINS_H
27
28#define NUM_EMMA2RH_IRQ_SW 32
29#define NUM_EMMA2RH_IRQ_GPIO 32
30
31#define EMMA2RH_SW_CASCADE (EMMA2RH_IRQ_INT7 - EMMA2RH_IRQ_INT0)
32#define EMMA2RH_GPIO_CASCADE (EMMA2RH_IRQ_INT46 - EMMA2RH_IRQ_INT0)
33
34#define EMMA2RH_SW_IRQ_BASE (EMMA2RH_IRQ_BASE + NUM_EMMA2RH_IRQ)
35#define EMMA2RH_GPIO_IRQ_BASE (EMMA2RH_SW_IRQ_BASE + NUM_EMMA2RH_IRQ_SW)
36#define CPU_IRQ_BASE (EMMA2RH_GPIO_IRQ_BASE + NUM_EMMA2RH_IRQ_GPIO)
37
38#define EMMA2RH_SW_IRQ_INT0 (0+EMMA2RH_SW_IRQ_BASE)
39#define EMMA2RH_SW_IRQ_INT1 (1+EMMA2RH_SW_IRQ_BASE)
40#define EMMA2RH_SW_IRQ_INT2 (2+EMMA2RH_SW_IRQ_BASE)
41#define EMMA2RH_SW_IRQ_INT3 (3+EMMA2RH_SW_IRQ_BASE)
42#define EMMA2RH_SW_IRQ_INT4 (4+EMMA2RH_SW_IRQ_BASE)
43#define EMMA2RH_SW_IRQ_INT5 (5+EMMA2RH_SW_IRQ_BASE)
44#define EMMA2RH_SW_IRQ_INT6 (6+EMMA2RH_SW_IRQ_BASE)
45#define EMMA2RH_SW_IRQ_INT7 (7+EMMA2RH_SW_IRQ_BASE)
46#define EMMA2RH_SW_IRQ_INT8 (8+EMMA2RH_SW_IRQ_BASE)
47#define EMMA2RH_SW_IRQ_INT9 (9+EMMA2RH_SW_IRQ_BASE)
48#define EMMA2RH_SW_IRQ_INT10 (10+EMMA2RH_SW_IRQ_BASE)
49#define EMMA2RH_SW_IRQ_INT11 (11+EMMA2RH_SW_IRQ_BASE)
50#define EMMA2RH_SW_IRQ_INT12 (12+EMMA2RH_SW_IRQ_BASE)
51#define EMMA2RH_SW_IRQ_INT13 (13+EMMA2RH_SW_IRQ_BASE)
52#define EMMA2RH_SW_IRQ_INT14 (14+EMMA2RH_SW_IRQ_BASE)
53#define EMMA2RH_SW_IRQ_INT15 (15+EMMA2RH_SW_IRQ_BASE)
54#define EMMA2RH_SW_IRQ_INT16 (16+EMMA2RH_SW_IRQ_BASE)
55#define EMMA2RH_SW_IRQ_INT17 (17+EMMA2RH_SW_IRQ_BASE)
56#define EMMA2RH_SW_IRQ_INT18 (18+EMMA2RH_SW_IRQ_BASE)
57#define EMMA2RH_SW_IRQ_INT19 (19+EMMA2RH_SW_IRQ_BASE)
58#define EMMA2RH_SW_IRQ_INT20 (20+EMMA2RH_SW_IRQ_BASE)
59#define EMMA2RH_SW_IRQ_INT21 (21+EMMA2RH_SW_IRQ_BASE)
60#define EMMA2RH_SW_IRQ_INT22 (22+EMMA2RH_SW_IRQ_BASE)
61#define EMMA2RH_SW_IRQ_INT23 (23+EMMA2RH_SW_IRQ_BASE)
62#define EMMA2RH_SW_IRQ_INT24 (24+EMMA2RH_SW_IRQ_BASE)
63#define EMMA2RH_SW_IRQ_INT25 (25+EMMA2RH_SW_IRQ_BASE)
64#define EMMA2RH_SW_IRQ_INT26 (26+EMMA2RH_SW_IRQ_BASE)
65#define EMMA2RH_SW_IRQ_INT27 (27+EMMA2RH_SW_IRQ_BASE)
66#define EMMA2RH_SW_IRQ_INT28 (28+EMMA2RH_SW_IRQ_BASE)
67#define EMMA2RH_SW_IRQ_INT29 (29+EMMA2RH_SW_IRQ_BASE)
68#define EMMA2RH_SW_IRQ_INT30 (30+EMMA2RH_SW_IRQ_BASE)
69#define EMMA2RH_SW_IRQ_INT31 (31+EMMA2RH_SW_IRQ_BASE)
70
71#define MARKEINS_PCI_IRQ_INTA EMMA2RH_GPIO_IRQ_BASE+15
72#define MARKEINS_PCI_IRQ_INTB EMMA2RH_GPIO_IRQ_BASE+16
73#define MARKEINS_PCI_IRQ_INTC EMMA2RH_GPIO_IRQ_BASE+17
74#define MARKEINS_PCI_IRQ_INTD EMMA2RH_GPIO_IRQ_BASE+18
75
76#endif /* CONFIG_MARKEINS */
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index b0f50015e252..8bf510a27c64 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -138,10 +138,9 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
138 if (cpu_has_fpu) { 138 if (cpu_has_fpu) {
139 if ((tsk == current) && __is_fpu_owner()) 139 if ((tsk == current) && __is_fpu_owner())
140 _save_fp(current); 140 _save_fp(current);
141 return tsk->thread.fpu.hard.fpr;
142 } 141 }
143 142
144 return tsk->thread.fpu.soft.fpr; 143 return tsk->thread.fpu.fpr;
145} 144}
146 145
147#endif /* _ASM_FPU_H */ 146#endif /* _ASM_FPU_H */
diff --git a/include/asm-mips/fpu_emulator.h b/include/asm-mips/fpu_emulator.h
index 16cb4d11dd0b..2731c38bd7ae 100644
--- a/include/asm-mips/fpu_emulator.h
+++ b/include/asm-mips/fpu_emulator.h
@@ -12,8 +12,8 @@
12 * 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.,
13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
14 * 14 *
15 * Further private data for which no space exists in mips_fpu_soft_struct. 15 * Further private data for which no space exists in mips_fpu_struct.
16 * This should be subsumed into the mips_fpu_soft_struct structure as 16 * This should be subsumed into the mips_fpu_struct structure as
17 * defined in processor.h as soon as the absurd wired absolute assembler 17 * defined in processor.h as soon as the absurd wired absolute assembler
18 * offsets become dynamic at compile time. 18 * offsets become dynamic at compile time.
19 * 19 *
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index 12d118f1bc9c..1f94640becc4 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -22,51 +22,53 @@
22 " .set push \n" \ 22 " .set push \n" \
23 " .set noat \n" \ 23 " .set noat \n" \
24 " .set mips3 \n" \ 24 " .set mips3 \n" \
25 "1: ll %1, (%3) # __futex_atomic_op \n" \ 25 "1: ll %1, %4 # __futex_atomic_op \n" \
26 " .set mips0 \n" \ 26 " .set mips0 \n" \
27 " " insn " \n" \ 27 " " insn " \n" \
28 " .set mips3 \n" \ 28 " .set mips3 \n" \
29 "2: sc $1, (%3) \n" \ 29 "2: sc $1, %2 \n" \
30 " beqzl $1, 1b \n" \ 30 " beqzl $1, 1b \n" \
31 __FUTEX_SMP_SYNC \ 31 __FUTEX_SMP_SYNC \
32 "3: \n" \ 32 "3: \n" \
33 " .set pop \n" \ 33 " .set pop \n" \
34 " .set mips0 \n" \ 34 " .set mips0 \n" \
35 " .section .fixup,\"ax\" \n" \ 35 " .section .fixup,\"ax\" \n" \
36 "4: li %0, %5 \n" \ 36 "4: li %0, %6 \n" \
37 " j 2b \n" \ 37 " j 2b \n" \
38 " .previous \n" \ 38 " .previous \n" \
39 " .section __ex_table,\"a\" \n" \ 39 " .section __ex_table,\"a\" \n" \
40 " "__UA_ADDR "\t1b, 4b \n" \ 40 " "__UA_ADDR "\t1b, 4b \n" \
41 " "__UA_ADDR "\t2b, 4b \n" \ 41 " "__UA_ADDR "\t2b, 4b \n" \
42 " .previous \n" \ 42 " .previous \n" \
43 : "=r" (ret), "=r" (oldval) \ 43 : "=r" (ret), "=&r" (oldval), "=R" (*uaddr) \
44 : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT)); \ 44 : "0" (0), "R" (*uaddr), "Jr" (oparg), "i" (-EFAULT) \
45 : "memory"); \
45 } else if (cpu_has_llsc) { \ 46 } else if (cpu_has_llsc) { \
46 __asm__ __volatile__( \ 47 __asm__ __volatile__( \
47 " .set push \n" \ 48 " .set push \n" \
48 " .set noat \n" \ 49 " .set noat \n" \
49 " .set mips3 \n" \ 50 " .set mips3 \n" \
50 "1: ll %1, (%3) # __futex_atomic_op \n" \ 51 "1: ll %1, %4 # __futex_atomic_op \n" \
51 " .set mips0 \n" \ 52 " .set mips0 \n" \
52 " " insn " \n" \ 53 " " insn " \n" \
53 " .set mips3 \n" \ 54 " .set mips3 \n" \
54 "2: sc $1, (%3) \n" \ 55 "2: sc $1, %2 \n" \
55 " beqz $1, 1b \n" \ 56 " beqz $1, 1b \n" \
56 __FUTEX_SMP_SYNC \ 57 __FUTEX_SMP_SYNC \
57 "3: \n" \ 58 "3: \n" \
58 " .set pop \n" \ 59 " .set pop \n" \
59 " .set mips0 \n" \ 60 " .set mips0 \n" \
60 " .section .fixup,\"ax\" \n" \ 61 " .section .fixup,\"ax\" \n" \
61 "4: li %0, %5 \n" \ 62 "4: li %0, %6 \n" \
62 " j 2b \n" \ 63 " j 2b \n" \
63 " .previous \n" \ 64 " .previous \n" \
64 " .section __ex_table,\"a\" \n" \ 65 " .section __ex_table,\"a\" \n" \
65 " "__UA_ADDR "\t1b, 4b \n" \ 66 " "__UA_ADDR "\t1b, 4b \n" \
66 " "__UA_ADDR "\t2b, 4b \n" \ 67 " "__UA_ADDR "\t2b, 4b \n" \
67 " .previous \n" \ 68 " .previous \n" \
68 : "=r" (ret), "=r" (oldval) \ 69 : "=r" (ret), "=&r" (oldval), "=R" (*uaddr) \
69 : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT)); \ 70 : "0" (0), "R" (*uaddr), "Jr" (oparg), "i" (-EFAULT) \
71 : "memory"); \
70 } else \ 72 } else \
71 ret = -ENOSYS; \ 73 ret = -ENOSYS; \
72} 74}
@@ -89,23 +91,23 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
89 91
90 switch (op) { 92 switch (op) {
91 case FUTEX_OP_SET: 93 case FUTEX_OP_SET:
92 __futex_atomic_op("move $1, %z4", ret, oldval, uaddr, oparg); 94 __futex_atomic_op("move $1, %z5", ret, oldval, uaddr, oparg);
93 break; 95 break;
94 96
95 case FUTEX_OP_ADD: 97 case FUTEX_OP_ADD:
96 __futex_atomic_op("addu $1, %1, %z4", 98 __futex_atomic_op("addu $1, %1, %z5",
97 ret, oldval, uaddr, oparg); 99 ret, oldval, uaddr, oparg);
98 break; 100 break;
99 case FUTEX_OP_OR: 101 case FUTEX_OP_OR:
100 __futex_atomic_op("or $1, %1, %z4", 102 __futex_atomic_op("or $1, %1, %z5",
101 ret, oldval, uaddr, oparg); 103 ret, oldval, uaddr, oparg);
102 break; 104 break;
103 case FUTEX_OP_ANDN: 105 case FUTEX_OP_ANDN:
104 __futex_atomic_op("and $1, %1, %z4", 106 __futex_atomic_op("and $1, %1, %z5",
105 ret, oldval, uaddr, ~oparg); 107 ret, oldval, uaddr, ~oparg);
106 break; 108 break;
107 case FUTEX_OP_XOR: 109 case FUTEX_OP_XOR:
108 __futex_atomic_op("xor $1, %1, %z4", 110 __futex_atomic_op("xor $1, %1, %z5",
109 ret, oldval, uaddr, oparg); 111 ret, oldval, uaddr, oparg);
110 break; 112 break;
111 default: 113 default:
diff --git a/include/asm-mips/mach-ddb5074/mc146818rtc.h b/include/asm-mips/mach-ddb5074/mc146818rtc.h
deleted file mode 100644
index 2eb9acb10a5a..000000000000
--- a/include/asm-mips/mach-ddb5074/mc146818rtc.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_DDB5074_MC146818RTC_H
11#define __ASM_MACH_DDB5074_MC146818RTC_H
12
13#include <asm/ddb5xxx/ddb5074.h>
14#include <asm/ddb5xxx/ddb5xxx.h>
15
16#define RTC_PORT(x) (0x70 + (x))
17#define RTC_IRQ 8
18
19static inline unsigned char CMOS_READ(unsigned long addr)
20{
21 return *(volatile unsigned char *)(KSEG1ADDR(DDB_PCI_MEM_BASE)+addr);
22}
23
24static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
25{
26 *(volatile unsigned char *)(KSEG1ADDR(DDB_PCI_MEM_BASE)+addr) = data;
27}
28
29#define RTC_ALWAYS_BCD 1
30
31#endif /* __ASM_MACH_DDB5074_MC146818RTC_H */
diff --git a/include/asm-mips/mach-dec/param.h b/include/asm-mips/mach-dec/param.h
deleted file mode 100644
index 3e4f0e390847..000000000000
--- a/include/asm-mips/mach-dec/param.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_DEC_PARAM_H
9#define __ASM_MACH_DEC_PARAM_H
10
11/*
12 * log2(HZ), change this here if you want another HZ value. This is also
13 * used in dec_time_init. Minimum is 1, Maximum is 15.
14 */
15#define LOG_2_HZ 7
16#define HZ (1 << LOG_2_HZ)
17
18#endif /* __ASM_MACH_DEC_PARAM_H */
diff --git a/include/asm-mips/mach-mips/param.h b/include/asm-mips/mach-emma2rh/irq.h
index 805ef6d27d3c..bce64244b800 100644
--- a/include/asm-mips/mach-mips/param.h
+++ b/include/asm-mips/mach-emma2rh/irq.h
@@ -5,9 +5,9 @@
5 * 5 *
6 * Copyright (C) 2003 by Ralf Baechle 6 * Copyright (C) 2003 by Ralf Baechle
7 */ 7 */
8#ifndef __ASM_MACH_MIPS_PARAM_H 8#ifndef __ASM_MACH_EMMA2RH_IRQ_H
9#define __ASM_MACH_MIPS_PARAM_H 9#define __ASM_MACH_EMMA2RH_IRQ_H
10 10
11#define HZ 100 /* Internal kernel timer frequency */ 11#define NR_IRQS 256
12 12
13#endif /* __ASM_MACH_MIPS_PARAM_H */ 13#endif /* __ASM_MACH_EMMA2RH_IRQ_H */
diff --git a/include/asm-mips/mach-excite/cpu-feature-overrides.h b/include/asm-mips/mach-excite/cpu-feature-overrides.h
new file mode 100644
index 000000000000..abb76b2fd865
--- /dev/null
+++ b/include/asm-mips/mach-excite/cpu-feature-overrides.h
@@ -0,0 +1,40 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 Thomas Koeller <thomas.koeller@baslerweb.com>
7 */
8#ifndef __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * Basler eXcite has an RM9122 processor.
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 0
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
29#define cpu_icache_snoops_remote_store 0
30
31#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1
33
34#define cpu_has_subset_pcaches 0
35
36#define cpu_dcache_line_size() 32
37#define cpu_icache_line_size() 32
38#define cpu_scache_line_size() 32
39
40#endif /* __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-excite/excite.h b/include/asm-mips/mach-excite/excite.h
new file mode 100644
index 000000000000..c52610de2b3a
--- /dev/null
+++ b/include/asm-mips/mach-excite/excite.h
@@ -0,0 +1,155 @@
1#ifndef __EXCITE_H__
2#define __EXCITE_H__
3
4#include <linux/config.h>
5#include <linux/init.h>
6#include <asm/addrspace.h>
7#include <asm/types.h>
8
9#define EXCITE_CPU_EXT_CLOCK 100000000
10
11#if !defined(__ASSEMBLER__)
12void __init excite_kgdb_init(void);
13void excite_procfs_init(void);
14extern unsigned long memsize;
15extern char modetty[];
16extern u32 unit_id;
17#endif
18
19/* Base name for XICAP devices */
20#define XICAP_NAME "xicap_gpi"
21
22/* OCD register offsets */
23#define LKB0 0x0038
24#define LKB5 0x0128
25#define LKM5 0x012C
26#define LKB7 0x0138
27#define LKM7 0x013c
28#define LKB8 0x0140
29#define LKM8 0x0144
30#define LKB9 0x0148
31#define LKM9 0x014c
32#define LKB10 0x0150
33#define LKM10 0x0154
34#define LKB11 0x0158
35#define LKM11 0x015c
36#define LKB12 0x0160
37#define LKM12 0x0164
38#define LKB13 0x0168
39#define LKM13 0x016c
40#define LDP0 0x0200
41#define LDP1 0x0210
42#define LDP2 0x0220
43#define LDP3 0x0230
44#define INTPIN0 0x0A40
45#define INTPIN1 0x0A44
46#define INTPIN2 0x0A48
47#define INTPIN3 0x0A4C
48#define INTPIN4 0x0A50
49#define INTPIN5 0x0A54
50#define INTPIN6 0x0A58
51#define INTPIN7 0x0A5C
52
53
54
55
56/* TITAN register offsets */
57#define CPRR 0x0004
58#define CPDSR 0x0008
59#define CPTC0R 0x000c
60#define CPTC1R 0x0010
61#define CPCFG0 0x0020
62#define CPCFG1 0x0024
63#define CPDST0A 0x0028
64#define CPDST0B 0x002c
65#define CPDST1A 0x0030
66#define CPDST1B 0x0034
67#define CPXDSTA 0x0038
68#define CPXDSTB 0x003c
69#define CPXCISRA 0x0048
70#define CPXCISRB 0x004c
71#define CPGIG0ER 0x0050
72#define CPGIG1ER 0x0054
73#define CPGRWL 0x0068
74#define CPURSLMT 0x00f8
75#define UACFG 0x0200
76#define UAINTS 0x0204
77#define SDRXFCIE 0x4828
78#define SDTXFCIE 0x4928
79#define INTP0Status0 0x1B00
80#define INTP0Mask0 0x1B04
81#define INTP0Set0 0x1B08
82#define INTP0Clear0 0x1B0C
83#define GXCFG 0x5000
84#define GXDMADRPFX 0x5018
85#define GXDMA_DESCADR 0x501c
86#define GXCH0TDESSTRT 0x5054
87
88/* IRQ definitions */
89#define NMICONFIG 0xac0
90#define TITAN_MSGINT 0xc4
91#define TITAN_IRQ ((TITAN_MSGINT / 0x20) + 2)
92#define FPGA0_MSGINT 0x5a
93#define FPGA0_IRQ ((FPGA0_MSGINT / 0x20) + 2)
94#define FPGA1_MSGINT 0x7b
95#define FPGA1_IRQ ((FPGA1_MSGINT / 0x20) + 2)
96#define PHY_MSGINT 0x9c
97#define PHY_IRQ ((PHY_MSGINT / 0x20) + 2)
98
99#if defined(CONFIG_BASLER_EXCITE_PROTOTYPE)
100/* Pre-release units used interrupt pin #9 */
101#define USB_IRQ 11
102#else
103/* Re-designed units use interrupt pin #1 */
104#define USB_MSGINT 0x39
105#define USB_IRQ ((USB_MSGINT / 0x20) + 2)
106#endif
107#define TIMER_IRQ 12
108
109
110/* Device address ranges */
111#define EXCITE_OFFS_OCD 0x1fffc000
112#define EXCITE_SIZE_OCD (16 * 1024)
113#define EXCITE_PHYS_OCD CPHYSADDR(EXCITE_OFFS_OCD)
114#define EXCITE_ADDR_OCD CKSEG1ADDR(EXCITE_OFFS_OCD)
115
116#define EXCITE_OFFS_SCRAM 0x1fffa000
117#define EXCITE_SIZE_SCRAM (8 << 10)
118#define EXCITE_PHYS_SCRAM CPHYSADDR(EXCITE_OFFS_SCRAM)
119#define EXCITE_ADDR_SCRAM CKSEG1ADDR(EXCITE_OFFS_SCRAM)
120
121#define EXCITE_OFFS_PCI_IO 0x1fff8000
122#define EXCITE_SIZE_PCI_IO (8 << 10)
123#define EXCITE_PHYS_PCI_IO CPHYSADDR(EXCITE_OFFS_PCI_IO)
124#define EXCITE_ADDR_PCI_IO CKSEG1ADDR(EXCITE_OFFS_PCI_IO)
125
126#define EXCITE_OFFS_TITAN 0x1fff0000
127#define EXCITE_SIZE_TITAN (32 << 10)
128#define EXCITE_PHYS_TITAN CPHYSADDR(EXCITE_OFFS_TITAN)
129#define EXCITE_ADDR_TITAN CKSEG1ADDR(EXCITE_OFFS_TITAN)
130
131#define EXCITE_OFFS_PCI_MEM 0x1ffe0000
132#define EXCITE_SIZE_PCI_MEM (64 << 10)
133#define EXCITE_PHYS_PCI_MEM CPHYSADDR(EXCITE_OFFS_PCI_MEM)
134#define EXCITE_ADDR_PCI_MEM CKSEG1ADDR(EXCITE_OFFS_PCI_MEM)
135
136#define EXCITE_OFFS_FPGA 0x1ffdc000
137#define EXCITE_SIZE_FPGA (16 << 10)
138#define EXCITE_PHYS_FPGA CPHYSADDR(EXCITE_OFFS_FPGA)
139#define EXCITE_ADDR_FPGA CKSEG1ADDR(EXCITE_OFFS_FPGA)
140
141#define EXCITE_OFFS_NAND 0x1ffd8000
142#define EXCITE_SIZE_NAND (16 << 10)
143#define EXCITE_PHYS_NAND CPHYSADDR(EXCITE_OFFS_NAND)
144#define EXCITE_ADDR_NAND CKSEG1ADDR(EXCITE_OFFS_NAND)
145
146#define EXCITE_OFFS_BOOTROM 0x1f000000
147#define EXCITE_SIZE_BOOTROM (8 << 20)
148#define EXCITE_PHYS_BOOTROM CPHYSADDR(EXCITE_OFFS_BOOTROM)
149#define EXCITE_ADDR_BOOTROM CKSEG1ADDR(EXCITE_OFFS_BOOTROM)
150
151/* FPGA address offsets */
152#define EXCITE_FPGA_DPR 0x0104 /* dual-ported ram */
153#define EXCITE_FPGA_SYSCTL 0x0200 /* system control register block */
154
155#endif /* __EXCITE_H__ */
diff --git a/include/asm-mips/mach-excite/excite_nandflash.h b/include/asm-mips/mach-excite/excite_nandflash.h
new file mode 100644
index 000000000000..c4cf6140622e
--- /dev/null
+++ b/include/asm-mips/mach-excite/excite_nandflash.h
@@ -0,0 +1,7 @@
1#ifndef __EXCITE_NANDFLASH_H__
2#define __EXCITE_NANDFLASH_H__
3
4/* Resource names */
5#define EXCITE_NANDFLASH_RESOURCE_REGS "excite_nandflash_regs"
6
7#endif /* __EXCITE_NANDFLASH_H__ */
diff --git a/include/asm-mips/mach-excite/rm9k_eth.h b/include/asm-mips/mach-excite/rm9k_eth.h
new file mode 100644
index 000000000000..94705a46f72e
--- /dev/null
+++ b/include/asm-mips/mach-excite/rm9k_eth.h
@@ -0,0 +1,23 @@
1#if !defined(__RM9K_ETH_H__)
2#define __RM9K_ETH_H__
3
4#define RM9K_GE_NAME "rm9k_ge"
5
6/* Resource names */
7#define RM9K_GE_RESOURCE_MAC "rm9k_ge_mac"
8#define RM9K_GE_RESOURCE_MSTAT "rm9k_ge_mstat"
9#define RM9K_GE_RESOURCE_PKTPROC "rm9k_ge_pktproc"
10#define RM9K_GE_RESOURCE_XDMA "rm9k_ge_xdma"
11#define RM9K_GE_RESOURCE_FIFO_RX "rm9k_ge_fifo_rx"
12#define RM9K_GE_RESOURCE_FIFO_TX "rm9k_ge_fifo_tx"
13#define RM9K_GE_RESOURCE_FIFOMEM_RX "rm9k_ge_fifo_memory_rx"
14#define RM9K_GE_RESOURCE_FIFOMEM_TX "rm9k_ge_fifo_memory_tx"
15#define RM9K_GE_RESOURCE_PHY "rm9k_ge_phy"
16#define RM9K_GE_RESOURCE_DMADESC_RX "rm9k_ge_dmadesc_rx"
17#define RM9K_GE_RESOURCE_DMADESC_TX "rm9k_ge_dmadesc_tx"
18#define RM9K_GE_RESOURCE_IRQ_MAIN "rm9k_ge_irq_main"
19#define RM9K_GE_RESOURCE_IRQ_PHY "rm9k_ge_irq_phy"
20#define RM9K_GE_RESOURCE_GPI_SLICE "rm9k_ge_gpi_slice"
21#define RM9K_GE_RESOURCE_MDIO_CHANNEL "rm9k_ge_mdio_channel"
22
23#endif /* !defined(__RM9K_ETH_H__) */
diff --git a/include/asm-mips/mach-excite/rm9k_wdt.h b/include/asm-mips/mach-excite/rm9k_wdt.h
new file mode 100644
index 000000000000..3fa3c08d2da7
--- /dev/null
+++ b/include/asm-mips/mach-excite/rm9k_wdt.h
@@ -0,0 +1,12 @@
1#ifndef __RM9K_WDT_H__
2#define __RM9K_WDT_H__
3
4/* Device name */
5#define WDT_NAME "wdt_gpi"
6
7/* Resource names */
8#define WDT_RESOURCE_REGS "excite_watchdog_regs"
9#define WDT_RESOURCE_IRQ "excite_watchdog_irq"
10#define WDT_RESOURCE_COUNTER "excite_watchdog_counter"
11
12#endif /* __RM9K_WDT_H__ */
diff --git a/include/asm-mips/mach-excite/rm9k_xicap.h b/include/asm-mips/mach-excite/rm9k_xicap.h
new file mode 100644
index 000000000000..009577734a8d
--- /dev/null
+++ b/include/asm-mips/mach-excite/rm9k_xicap.h
@@ -0,0 +1,16 @@
1#ifndef __EXCITE_XICAP_H__
2#define __EXCITE_XICAP_H__
3
4
5/* Resource names */
6#define XICAP_RESOURCE_FIFO_RX "xicap_fifo_rx"
7#define XICAP_RESOURCE_FIFO_TX "xicap_fifo_tx"
8#define XICAP_RESOURCE_XDMA "xicap_xdma"
9#define XICAP_RESOURCE_DMADESC "xicap_dmadesc"
10#define XICAP_RESOURCE_PKTPROC "xicap_pktproc"
11#define XICAP_RESOURCE_IRQ "xicap_irq"
12#define XICAP_RESOURCE_GPI_SLICE "xicap_gpi_slice"
13#define XICAP_RESOURCE_FIFO_BLK "xicap_fifo_blocks"
14#define XICAP_RESOURCE_PKT_STREAM "xicap_pkt_stream"
15
16#endif /* __EXCITE_XICAP_H__ */
diff --git a/include/asm-mips/mach-generic/param.h b/include/asm-mips/mach-generic/param.h
deleted file mode 100644
index a0d12f964e4f..000000000000
--- a/include/asm-mips/mach-generic/param.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_PARAM_H
9#define __ASM_MACH_GENERIC_PARAM_H
10
11#define HZ 1000 /* Internal kernel timer frequency */
12
13#endif /* __ASM_MACH_GENERIC_PARAM_H */
diff --git a/include/asm-mips/mach-ip22/cpu-feature-overrides.h b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
index 2a37bedb4053..f7c5dc8a5336 100644
--- a/include/asm-mips/mach-ip22/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
@@ -13,7 +13,7 @@
13 */ 13 */
14#define cpu_has_tlb 1 14#define cpu_has_tlb 1
15#define cpu_has_4kex 1 15#define cpu_has_4kex 1
16#define cpu_has_4kcache 1 16#define cpu_has_4k_cache 1
17#define cpu_has_fpu 1 17#define cpu_has_fpu 1
18#define cpu_has_32fpr 1 18#define cpu_has_32fpr 1
19#define cpu_has_counter 1 19#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-ip27/cpu-feature-overrides.h b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
index 2d2f5b91e47f..19c2d135985b 100644
--- a/include/asm-mips/mach-ip27/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
@@ -31,6 +31,9 @@
31#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1 32#define cpu_has_64bits 1
33 33
34#define cpu_has_4kex 1
35#define cpu_has_4k_cache 1
36
34#define cpu_has_subset_pcaches 1 37#define cpu_has_subset_pcaches 1
35 38
36#define cpu_dcache_line_size() 32 39#define cpu_dcache_line_size() 32
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
index 36070b5654ab..f0ef1ac9ecd7 100644
--- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
@@ -38,6 +38,8 @@
38#define cpu_has_vtag_icache 0 38#define cpu_has_vtag_icache 0
39#define cpu_has_ic_fills_f_dc 0 39#define cpu_has_ic_fills_f_dc 0
40#define cpu_has_dsp 0 40#define cpu_has_dsp 0
41#define cpu_has_4k_cache 1
42
41 43
42#define cpu_has_mips32r1 0 44#define cpu_has_mips32r1 0
43#define cpu_has_mips32r2 0 45#define cpu_has_mips32r2 0
diff --git a/include/asm-mips/mach-jazz/param.h b/include/asm-mips/mach-jazz/param.h
deleted file mode 100644
index 639763a517bc..000000000000
--- a/include/asm-mips/mach-jazz/param.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JAZZ_PARAM_H
9#define __ASM_MACH_JAZZ_PARAM_H
10
11/*
12 * Jazz is currently using the internal 100Hz timer of the R4030
13 */
14#define HZ 100 /* Internal kernel timer frequency */
15
16#endif /* __ASM_MACH_JAZZ_PARAM_H */
diff --git a/include/asm-mips/mach-mips/cpu-feature-overrides.h b/include/asm-mips/mach-mips/cpu-feature-overrides.h
index e06af6c86f86..12c937283bb4 100644
--- a/include/asm-mips/mach-mips/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-mips/cpu-feature-overrides.h
@@ -17,7 +17,7 @@
17#ifdef CONFIG_CPU_MIPS32 17#ifdef CONFIG_CPU_MIPS32
18#define cpu_has_tlb 1 18#define cpu_has_tlb 1
19#define cpu_has_4kex 1 19#define cpu_has_4kex 1
20#define cpu_has_4kcache 1 20#define cpu_has_4k_cache 1
21/* #define cpu_has_fpu ? */ 21/* #define cpu_has_fpu ? */
22/* #define cpu_has_32fpr ? */ 22/* #define cpu_has_32fpr ? */
23#define cpu_has_counter 1 23#define cpu_has_counter 1
@@ -47,7 +47,7 @@
47#ifdef CONFIG_CPU_MIPS64 47#ifdef CONFIG_CPU_MIPS64
48#define cpu_has_tlb 1 48#define cpu_has_tlb 1
49#define cpu_has_4kex 1 49#define cpu_has_4kex 1
50#define cpu_has_4kcache 1 50#define cpu_has_4k_cache 1
51/* #define cpu_has_fpu ? */ 51/* #define cpu_has_fpu ? */
52/* #define cpu_has_32fpr ? */ 52/* #define cpu_has_32fpr ? */
53#define cpu_has_counter 1 53#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-qemu/param.h b/include/asm-mips/mach-qemu/param.h
deleted file mode 100644
index cb30ee490ae6..000000000000
--- a/include/asm-mips/mach-qemu/param.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_QEMU_PARAM_H
9#define __ASM_MACH_QEMU_PARAM_H
10
11#define HZ 100 /* Internal kernel timer frequency */
12
13#endif /* __ASM_MACH_QEMU_PARAM_H */
diff --git a/include/asm-mips/mach-rm200/cpu-feature-overrides.h b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
index 91e7cf5f2bfe..11410ae10d36 100644
--- a/include/asm-mips/mach-rm200/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
@@ -14,7 +14,7 @@
14 14
15#define cpu_has_tlb 1 15#define cpu_has_tlb 1
16#define cpu_has_4kex 1 16#define cpu_has_4kex 1
17#define cpu_has_4kcache 1 17#define cpu_has_4k_cache 1
18#define cpu_has_fpu 1 18#define cpu_has_fpu 1
19#define cpu_has_32fpr 1 19#define cpu_has_32fpr 1
20#define cpu_has_counter 1 20#define cpu_has_counter 1
@@ -35,10 +35,8 @@
35#define cpu_has_nofpuex 0 35#define cpu_has_nofpuex 0
36#define cpu_has_64bits 1 36#define cpu_has_64bits 1
37 37
38#define cpu_has_subset_pcaches 0 /* No S-cache on R5000 I think ... */
39#define cpu_dcache_line_size() 32 38#define cpu_dcache_line_size() 32
40#define cpu_icache_line_size() 32 39#define cpu_icache_line_size() 32
41#define cpu_scache_line_size() 0 /* No S-cache on R5000 I think ... */
42 40
43#define cpu_has_mips32r1 0 41#define cpu_has_mips32r1 0
44#define cpu_has_mips32r2 0 42#define cpu_has_mips32r2 0
diff --git a/include/asm-mips/mach-sim/cpu-feature-overrides.h b/include/asm-mips/mach-sim/cpu-feature-overrides.h
index cadbe8eda79c..d9653e47d5fc 100644
--- a/include/asm-mips/mach-sim/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-sim/cpu-feature-overrides.h
@@ -16,7 +16,7 @@
16#ifdef CONFIG_CPU_MIPS32 16#ifdef CONFIG_CPU_MIPS32
17#define cpu_has_tlb 1 17#define cpu_has_tlb 1
18#define cpu_has_4kex 1 18#define cpu_has_4kex 1
19#define cpu_has_4kcache 1 19#define cpu_has_4k_cache 1
20#define cpu_has_fpu 0 20#define cpu_has_fpu 0
21/* #define cpu_has_32fpr ? */ 21/* #define cpu_has_32fpr ? */
22#define cpu_has_counter 1 22#define cpu_has_counter 1
@@ -41,7 +41,7 @@
41#ifdef CONFIG_CPU_MIPS64 41#ifdef CONFIG_CPU_MIPS64
42#define cpu_has_tlb 1 42#define cpu_has_tlb 1
43#define cpu_has_4kex 1 43#define cpu_has_4kex 1
44#define cpu_has_4kcache 1 44#define cpu_has_4k_cache 1
45/* #define cpu_has_fpu ? */ 45/* #define cpu_has_fpu ? */
46/* #define cpu_has_32fpr ? */ 46/* #define cpu_has_32fpr ? */
47#define cpu_has_counter 1 47#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-wrppmc/mach-gt64120.h b/include/asm-mips/mach-wrppmc/mach-gt64120.h
new file mode 100644
index 000000000000..ba9205a04582
--- /dev/null
+++ b/include/asm-mips/mach-wrppmc/mach-gt64120.h
@@ -0,0 +1,84 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef __ASM_MIPS_GT64120_H
9#define __ASM_MIPS_GT64120_H
10
11/*
12 * This is the CPU physical memory map of PPMC Board:
13 *
14 * 0x00000000-0x03FFFFFF - 64MB SDRAM (SCS[0]#)
15 * 0x1C000000-0x1C000000 - LED (CS0)
16 * 0x1C800000-0x1C800007 - UART 16550 port (CS1)
17 * 0x1F000000-0x1F000000 - MailBox (CS3)
18 * 0x1FC00000-0x20000000 - 4MB Flash (BOOT CS)
19 */
20
21#define WRPPMC_SDRAM_SCS0_BASE 0x00000000
22#define WRPPMC_SDRAM_SCS0_SIZE 0x04000000
23
24#define WRPPMC_UART16550_BASE 0x1C800000
25#define WRPPMC_UART16550_CLOCK 3686400 /* 3.68MHZ */
26
27#define WRPPMC_LED_BASE 0x1C000000
28#define WRPPMC_MBOX_BASE 0x1F000000
29
30#define WRPPMC_BOOTROM_BASE 0x1FC00000
31#define WRPPMC_BOOTROM_SIZE 0x00400000 /* 4M Flash */
32
33#define WRPPMC_MIPS_TIMER_IRQ 7 /* MIPS compare/count timer interrupt */
34#define WRPPMC_UART16550_IRQ 6
35#define WRPPMC_PCI_INTA_IRQ 3
36
37/*
38 * PCI Bus I/O and Memory resources allocation
39 *
40 * NOTE: We only have PCI_0 hose interface
41 */
42#define GT_PCI_MEM_BASE 0x13000000UL
43#define GT_PCI_MEM_SIZE 0x02000000UL
44#define GT_PCI_IO_BASE 0x11000000UL
45#define GT_PCI_IO_SIZE 0x02000000UL
46#define GT_ISA_IO_BASE PCI_IO_BASE
47
48/*
49 * PCI interrupts will come in on either the INTA or INTD interrups lines,
50 * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our
51 * boards, they all either come in on IntD or they all come in on IntA, they
52 * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the
53 * "requested" interrupt numbers and go through the list whenever we get an
54 * IntA/D.
55 *
56 * Interrupts < 8 are directly wired to the processor; PCI INTA is 8 and
57 * INTD is 11.
58 */
59#define GT_TIMER 4
60#define GT_INTA 2
61#define GT_INTD 5
62
63#ifndef __ASSEMBLY__
64
65/*
66 * GT64120 internal register space base address
67 */
68extern unsigned long gt64120_base;
69
70#define GT64120_BASE (gt64120_base)
71
72/* define WRPPMC_EARLY_DEBUG to enable early output something to UART */
73#undef WRPPMC_EARLY_DEBUG
74
75#ifdef WRPPMC_EARLY_DEBUG
76extern void wrppmc_led_on(int mask);
77extern void wrppmc_led_off(int mask);
78extern void wrppmc_early_printk(const char *fmt, ...);
79#else
80#define wrppmc_early_printk(fmt, ...) do {} while (0)
81#endif /* WRPPMC_EARLY_DEBUG */
82
83#endif /* __ASSEMBLY__ */
84#endif /* __ASM_MIPS_GT64120_H */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index 5af7517fce8a..98b68089aa53 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -1451,12 +1451,10 @@ static inline void __emt(unsigned int previous)
1451{ 1451{
1452 if ((previous & __EMT_ENABLE)) 1452 if ((previous & __EMT_ENABLE))
1453 __asm__ __volatile__( 1453 __asm__ __volatile__(
1454 " .set noreorder \n"
1455 " .set mips32r2 \n" 1454 " .set mips32r2 \n"
1456 " .word 0x41600be1 # emt \n" 1455 " .word 0x41600be1 # emt \n"
1457 " ehb \n" 1456 " ehb \n"
1458 " .set mips0 \n" 1457 " .set mips0 \n");
1459 " .set reorder \n");
1460} 1458}
1461 1459
1462static inline void __ehb(void) 1460static inline void __ehb(void)
diff --git a/include/asm-mips/mmzone.h b/include/asm-mips/mmzone.h
index 7bde4432092b..f6bd2e0c45a1 100644
--- a/include/asm-mips/mmzone.h
+++ b/include/asm-mips/mmzone.h
@@ -14,17 +14,6 @@
14#define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr)) 14#define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr))
15#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) 15#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
16 16
17#define pfn_valid(pfn) \
18({ \
19 unsigned long __pfn = (pfn); \
20 int __n = pfn_to_nid(__pfn); \
21 ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \
22 NODE_DATA(__n)->node_spanned_pages) : 0);\
23})
24
25/* XXX: FIXME -- wli */
26#define kern_addr_valid(addr) (0)
27
28#endif /* CONFIG_DISCONTIGMEM */ 17#endif /* CONFIG_DISCONTIGMEM */
29 18
30#endif /* _ASM_MMZONE_H_ */ 19#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 4035ec79ecd4..3d262c01521c 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -145,6 +145,25 @@ typedef struct { unsigned long pgprot; } pgprot_t;
145#endif 145#endif
146#endif 146#endif
147 147
148#ifdef CONFIG_FLATMEM
149
150#define pfn_valid(pfn) ((pfn) < max_mapnr)
151
152#elif defined(CONFIG_NEED_MULTIPLE_NODES)
153
154#define pfn_valid(pfn) \
155({ \
156 unsigned long __pfn = (pfn); \
157 int __n = pfn_to_nid(__pfn); \
158 ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \
159 NODE_DATA(__n)->node_spanned_pages) \
160 : 0); \
161})
162
163#else
164#error Provide a definition of pfn_valid
165#endif
166
148#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 167#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
149#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 168#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
150 169
diff --git a/include/asm-mips/param.h b/include/asm-mips/param.h
index 2bead8273ced..1d9bb8c5ab24 100644
--- a/include/asm-mips/param.h
+++ b/include/asm-mips/param.h
@@ -11,7 +11,7 @@
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13 13
14# include <param.h> /* Internal kernel timer frequency */ 14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#endif 17#endif
diff --git a/include/asm-mips/pci/bridge.h b/include/asm-mips/pci/bridge.h
index b4ee995c56e6..0c45e7598f3f 100644
--- a/include/asm-mips/pci/bridge.h
+++ b/include/asm-mips/pci/bridge.h
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <asm/xtalk/xwidget.h> /* generic widget header */ 17#include <asm/xtalk/xwidget.h> /* generic widget header */
18#include <asm/sn/types.h>
18 19
19/* I/O page size */ 20/* I/O page size */
20 21
@@ -848,4 +849,6 @@ struct bridge_controller {
848extern void register_bridge_irq(unsigned int irq); 849extern void register_bridge_irq(unsigned int irq);
849extern int request_bridge_irq(struct bridge_controller *bc); 850extern int request_bridge_irq(struct bridge_controller *bc);
850 851
852extern struct pci_ops bridge_pci_ops;
853
851#endif /* _ASM_PCI_BRIDGE_H */ 854#endif /* _ASM_PCI_BRIDGE_H */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index d0af2a3b0152..be75cca20e8d 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -379,9 +379,7 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
379 __update_cache(vma, address, pte); 379 __update_cache(vma, address, pte);
380} 380}
381 381
382#ifndef CONFIG_NEED_MULTIPLE_NODES
383#define kern_addr_valid(addr) (1) 382#define kern_addr_valid(addr) (1)
384#endif
385 383
386#ifdef CONFIG_64BIT_PHYS_ADDR 384#ifdef CONFIG_64BIT_PHYS_ADDR
387extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); 385extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot);
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index 0fb75f0762e0..83936469fe87 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -71,11 +71,6 @@ extern unsigned int vced_count, vcei_count;
71 71
72typedef __u64 fpureg_t; 72typedef __u64 fpureg_t;
73 73
74struct mips_fpu_hard_struct {
75 fpureg_t fpr[NUM_FPU_REGS];
76 unsigned int fcr31;
77};
78
79/* 74/*
80 * It would be nice to add some more fields for emulator statistics, but there 75 * It would be nice to add some more fields for emulator statistics, but there
81 * are a number of fixed offsets in offset.h and elsewhere that would have to 76 * are a number of fixed offsets in offset.h and elsewhere that would have to
@@ -83,18 +78,13 @@ struct mips_fpu_hard_struct {
83 * the FPU emulator for now. See asm-mips/fpu_emulator.h. 78 * the FPU emulator for now. See asm-mips/fpu_emulator.h.
84 */ 79 */
85 80
86struct mips_fpu_soft_struct { 81struct mips_fpu_struct {
87 fpureg_t fpr[NUM_FPU_REGS]; 82 fpureg_t fpr[NUM_FPU_REGS];
88 unsigned int fcr31; 83 unsigned int fcr31;
89}; 84};
90 85
91union mips_fpu_union {
92 struct mips_fpu_hard_struct hard;
93 struct mips_fpu_soft_struct soft;
94};
95
96#define INIT_FPU { \ 86#define INIT_FPU { \
97 {{0,},} \ 87 {0,} \
98} 88}
99 89
100#define NUM_DSP_REGS 6 90#define NUM_DSP_REGS 6
@@ -133,7 +123,7 @@ struct thread_struct {
133 unsigned long cp0_status; 123 unsigned long cp0_status;
134 124
135 /* Saved fpu/fpu emulator stuff. */ 125 /* Saved fpu/fpu emulator stuff. */
136 union mips_fpu_union fpu; 126 struct mips_fpu_struct fpu;
137#ifdef CONFIG_MIPS_MT_FPAFF 127#ifdef CONFIG_MIPS_MT_FPAFF
138 /* Emulated instruction count */ 128 /* Emulated instruction count */
139 unsigned long emulated_fp; 129 unsigned long emulated_fp;
diff --git a/include/asm-mips/qemu.h b/include/asm-mips/qemu.h
index 905c39585903..531caf44560c 100644
--- a/include/asm-mips/qemu.h
+++ b/include/asm-mips/qemu.h
@@ -21,4 +21,10 @@
21 */ 21 */
22#define QEMU_C0_COUNTER_CLOCK 100000000 22#define QEMU_C0_COUNTER_CLOCK 100000000
23 23
24/*
25 * Magic qemu system control location.
26 */
27#define QEMU_RESTART_REG 0xBFBF0000
28#define QEMU_HALT_REG 0xBFBF0004
29
24#endif /* __ASM_QEMU_H */ 30#endif /* __ASM_QEMU_H */
diff --git a/include/asm-mips/rm9k-ocd.h b/include/asm-mips/rm9k-ocd.h
new file mode 100644
index 000000000000..b0b80d9ecf96
--- /dev/null
+++ b/include/asm-mips/rm9k-ocd.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#if !defined(_ASM_RM9K_OCD_H)
21#define _ASM_RM9K_OCD_H
22
23#include <linux/types.h>
24#include <linux/spinlock.h>
25#include <asm/io.h>
26
27extern volatile void __iomem * const ocd_base;
28extern volatile void __iomem * const titan_base;
29
30#define ocd_addr(__x__) (ocd_base + (__x__))
31#define titan_addr(__x__) (titan_base + (__x__))
32#define scram_addr(__x__) (scram_base + (__x__))
33
34/* OCD register access */
35#define ocd_readl(__offs__) __raw_readl(ocd_addr(__offs__))
36#define ocd_readw(__offs__) __raw_readw(ocd_addr(__offs__))
37#define ocd_readb(__offs__) __raw_readb(ocd_addr(__offs__))
38#define ocd_writel(__val__, __offs__) \
39 __raw_writel((__val__), ocd_addr(__offs__))
40#define ocd_writew(__val__, __offs__) \
41 __raw_writew((__val__), ocd_addr(__offs__))
42#define ocd_writeb(__val__, __offs__) \
43 __raw_writeb((__val__), ocd_addr(__offs__))
44
45/* TITAN register access - 32 bit-wide only */
46#define titan_readl(__offs__) __raw_readl(titan_addr(__offs__))
47#define titan_writel(__val__, __offs__) \
48 __raw_writel((__val__), titan_addr(__offs__))
49
50/* Protect access to shared TITAN registers */
51extern spinlock_t titan_lock;
52extern int titan_irqflags;
53#define lock_titan_regs() spin_lock_irqsave(&titan_lock, titan_irqflags)
54#define unlock_titan_regs() spin_unlock_irqrestore(&titan_lock, titan_irqflags)
55
56#endif /* !defined(_ASM_RM9K_OCD_H) */
diff --git a/include/asm-mips/sn/addrs.h b/include/asm-mips/sn/addrs.h
index 2b5cef1ba37f..6c8a5577ddf1 100644
--- a/include/asm-mips/sn/addrs.h
+++ b/include/asm-mips/sn/addrs.h
@@ -27,13 +27,8 @@
27 27
28#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
29 29
30#if defined(CONFIG_SGI_IO) /* FIXME */
31#define PS_UINT_CAST (__psunsigned_t)
32#define UINT64_CAST (__uint64_t)
33#else /* CONFIG_SGI_IO */
34#define PS_UINT_CAST (unsigned long) 30#define PS_UINT_CAST (unsigned long)
35#define UINT64_CAST (unsigned long) 31#define UINT64_CAST (unsigned long)
36#endif /* CONFIG_SGI_IO */
37 32
38#define HUBREG_CAST (volatile hubreg_t *) 33#define HUBREG_CAST (volatile hubreg_t *)
39 34
@@ -253,14 +248,6 @@
253 * for _x. 248 * for _x.
254 */ 249 */
255 250
256#ifdef _STANDALONE
257
258/* DO NOT USE THESE DIRECTLY IN THE KERNEL. SEE BELOW. */
259#define LOCAL_HUB(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
260#define REMOTE_HUB(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
261 0x800000 + (_x)))
262#endif /* _STANDALONE */
263
264/* 251/*
265 * WARNING: 252 * WARNING:
266 * When certain Hub chip workaround are defined, it's not sufficient 253 * When certain Hub chip workaround are defined, it's not sufficient
@@ -327,20 +314,6 @@
327 PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET) 314 PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET)
328#define ARCS_SPB_SIZE 0x0400 315#define ARCS_SPB_SIZE 0x0400
329 316
330#ifdef _STANDALONE
331
332#define ARCS_TVECTOR_OFFSET 0x2800
333#define ARCS_PVECTOR_OFFSET 0x2c00
334
335/*
336 * These addresses are used by the master CPU to install the transfer
337 * and private vectors. All others use the SPB to find them.
338 */
339#define TVADDR (NODE_CAC_BASE(get_nasid()) + ARCS_TVECTOR_OFFSET)
340#define PVADDR (NODE_CAC_BASE(get_nasid()) + ARCS_PVECTOR_OFFSET)
341
342#endif /* _STANDALONE */
343
344#define KLDIR_OFFSET 0x2000 317#define KLDIR_OFFSET 0x2000
345#define KLDIR_ADDR(nasid) \ 318#define KLDIR_ADDR(nasid) \
346 TO_NODE_UNCAC((nasid), KLDIR_OFFSET) 319 TO_NODE_UNCAC((nasid), KLDIR_OFFSET)
diff --git a/include/asm-mips/sn/sn0/sn0_fru.h b/include/asm-mips/sn/fru.h
index 82c6377c275a..b3e3606723b7 100644
--- a/include/asm-mips/sn/sn0/sn0_fru.h
+++ b/include/asm-mips/sn/fru.h
@@ -6,10 +6,10 @@
6 * Derived from IRIX <sys/SN/SN0/sn0_fru.h> 6 * Derived from IRIX <sys/SN/SN0/sn0_fru.h>
7 * 7 *
8 * Copyright (C) 1992 - 1997, 1999 Silcon Graphics, Inc. 8 * Copyright (C) 1992 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org) 9 * Copyright (C) 1999, 2006 Ralf Baechle (ralf@linux-mips)
10 */ 10 */
11#ifndef _ASM_SN_SN0_SN0_FRU_H 11#ifndef __ASM_SN_FRU_H
12#define _ASM_SN_SN0_SN0_FRU_H 12#define __ASM_SN_FRU_H
13 13
14#define MAX_DIMMS 8 /* max # of dimm banks */ 14#define MAX_DIMMS 8 /* max # of dimm banks */
15#define MAX_PCIDEV 8 /* max # of pci devices on a pci bus */ 15#define MAX_PCIDEV 8 /* max # of pci devices on a pci bus */
@@ -41,4 +41,4 @@ typedef struct kf_pci_bus_s {
41 /* confidence level that the pci dev is bad */ 41 /* confidence level that the pci dev is bad */
42} kf_pci_bus_t; 42} kf_pci_bus_t;
43 43
44#endif /* _ASM_SN_SN0_SN0_FRU_H */ 44#endif /* __ASM_SN_FRU_H */
diff --git a/include/asm-mips/sn/klconfig.h b/include/asm-mips/sn/klconfig.h
index 9709ff701d9b..dc706268d2cf 100644
--- a/include/asm-mips/sn/klconfig.h
+++ b/include/asm-mips/sn/klconfig.h
@@ -37,7 +37,7 @@
37//#include <sys/SN/router.h> 37//#include <sys/SN/router.h>
38// XXX Stolen from <sys/SN/router.h>: 38// XXX Stolen from <sys/SN/router.h>:
39#define MAX_ROUTER_PORTS (6) /* Max. number of ports on a router */ 39#define MAX_ROUTER_PORTS (6) /* Max. number of ports on a router */
40#include <asm/sn/sn0/sn0_fru.h> 40#include <asm/sn/fru.h>
41//#include <sys/graph.h> 41//#include <sys/graph.h>
42//#include <sys/xtalk/xbow.h> 42//#include <sys/xtalk/xbow.h>
43 43
@@ -54,32 +54,21 @@
54#include <asm/sn/agent.h> 54#include <asm/sn/agent.h>
55#include <asm/arc/types.h> 55#include <asm/arc/types.h>
56#include <asm/arc/hinv.h> 56#include <asm/arc/hinv.h>
57#if defined(CONFIG_SGI_IO) || defined(CONFIG_SGI_IP35) 57#if defined(CONFIG_SGI_IP35)
58// The hack file has to be before vector and after sn0_fru.... 58// The hack file has to be before vector and after sn0_fru....
59#include <asm/hack.h> 59#include <asm/hack.h>
60#include <asm/sn/vector.h> 60#include <asm/sn/vector.h>
61#include <asm/xtalk/xtalk.h> 61#include <asm/xtalk/xtalk.h>
62#endif /* CONFIG_SGI_IO || CONFIG_SGI_IP35 */ 62#endif /* CONFIG_SGI_IP35 */
63#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */ 63#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */
64 64
65#define KLCFGINFO_MAGIC 0xbeedbabe 65#define KLCFGINFO_MAGIC 0xbeedbabe
66 66
67#ifdef FRUTEST
68typedef u64 klconf_off_t;
69#else
70typedef s32 klconf_off_t; 67typedef s32 klconf_off_t;
71#endif
72 68
73/* 69/*
74 * Some IMPORTANT OFFSETS. These are the offsets on all NODES. 70 * Some IMPORTANT OFFSETS. These are the offsets on all NODES.
75 */ 71 */
76#if 0
77#define RAMBASE 0
78#define ARCSSPB_OFF 0x1000 /* shift it to sys/arcs/spb.h */
79
80#define OFF_HWGRAPH 0
81#endif
82
83#define MAX_MODULE_ID 255 72#define MAX_MODULE_ID 255
84#define SIZE_PAD 4096 /* 4k padding for structures */ 73#define SIZE_PAD 4096 /* 4k padding for structures */
85/* 74/*
@@ -134,15 +123,9 @@ typedef s32 klconf_off_t;
134 123
135 124
136typedef struct console_s { 125typedef struct console_s {
137#if defined(CONFIG_SGI_IO) /* FIXME */
138 __psunsigned_t uart_base;
139 __psunsigned_t config_base;
140 __psunsigned_t memory_base;
141#else
142 unsigned long uart_base; 126 unsigned long uart_base;
143 unsigned long config_base; 127 unsigned long config_base;
144 unsigned long memory_base; 128 unsigned long memory_base;
145#endif
146 short baud; 129 short baud;
147 short flag; 130 short flag;
148 int type; 131 int type;
@@ -174,10 +157,6 @@ typedef struct kl_config_hdr {
174 157
175 158
176#define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid))) 159#define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid)))
177#if 0
178#define KL_CONFIG_MALLOC_HDR(_nasid) \
179 (KL_CONFIG_HDR(_nasid)->ch_malloc_hdr)
180#endif
181#define KL_CONFIG_INFO_OFFSET(_nasid) \ 160#define KL_CONFIG_INFO_OFFSET(_nasid) \
182 (KL_CONFIG_HDR(_nasid)->ch_board_info) 161 (KL_CONFIG_HDR(_nasid)->ch_board_info)
183#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off) \ 162#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off) \
@@ -197,23 +176,13 @@ typedef struct kl_config_hdr {
197 176
198/* --- New Macros for the changed kl_config_hdr_t structure --- */ 177/* --- New Macros for the changed kl_config_hdr_t structure --- */
199 178
200#if defined(CONFIG_SGI_IO)
201#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
202 ((__psunsigned_t)_k + (_k->ch_malloc_hdr_off)))
203#else
204#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\ 179#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
205 (unsigned long)_k + (_k->ch_malloc_hdr_off))) 180 (unsigned long)_k + (_k->ch_malloc_hdr_off)))
206#endif
207 181
208#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n)) 182#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
209 183
210#if defined(CONFIG_SGI_IO)
211#define PTR_CH_CONS_INFO(_k) ((console_t *)\
212 ((__psunsigned_t)_k + (_k->ch_cons_off)))
213#else
214#define PTR_CH_CONS_INFO(_k) ((console_t *)\ 184#define PTR_CH_CONS_INFO(_k) ((console_t *)\
215 ((unsigned long)_k + (_k->ch_cons_off))) 185 ((unsigned long)_k + (_k->ch_cons_off)))
216#endif
217 186
218#define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n)) 187#define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))
219 188
@@ -490,14 +459,6 @@ typedef struct lboard_s {
490#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts) 459#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts)
491#define KLCF_MODULE_ID(_brd) ((_brd)->brd_module) 460#define KLCF_MODULE_ID(_brd) ((_brd)->brd_module)
492 461
493#ifdef FRUTEST
494
495#define KLCF_NEXT(_brd) ((_brd)->brd_next ? (lboard_t *)((_brd)->brd_next): NULL)
496#define KLCF_COMP(_brd, _ndx) (klinfo_t *)((_brd)->brd_compts[(_ndx)])
497#define KLCF_COMP_ERROR(_brd, _comp) (_brd = _brd , (_comp)->errinfo)
498
499#else
500
501#define KLCF_NEXT(_brd) \ 462#define KLCF_NEXT(_brd) \
502 ((_brd)->brd_next ? \ 463 ((_brd)->brd_next ? \
503 (lboard_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), (_brd)->brd_next)):\ 464 (lboard_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), (_brd)->brd_next)):\
@@ -509,8 +470,6 @@ typedef struct lboard_s {
509#define KLCF_COMP_ERROR(_brd, _comp) \ 470#define KLCF_COMP_ERROR(_brd, _comp) \
510 (NODE_OFFSET_TO_K1(NASID_GET(_brd), (_comp)->errinfo)) 471 (NODE_OFFSET_TO_K1(NASID_GET(_brd), (_comp)->errinfo))
511 472
512#endif
513
514#define KLCF_COMP_TYPE(_comp) ((_comp)->struct_type) 473#define KLCF_COMP_TYPE(_comp) ((_comp)->struct_type)
515#define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid) /* Widget ID */ 474#define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid) /* Widget ID */
516 475
@@ -631,18 +590,6 @@ typedef struct klport_s {
631 klconf_off_t port_offset; 590 klconf_off_t port_offset;
632} klport_t; 591} klport_t;
633 592
634#if 0
635/*
636 * This is very similar to the klport_s but instead of having a componant
637 * offset it has a board offset.
638 */
639typedef struct klxbow_port_s {
640 nasid_t port_nasid;
641 unsigned char port_flag;
642 klconf_off_t board_offset;
643} klxbow_port_t;
644#endif
645
646typedef struct klcpu_s { /* CPU */ 593typedef struct klcpu_s { /* CPU */
647 klinfo_t cpu_info; 594 klinfo_t cpu_info;
648 unsigned short cpu_prid; /* Processor PRID value */ 595 unsigned short cpu_prid; /* Processor PRID value */
@@ -945,36 +892,6 @@ extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
945extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class); 892extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class);
946 893
947 894
948#if defined(CONFIG_SGI_IO)
949extern xwidgetnum_t nodevertex_widgetnum_get(vertex_hdl_t node_vtx);
950extern vertex_hdl_t nodevertex_xbow_peer_get(vertex_hdl_t node_vtx);
951extern lboard_t *find_gfxpipe(int pipenum);
952extern void setup_gfxpipe_link(vertex_hdl_t vhdl,int pipenum);
953extern lboard_t *find_lboard_module_class(lboard_t *start, moduleid_t mod,
954 unsigned char brd_class);
955extern lboard_t *find_nic_lboard(lboard_t *, nic_t);
956extern lboard_t *find_nic_type_lboard(nasid_t, unsigned char, nic_t);
957extern lboard_t *find_lboard_modslot(lboard_t *start, moduleid_t mod, slotid_t slot);
958extern lboard_t *find_lboard_module(lboard_t *start, moduleid_t mod);
959extern lboard_t *get_board_name(nasid_t nasid, moduleid_t mod, slotid_t slot, char *name);
960extern int config_find_nic_router(nasid_t, nic_t, lboard_t **, klrou_t**);
961extern int config_find_nic_hub(nasid_t, nic_t, lboard_t **, klhub_t**);
962extern int config_find_xbow(nasid_t, lboard_t **, klxbow_t**);
963extern klcpu_t *get_cpuinfo(cpuid_t cpu);
964extern int update_klcfg_cpuinfo(nasid_t, int);
965extern void board_to_path(lboard_t *brd, char *path);
966extern moduleid_t get_module_id(nasid_t nasid);
967extern void nic_name_convert(char *old_name, char *new_name);
968extern int module_brds(nasid_t nasid, lboard_t **module_brds, int n);
969extern lboard_t *brd_from_key(ulong_t key);
970extern void device_component_canonical_name_get(lboard_t *,klinfo_t *,
971 char *);
972extern int board_serial_number_get(lboard_t *,char *);
973extern int is_master_baseio(nasid_t,moduleid_t,slotid_t);
974extern nasid_t get_actual_nasid(lboard_t *brd) ;
975extern net_vec_t klcfg_discover_route(lboard_t *, lboard_t *, int);
976#else /* CONFIG_SGI_IO */
977extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu); 895extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu);
978#endif /* CONFIG_SGI_IO */
979 896
980#endif /* _ASM_SN_KLCONFIG_H */ 897#endif /* _ASM_SN_KLCONFIG_H */
diff --git a/include/asm-mips/sn/kldir.h b/include/asm-mips/sn/kldir.h
index f0efab1672ec..97ad52e3cbc7 100644
--- a/include/asm-mips/sn/kldir.h
+++ b/include/asm-mips/sn/kldir.h
@@ -13,10 +13,6 @@
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15 15
16#if defined(CONFIG_SGI_IO)
17#include <asm/hack.h>
18#endif
19
20/* 16/*
21 * The kldir memory area resides at a fixed place in each node's memory and 17 * The kldir memory area resides at a fixed place in each node's memory and
22 * provides pointers to most other IP27 memory areas. This allows us to 18 * provides pointers to most other IP27 memory areas. This allows us to
@@ -136,8 +132,6 @@
136#define KLDIR_OFF_STRIDE 0x28 132#define KLDIR_OFF_STRIDE 0x28
137#endif /* __ASSEMBLY__ */ 133#endif /* __ASSEMBLY__ */
138 134
139#if !defined(CONFIG_SGI_IO)
140
141/* 135/*
142 * This is defined here because IP27_SYMMON_STK_SIZE must be at least what 136 * This is defined here because IP27_SYMMON_STK_SIZE must be at least what
143 * we define here. Since it's set up in the prom. We can't redefine it later 137 * we define here. Since it's set up in the prom. We can't redefine it later
@@ -147,7 +141,7 @@
147 */ 141 */
148#define SYMMON_STACK_SIZE 0x8000 142#define SYMMON_STACK_SIZE 0x8000
149 143
150#if defined (PROM) || defined (SABLE) 144#if defined (PROM)
151 145
152/* 146/*
153 * These defines are prom version dependent. No code other than the IP27 147 * These defines are prom version dependent. No code other than the IP27
@@ -184,7 +178,7 @@
184#define IP27_FREEMEM_COUNT 1 178#define IP27_FREEMEM_COUNT 1
185#define IP27_FREEMEM_STRIDE 0 179#define IP27_FREEMEM_STRIDE 0
186 180
187#endif /* PROM || SABLE*/ 181#endif /* PROM */
188/* 182/*
189 * There will be only one of these in a partition so the IO6 must set it up. 183 * There will be only one of these in a partition so the IO6 must set it up.
190 */ 184 */
@@ -207,17 +201,11 @@
207#define KLDIR_ENT_SIZE 0x40 201#define KLDIR_ENT_SIZE 0x40
208#define KLDIR_MAX_ENTRIES (0x400 / 0x40) 202#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
209 203
210#endif /* !CONFIG_SGI_IO */
211
212#ifndef __ASSEMBLY__ 204#ifndef __ASSEMBLY__
213typedef struct kldir_ent_s { 205typedef struct kldir_ent_s {
214 u64 magic; /* Indicates validity of entry */ 206 u64 magic; /* Indicates validity of entry */
215 off_t offset; /* Offset from start of node space */ 207 off_t offset; /* Offset from start of node space */
216#if defined(CONFIG_SGI_IO) /* FIXME */
217 __psunsigned_t pointer; /* Pointer to area in some cases */
218#else
219 unsigned long pointer; /* Pointer to area in some cases */ 208 unsigned long pointer; /* Pointer to area in some cases */
220#endif
221 size_t size; /* Size in bytes */ 209 size_t size; /* Size in bytes */
222 u64 count; /* Repeat count if array, 1 if not */ 210 u64 count; /* Repeat count if array, 1 if not */
223 size_t stride; /* Stride if array, 0 if not */ 211 size_t stride; /* Stride if array, 0 if not */
@@ -227,22 +215,4 @@ typedef struct kldir_ent_s {
227} kldir_ent_t; 215} kldir_ent_t;
228#endif /* !__ASSEMBLY__ */ 216#endif /* !__ASSEMBLY__ */
229 217
230#if defined(CONFIG_SGI_IO)
231
232#define KLDIR_ENT_SIZE 0x40
233#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
234
235/*
236 * The actual offsets of each memory area are machine-dependent
237 */
238#ifdef CONFIG_SGI_IP27
239// Not yet #include <asm/sn/sn0/kldir.h>
240#elif defined(CONFIG_SGI_IP35)
241#include <asm/sn/sn1/kldir.h>
242#else
243#error "kldir.h is currently defined for IP27 and IP35 platforms only"
244#endif
245
246#endif /* CONFIG_SGI_IO */
247
248#endif /* _ASM_SN_KLDIR_H */ 218#endif /* _ASM_SN_KLDIR_H */
diff --git a/include/asm-mips/sn/sn0/addrs.h b/include/asm-mips/sn/sn0/addrs.h
index 398815639fb8..2c4b758f6736 100644
--- a/include/asm-mips/sn/sn0/addrs.h
+++ b/include/asm-mips/sn/sn0/addrs.h
@@ -49,7 +49,7 @@
49 * so for now we just use defines bracketed by an ifdef. 49 * so for now we just use defines bracketed by an ifdef.
50 */ 50 */
51 51
52#ifdef CONFIG_SGI_SN0_N_MODE 52#ifdef CONFIG_SGI_SN_N_MODE
53 53
54#define NODE_SIZE_BITS 31 54#define NODE_SIZE_BITS 31
55#define BWIN_SIZE_BITS 28 55#define BWIN_SIZE_BITS 28
@@ -63,7 +63,7 @@
63#define BDDIR_UPPER_MASK (UINT64_CAST 0x7ffff << 10) 63#define BDDIR_UPPER_MASK (UINT64_CAST 0x7ffff << 10)
64#define BDECC_UPPER_MASK (UINT64_CAST 0x3ffffff << 3) 64#define BDECC_UPPER_MASK (UINT64_CAST 0x3ffffff << 3)
65 65
66#else /* !defined(CONFIG_SGI_SN0_N_MODE), assume that M-mode is desired */ 66#else /* !defined(CONFIG_SGI_SN_N_MODE), assume that M-mode is desired */
67 67
68#define NODE_SIZE_BITS 32 68#define NODE_SIZE_BITS 32
69#define BWIN_SIZE_BITS 29 69#define BWIN_SIZE_BITS 29
@@ -77,7 +77,7 @@
77#define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10) 77#define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10)
78#define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3) 78#define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3)
79 79
80#endif /* !defined(CONFIG_SGI_SN0_N_MODE) */ 80#endif /* !defined(CONFIG_SGI_SN_N_MODE) */
81 81
82#define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS) 82#define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS)
83 83
@@ -85,15 +85,15 @@
85#define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >> \ 85#define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >> \
86 NASID_SHFT) & NASID_BITMASK) 86 NASID_SHFT) & NASID_BITMASK)
87 87
88#if !defined(__ASSEMBLY__) && !defined(_STANDALONE) 88#if !defined(__ASSEMBLY__)
89 89
90#define NODE_SWIN_BASE(nasid, widget) \ 90#define NODE_SWIN_BASE(nasid, widget) \
91 ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN) \ 91 ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN) \
92 : RAW_NODE_SWIN_BASE(nasid, widget)) 92 : RAW_NODE_SWIN_BASE(nasid, widget))
93#else /* __ASSEMBLY__ || _STANDALONE */ 93#else /* __ASSEMBLY__ */
94#define NODE_SWIN_BASE(nasid, widget) \ 94#define NODE_SWIN_BASE(nasid, widget) \
95 (NODE_IO_BASE(nasid) + (UINT64_CAST (widget) << SWIN_SIZE_BITS)) 95 (NODE_IO_BASE(nasid) + (UINT64_CAST (widget) << SWIN_SIZE_BITS))
96#endif /* __ASSEMBLY__ || _STANDALONE */ 96#endif /* __ASSEMBLY__ */
97 97
98/* 98/*
99 * The following definitions pertain to the IO special address 99 * The following definitions pertain to the IO special address
@@ -143,12 +143,7 @@
143#define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid))) 143#define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid)))
144 144
145/* Turn on sable logging for the processors whose bits are set. */ 145/* Turn on sable logging for the processors whose bits are set. */
146#ifdef SABLE
147#define SABLE_LOG_TRIGGER(_map) \
148 *((volatile hubreg_t *)(IO_BASE + 0x17ffff0)) = (_map)
149#else
150#define SABLE_LOG_TRIGGER(_map) 146#define SABLE_LOG_TRIGGER(_map)
151#endif /* SABLE */
152 147
153#ifndef __ASSEMBLY__ 148#ifndef __ASSEMBLY__
154#define KERN_NMI_ADDR(nasid, slice) \ 149#define KERN_NMI_ADDR(nasid, slice) \
@@ -281,76 +276,6 @@
281 276
282#define _ARCSPROM 277#define _ARCSPROM
283 278
284#ifdef _STANDALONE
285
286/*
287 * The PROM needs to pass the device base address and the
288 * device pci cfg space address to the device drivers during
289 * install. The COMPONENT->Key field is used for this purpose.
290 * Macros needed by SN0 device drivers to convert the
291 * COMPONENT->Key field to the respective base address.
292 * Key field looks as follows:
293 *
294 * +----------------------------------------------------+
295 * |devnasid | widget |pciid |hubwidid|hstnasid | adap |
296 * | 2 | 1 | 1 | 1 | 2 | 1 |
297 * +----------------------------------------------------+
298 * | | | | | | |
299 * 64 48 40 32 24 8 0
300 *
301 * These are used by standalone drivers till the io infrastructure
302 * is in place.
303 */
304
305#ifndef __ASSEMBLY__
306
307#define uchar unsigned char
308
309#define KEY_DEVNASID_SHFT 48
310#define KEY_WIDID_SHFT 40
311#define KEY_PCIID_SHFT 32
312#define KEY_HUBWID_SHFT 24
313#define KEY_HSTNASID_SHFT 8
314
315#define MK_SN0_KEY(nasid, widid, pciid) \
316 ((((__psunsigned_t)nasid)<< KEY_DEVNASID_SHFT |\
317 ((__psunsigned_t)widid) << KEY_WIDID_SHFT) |\
318 ((__psunsigned_t)pciid) << KEY_PCIID_SHFT)
319
320#define ADD_HUBWID_KEY(key,hubwid)\
321 (key|=((__psunsigned_t)hubwid << KEY_HUBWID_SHFT))
322
323#define ADD_HSTNASID_KEY(key,hstnasid)\
324 (key|=((__psunsigned_t)hstnasid << KEY_HSTNASID_SHFT))
325
326#define GET_DEVNASID_FROM_KEY(key) ((short)(key >> KEY_DEVNASID_SHFT))
327#define GET_WIDID_FROM_KEY(key) ((uchar)(key >> KEY_WIDID_SHFT))
328#define GET_PCIID_FROM_KEY(key) ((uchar)(key >> KEY_PCIID_SHFT))
329#define GET_HUBWID_FROM_KEY(key) ((uchar)(key >> KEY_HUBWID_SHFT))
330#define GET_HSTNASID_FROM_KEY(key) ((short)(key >> KEY_HSTNASID_SHFT))
331
332#define PCI_64_TARGID_SHFT 60
333
334#define GET_PCIBASE_FROM_KEY(key) (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
335 GET_WIDID_FROM_KEY(key))\
336 | BRIDGE_DEVIO(GET_PCIID_FROM_KEY(key)))
337
338#define GET_PCICFGBASE_FROM_KEY(key) \
339 (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
340 GET_WIDID_FROM_KEY(key))\
341 | BRIDGE_TYPE0_CFG_DEV(GET_PCIID_FROM_KEY(key)))
342
343#define GET_WIDBASE_FROM_KEY(key) \
344 (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
345 GET_WIDID_FROM_KEY(key)))
346
347#define PUT_INSTALL_STATUS(c,s) c->Revision = s
348#define GET_INSTALL_STATUS(c) c->Revision
349
350#endif /* !__ASSEMBLY__ */
351
352#endif /* _STANDALONE */
353
354#if defined (HUB_ERR_STS_WAR) 279#if defined (HUB_ERR_STS_WAR)
355 280
356#define ERR_STS_WAR_REGISTER IIO_IIBUSERR 281#define ERR_STS_WAR_REGISTER IIO_IIBUSERR
diff --git a/include/asm-mips/sn/sn0/arch.h b/include/asm-mips/sn/sn0/arch.h
index fb78773a5efe..f7c43fa24aa8 100644
--- a/include/asm-mips/sn/sn0/arch.h
+++ b/include/asm-mips/sn/sn0/arch.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15 15
16#ifndef SABLE
17
18#ifndef SN0XXL /* 128 cpu SMP max */ 16#ifndef SN0XXL /* 128 cpu SMP max */
19/* 17/*
20 * This is the maximum number of nodes that can be part of a kernel. 18 * This is the maximum number of nodes that can be part of a kernel.
@@ -54,25 +52,16 @@
54 */ 52 */
55#define MAX_PARTITIONS MAX_REGIONS 53#define MAX_PARTITIONS MAX_REGIONS
56 54
57
58#else
59
60#define MAX_COMPACT_NODES 4
61#define MAX_NASIDS 4
62#define MAXCPUS 8
63
64#endif
65
66#define NASID_MASK_BYTES ((MAX_NASIDS + 7) / 8) 55#define NASID_MASK_BYTES ((MAX_NASIDS + 7) / 8)
67 56
68/* 57/*
69 * Slot constants for SN0 58 * Slot constants for SN0
70 */ 59 */
71#ifdef CONFIG_SGI_SN0_N_MODE 60#ifdef CONFIG_SGI_SN_N_MODE
72#define MAX_MEM_SLOTS 16 /* max slots per node */ 61#define MAX_MEM_SLOTS 16 /* max slots per node */
73#else /* !CONFIG_SGI_SN0_N_MODE, assume M_MODE */ 62#else /* !CONFIG_SGI_SN_N_MODE, assume CONFIG_SGI_SN_M_MODE */
74#define MAX_MEM_SLOTS 32 /* max slots per node */ 63#define MAX_MEM_SLOTS 32 /* max slots per node */
75#endif /* defined(N_MODE) */ 64#endif /* CONFIG_SGI_SN_M_MODE */
76 65
77#define SLOT_SHIFT (27) 66#define SLOT_SHIFT (27)
78#define SLOT_MIN_MEM_SIZE (32*1024*1024) 67#define SLOT_MIN_MEM_SIZE (32*1024*1024)
diff --git a/include/asm-mips/sn/sn0/hub.h b/include/asm-mips/sn/sn0/hub.h
index f5dbba6f4610..3e228f8e7969 100644
--- a/include/asm-mips/sn/sn0/hub.h
+++ b/include/asm-mips/sn/sn0/hub.h
@@ -31,10 +31,6 @@
31#include <asm/sn/sn0/hubni.h> 31#include <asm/sn/sn0/hubni.h>
32//#include <asm/sn/sn0/hubcore.h> 32//#include <asm/sn/sn0/hubcore.h>
33 33
34#ifdef SABLE
35#define IP27_NO_HUBUART_INT 1
36#endif
37
38/* Translation of uncached attributes */ 34/* Translation of uncached attributes */
39#define UATTR_HSPEC 0 35#define UATTR_HSPEC 0
40#define UATTR_IO 1 36#define UATTR_IO 1
diff --git a/include/asm-mips/sn/sn0/hubio.h b/include/asm-mips/sn/sn0/hubio.h
index f314da21b970..ef91b3363554 100644
--- a/include/asm-mips/sn/sn0/hubio.h
+++ b/include/asm-mips/sn/sn0/hubio.h
@@ -486,22 +486,6 @@ typedef union h1_icrba_u {
486#define ICRBN_A_CERR_SHFT 54 486#define ICRBN_A_CERR_SHFT 54
487#define ICRBN_A_ERR_MASK 0x3ff 487#define ICRBN_A_ERR_MASK 0x3ff
488 488
489#if 0 /* Disabled, this causes namespace polution and break allmodconfig */
490/*
491 * Easy access macros.
492 */
493#define a_error icrba_fields_s.error
494#define a_ecode icrba_fields_s.ecode
495#define a_lnetuce icrba_fields_s.lnetuce
496#define a_mark icrba_fields_s.mark
497#define a_xerr icrba_fields_s.xerr
498#define a_sidn icrba_fields_s.sidn
499#define a_tnum icrba_fields_s.tnum
500#define a_addr icrba_fields_s.addr
501#define a_valid icrba_fields_s.valid
502#define a_iow icrba_fields_s.iow
503#endif
504
505#endif /* !__ASSEMBLY__ */ 489#endif /* !__ASSEMBLY__ */
506 490
507#define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */ 491#define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */
diff --git a/include/asm-mips/sn/sn0/hubmd.h b/include/asm-mips/sn/sn0/hubmd.h
index a66def4e0ba0..1006aa26d771 100644
--- a/include/asm-mips/sn/sn0/hubmd.h
+++ b/include/asm-mips/sn/sn0/hubmd.h
@@ -92,7 +92,7 @@
92#define MD_UREG1_14 0x2200f0 /* uController/UART 1 register */ 92#define MD_UREG1_14 0x2200f0 /* uController/UART 1 register */
93#define MD_UREG1_15 0x2200f8 /* uController/UART 1 register */ 93#define MD_UREG1_15 0x2200f8 /* uController/UART 1 register */
94 94
95#ifdef CONFIG_SGI_SN0_N_MODE 95#ifdef CONFIG_SGI_SN_N_MODE
96#define MD_MEM_BANKS 4 /* 4 banks of memory max in N mode */ 96#define MD_MEM_BANKS 4 /* 4 banks of memory max in N mode */
97#else 97#else
98#define MD_MEM_BANKS 8 /* 8 banks of memory max in M mode */ 98#define MD_MEM_BANKS 8 /* 8 banks of memory max in M mode */
diff --git a/include/asm-mips/sn/sn0/hubpi.h b/include/asm-mips/sn/sn0/hubpi.h
index 355bba8552e3..e39f5f9da040 100644
--- a/include/asm-mips/sn/sn0/hubpi.h
+++ b/include/asm-mips/sn/sn0/hubpi.h
@@ -398,24 +398,6 @@ typedef u64 rtc_time_t;
398 398
399/* PI_RT_FILTER_CTRL mask and shift definitions */ 399/* PI_RT_FILTER_CTRL mask and shift definitions */
400 400
401#if 0
402/*
403 * XXX - This register's definition has changed, but it's only implemented
404 * in Hub 2.
405 */
406#define PRFC_DROP_COUNT_SHFT 27
407#define PRFC_DROP_COUNT_MASK (UINT64_CAST 0x3ff << 27)
408#define PRFC_DROP_CTR_SHFT 18
409#define PRFC_DROP_CTR_MASK (UINT64_CAST 0x1ff << 18)
410#define PRFC_MASK_ENABLE_SHFT 10
411#define PRFC_MASK_ENABLE_MASK (UINT64_CAST 0x7f << 10)
412#define PRFC_MASK_CTR_SHFT 2
413#define PRFC_MASK_CTR_MASK (UINT64_CAST 0xff << 2)
414#define PRFC_OFFSET_SHFT 0
415#define PRFC_OFFSET_MASK (UINT64_CAST 3)
416#endif /* 0 */
417
418
419/* 401/*
420 * Bits for NACK_CNT_A/B and NACK_CMP 402 * Bits for NACK_CNT_A/B and NACK_CMP
421 */ 403 */
diff --git a/include/asm-mips/sn/sn0/ip27.h b/include/asm-mips/sn/sn0/ip27.h
index ade0e974dd78..3c97e0855c8d 100644
--- a/include/asm-mips/sn/sn0/ip27.h
+++ b/include/asm-mips/sn/sn0/ip27.h
@@ -6,7 +6,7 @@
6 * Derived from IRIX <sys/SN/SN0/IP27.h>. 6 * Derived from IRIX <sys/SN/SN0/IP27.h>.
7 * 7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc. 8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle 9 * Copyright (C) 1999, 2006 by Ralf Baechle
10 */ 10 */
11#ifndef _ASM_SN_SN0_IP27_H 11#ifndef _ASM_SN_SN0_IP27_H
12#define _ASM_SN_SN0_IP27_H 12#define _ASM_SN_SN0_IP27_H
@@ -82,11 +82,4 @@
82#define SEND_NMI(_nasid, _slice) \ 82#define SEND_NMI(_nasid, _slice) \
83 REMOTE_HUB_S((_nasid), (PI_NMI_A + ((_slice) * PI_NMI_OFFSET)), 1) 83 REMOTE_HUB_S((_nasid), (PI_NMI_A + ((_slice) * PI_NMI_OFFSET)), 1)
84 84
85/* Sanity hazzard ... Below all the Origin hacks are following. */
86
87#define SN00_BRIDGE 0x9200000008000000
88#define SN00I_BRIDGE0 0x920000000b000000
89#define SN00I_BRIDGE1 0x920000000e000000
90#define SN00I_BRIDGE2 0x920000000f000000
91
92#endif /* _ASM_SN_SN0_IP27_H */ 85#endif /* _ASM_SN_SN0_IP27_H */
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index b3bc698dfdee..b9ba54d0dd35 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -15,9 +15,6 @@
15/* 15/*
16 * ASIC PCI registers for little endian configuration. 16 * ASIC PCI registers for little endian configuration.
17 */ 17 */
18#ifndef __MIPSEL__
19#error "Fix me for big endian"
20#endif
21#define PCIMT_UCONF 0xbfff0000 18#define PCIMT_UCONF 0xbfff0000
22#define PCIMT_IOADTIMEOUT2 0xbfff0008 19#define PCIMT_IOADTIMEOUT2 0xbfff0008
23#define PCIMT_IOMEMCONF 0xbfff0010 20#define PCIMT_IOMEMCONF 0xbfff0010
@@ -51,9 +48,9 @@
51#define PCIMT_PCI_CONF 0xbfff0100 48#define PCIMT_PCI_CONF 0xbfff0100
52 49
53/* 50/*
54 * Data port for the PCI bus. 51 * Data port for the PCI bus in IO space
55 */ 52 */
56#define PCIMT_CONFIG_DATA 0xb4000cfc 53#define PCIMT_CONFIG_DATA 0x0cfc
57 54
58/* 55/*
59 * Board specific registers 56 * Board specific registers
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
index ad374bd3f130..70636b41832c 100644
--- a/include/asm-mips/war.h
+++ b/include/asm-mips/war.h
@@ -172,7 +172,8 @@
172 * On the RM9000 there is a problem which makes the CreateDirtyExclusive 172 * On the RM9000 there is a problem which makes the CreateDirtyExclusive
173 * cache operation unusable on SMP systems. 173 * cache operation unusable on SMP systems.
174 */ 174 */
175#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_PMC_YOSEMITE) 175#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_PMC_YOSEMITE) || \
176 defined(CONFIG_BASLER_EXCITE)
176#define RM9000_CDEX_SMP_WAR 1 177#define RM9000_CDEX_SMP_WAR 1
177#endif 178#endif
178 179
@@ -182,7 +183,7 @@
182 * being fetched may case spurious exceptions. 183 * being fetched may case spurious exceptions.
183 */ 184 */
184#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_MOMENCO_OCELOT_3) || \ 185#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_MOMENCO_OCELOT_3) || \
185 defined(CONFIG_PMC_YOSEMITE) 186 defined(CONFIG_PMC_YOSEMITE) || defined(CONFIG_BASLER_EXCITE)
186#define ICACHE_REFILLS_WORKAROUND_WAR 1 187#define ICACHE_REFILLS_WORKAROUND_WAR 1
187#endif 188#endif
188 189
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 9fcf0162d859..f6265c2a0dd2 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -329,7 +329,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
329#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 329#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
330 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 330 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
331 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 331 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
332 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO) 332 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
333#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 333#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
334 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) 334 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
335#endif 335#endif
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h
index 40c25e166a9b..1802775568b9 100644
--- a/include/asm-s390/futex.h
+++ b/include/asm-s390/futex.h
@@ -11,23 +11,24 @@
11#define __futex_atomic_fixup \ 11#define __futex_atomic_fixup \
12 ".section __ex_table,\"a\"\n" \ 12 ".section __ex_table,\"a\"\n" \
13 " .align 4\n" \ 13 " .align 4\n" \
14 " .long 0b,2b,1b,2b\n" \ 14 " .long 0b,4b,2b,4b,3b,4b\n" \
15 ".previous" 15 ".previous"
16#else /* __s390x__ */ 16#else /* __s390x__ */
17#define __futex_atomic_fixup \ 17#define __futex_atomic_fixup \
18 ".section __ex_table,\"a\"\n" \ 18 ".section __ex_table,\"a\"\n" \
19 " .align 8\n" \ 19 " .align 8\n" \
20 " .quad 0b,2b,1b,2b\n" \ 20 " .quad 0b,4b,2b,4b,3b,4b\n" \
21 ".previous" 21 ".previous"
22#endif /* __s390x__ */ 22#endif /* __s390x__ */
23 23
24#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \ 24#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
25 asm volatile(" l %1,0(%6)\n" \ 25 asm volatile(" sacf 256\n" \
26 "0: " insn \ 26 "0: l %1,0(%6)\n" \
27 " cs %1,%2,0(%6)\n" \ 27 "1: " insn \
28 "1: jl 0b\n" \ 28 "2: cs %1,%2,0(%6)\n" \
29 "3: jl 1b\n" \
29 " lhi %0,0\n" \ 30 " lhi %0,0\n" \
30 "2:\n" \ 31 "4: sacf 0\n" \
31 __futex_atomic_fixup \ 32 __futex_atomic_fixup \
32 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ 33 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
33 "=m" (*uaddr) \ 34 "=m" (*uaddr) \
diff --git a/include/linux/console.h b/include/linux/console.h
index 721371382ae5..08734e660d41 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -117,6 +117,10 @@ extern void console_stop(struct console *);
117extern void console_start(struct console *); 117extern void console_start(struct console *);
118extern int is_console_locked(void); 118extern int is_console_locked(void);
119 119
120/* Suspend and resume console messages over PM events */
121extern void suspend_console(void);
122extern void resume_console(void);
123
120/* Some debug stub to catch some of the obvious races in the VT code */ 124/* Some debug stub to catch some of the obvious races in the VT code */
121#if 1 125#if 1
122#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress) 126#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
new file mode 100644
index 000000000000..78b236ca04f8
--- /dev/null
+++ b/include/linux/dmaengine.h
@@ -0,0 +1,359 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that 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 for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef DMAENGINE_H
22#define DMAENGINE_H
23#include <linux/config.h>
24#ifdef CONFIG_DMA_ENGINE
25
26#include <linux/device.h>
27#include <linux/uio.h>
28#include <linux/kref.h>
29#include <linux/completion.h>
30#include <linux/rcupdate.h>
31
32/**
33 * enum dma_event - resource PNP/power managment events
34 * @DMA_RESOURCE_SUSPEND: DMA device going into low power state
35 * @DMA_RESOURCE_RESUME: DMA device returning to full power
36 * @DMA_RESOURCE_ADDED: DMA device added to the system
37 * @DMA_RESOURCE_REMOVED: DMA device removed from the system
38 */
39enum dma_event {
40 DMA_RESOURCE_SUSPEND,
41 DMA_RESOURCE_RESUME,
42 DMA_RESOURCE_ADDED,
43 DMA_RESOURCE_REMOVED,
44};
45
46/**
47 * typedef dma_cookie_t
48 *
49 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
50 */
51typedef s32 dma_cookie_t;
52
53#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0)
54
55/**
56 * enum dma_status - DMA transaction status
57 * @DMA_SUCCESS: transaction completed successfully
58 * @DMA_IN_PROGRESS: transaction not yet processed
59 * @DMA_ERROR: transaction failed
60 */
61enum dma_status {
62 DMA_SUCCESS,
63 DMA_IN_PROGRESS,
64 DMA_ERROR,
65};
66
67/**
68 * struct dma_chan_percpu - the per-CPU part of struct dma_chan
69 * @refcount: local_t used for open-coded "bigref" counting
70 * @memcpy_count: transaction counter
71 * @bytes_transferred: byte counter
72 */
73
74struct dma_chan_percpu {
75 local_t refcount;
76 /* stats */
77 unsigned long memcpy_count;
78 unsigned long bytes_transferred;
79};
80
81/**
82 * struct dma_chan - devices supply DMA channels, clients use them
83 * @client: ptr to the client user of this chan, will be NULL when unused
84 * @device: ptr to the dma device who supplies this channel, always !NULL
85 * @cookie: last cookie value returned to client
86 * @chan_id:
87 * @class_dev:
88 * @refcount: kref, used in "bigref" slow-mode
89 * @slow_ref:
90 * @rcu:
91 * @client_node: used to add this to the client chan list
92 * @device_node: used to add this to the device chan list
93 * @local: per-cpu pointer to a struct dma_chan_percpu
94 */
95struct dma_chan {
96 struct dma_client *client;
97 struct dma_device *device;
98 dma_cookie_t cookie;
99
100 /* sysfs */
101 int chan_id;
102 struct class_device class_dev;
103
104 struct kref refcount;
105 int slow_ref;
106 struct rcu_head rcu;
107
108 struct list_head client_node;
109 struct list_head device_node;
110 struct dma_chan_percpu *local;
111};
112
113void dma_chan_cleanup(struct kref *kref);
114
115static inline void dma_chan_get(struct dma_chan *chan)
116{
117 if (unlikely(chan->slow_ref))
118 kref_get(&chan->refcount);
119 else {
120 local_inc(&(per_cpu_ptr(chan->local, get_cpu())->refcount));
121 put_cpu();
122 }
123}
124
125static inline void dma_chan_put(struct dma_chan *chan)
126{
127 if (unlikely(chan->slow_ref))
128 kref_put(&chan->refcount, dma_chan_cleanup);
129 else {
130 local_dec(&(per_cpu_ptr(chan->local, get_cpu())->refcount));
131 put_cpu();
132 }
133}
134
135/*
136 * typedef dma_event_callback - function pointer to a DMA event callback
137 */
138typedef void (*dma_event_callback) (struct dma_client *client,
139 struct dma_chan *chan, enum dma_event event);
140
141/**
142 * struct dma_client - info on the entity making use of DMA services
143 * @event_callback: func ptr to call when something happens
144 * @chan_count: number of chans allocated
145 * @chans_desired: number of chans requested. Can be +/- chan_count
146 * @lock: protects access to the channels list
147 * @channels: the list of DMA channels allocated
148 * @global_node: list_head for global dma_client_list
149 */
150struct dma_client {
151 dma_event_callback event_callback;
152 unsigned int chan_count;
153 unsigned int chans_desired;
154
155 spinlock_t lock;
156 struct list_head channels;
157 struct list_head global_node;
158};
159
160/**
161 * struct dma_device - info on the entity supplying DMA services
162 * @chancnt: how many DMA channels are supported
163 * @channels: the list of struct dma_chan
164 * @global_node: list_head for global dma_device_list
165 * @refcount:
166 * @done:
167 * @dev_id:
168 * Other func ptrs: used to make use of this device's capabilities
169 */
170struct dma_device {
171
172 unsigned int chancnt;
173 struct list_head channels;
174 struct list_head global_node;
175
176 struct kref refcount;
177 struct completion done;
178
179 int dev_id;
180
181 int (*device_alloc_chan_resources)(struct dma_chan *chan);
182 void (*device_free_chan_resources)(struct dma_chan *chan);
183 dma_cookie_t (*device_memcpy_buf_to_buf)(struct dma_chan *chan,
184 void *dest, void *src, size_t len);
185 dma_cookie_t (*device_memcpy_buf_to_pg)(struct dma_chan *chan,
186 struct page *page, unsigned int offset, void *kdata,
187 size_t len);
188 dma_cookie_t (*device_memcpy_pg_to_pg)(struct dma_chan *chan,
189 struct page *dest_pg, unsigned int dest_off,
190 struct page *src_pg, unsigned int src_off, size_t len);
191 enum dma_status (*device_memcpy_complete)(struct dma_chan *chan,
192 dma_cookie_t cookie, dma_cookie_t *last,
193 dma_cookie_t *used);
194 void (*device_memcpy_issue_pending)(struct dma_chan *chan);
195};
196
197/* --- public DMA engine API --- */
198
199struct dma_client *dma_async_client_register(dma_event_callback event_callback);
200void dma_async_client_unregister(struct dma_client *client);
201void dma_async_client_chan_request(struct dma_client *client,
202 unsigned int number);
203
204/**
205 * dma_async_memcpy_buf_to_buf - offloaded copy between virtual addresses
206 * @chan: DMA channel to offload copy to
207 * @dest: destination address (virtual)
208 * @src: source address (virtual)
209 * @len: length
210 *
211 * Both @dest and @src must be mappable to a bus address according to the
212 * DMA mapping API rules for streaming mappings.
213 * Both @dest and @src must stay memory resident (kernel memory or locked
214 * user space pages)
215 */
216static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
217 void *dest, void *src, size_t len)
218{
219 int cpu = get_cpu();
220 per_cpu_ptr(chan->local, cpu)->bytes_transferred += len;
221 per_cpu_ptr(chan->local, cpu)->memcpy_count++;
222 put_cpu();
223
224 return chan->device->device_memcpy_buf_to_buf(chan, dest, src, len);
225}
226
227/**
228 * dma_async_memcpy_buf_to_pg - offloaded copy
229 * @chan: DMA channel to offload copy to
230 * @page: destination page
231 * @offset: offset in page to copy to
232 * @kdata: source address (virtual)
233 * @len: length
234 *
235 * Both @page/@offset and @kdata must be mappable to a bus address according
236 * to the DMA mapping API rules for streaming mappings.
237 * Both @page/@offset and @kdata must stay memory resident (kernel memory or
238 * locked user space pages)
239 */
240static inline dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
241 struct page *page, unsigned int offset, void *kdata, size_t len)
242{
243 int cpu = get_cpu();
244 per_cpu_ptr(chan->local, cpu)->bytes_transferred += len;
245 per_cpu_ptr(chan->local, cpu)->memcpy_count++;
246 put_cpu();
247
248 return chan->device->device_memcpy_buf_to_pg(chan, page, offset,
249 kdata, len);
250}
251
252/**
253 * dma_async_memcpy_buf_to_pg - offloaded copy
254 * @chan: DMA channel to offload copy to
255 * @dest_page: destination page
256 * @dest_off: offset in page to copy to
257 * @src_page: source page
258 * @src_off: offset in page to copy from
259 * @len: length
260 *
261 * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus
262 * address according to the DMA mapping API rules for streaming mappings.
263 * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident
264 * (kernel memory or locked user space pages)
265 */
266static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
267 struct page *dest_pg, unsigned int dest_off, struct page *src_pg,
268 unsigned int src_off, size_t len)
269{
270 int cpu = get_cpu();
271 per_cpu_ptr(chan->local, cpu)->bytes_transferred += len;
272 per_cpu_ptr(chan->local, cpu)->memcpy_count++;
273 put_cpu();
274
275 return chan->device->device_memcpy_pg_to_pg(chan, dest_pg, dest_off,
276 src_pg, src_off, len);
277}
278
279/**
280 * dma_async_memcpy_issue_pending - flush pending copies to HW
281 * @chan:
282 *
283 * This allows drivers to push copies to HW in batches,
284 * reducing MMIO writes where possible.
285 */
286static inline void dma_async_memcpy_issue_pending(struct dma_chan *chan)
287{
288 return chan->device->device_memcpy_issue_pending(chan);
289}
290
291/**
292 * dma_async_memcpy_complete - poll for transaction completion
293 * @chan: DMA channel
294 * @cookie: transaction identifier to check status of
295 * @last: returns last completed cookie, can be NULL
296 * @used: returns last issued cookie, can be NULL
297 *
298 * If @last and @used are passed in, upon return they reflect the driver
299 * internal state and can be used with dma_async_is_complete() to check
300 * the status of multiple cookies without re-checking hardware state.
301 */
302static inline enum dma_status dma_async_memcpy_complete(struct dma_chan *chan,
303 dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used)
304{
305 return chan->device->device_memcpy_complete(chan, cookie, last, used);
306}
307
308/**
309 * dma_async_is_complete - test a cookie against chan state
310 * @cookie: transaction identifier to test status of
311 * @last_complete: last know completed transaction
312 * @last_used: last cookie value handed out
313 *
314 * dma_async_is_complete() is used in dma_async_memcpy_complete()
315 * the test logic is seperated for lightweight testing of multiple cookies
316 */
317static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
318 dma_cookie_t last_complete, dma_cookie_t last_used)
319{
320 if (last_complete <= last_used) {
321 if ((cookie <= last_complete) || (cookie > last_used))
322 return DMA_SUCCESS;
323 } else {
324 if ((cookie <= last_complete) && (cookie > last_used))
325 return DMA_SUCCESS;
326 }
327 return DMA_IN_PROGRESS;
328}
329
330
331/* --- DMA device --- */
332
333int dma_async_device_register(struct dma_device *device);
334void dma_async_device_unregister(struct dma_device *device);
335
336/* --- Helper iov-locking functions --- */
337
338struct dma_page_list {
339 char *base_address;
340 int nr_pages;
341 struct page **pages;
342};
343
344struct dma_pinned_list {
345 int nr_iovecs;
346 struct dma_page_list page_list[0];
347};
348
349struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len);
350void dma_unpin_iovec_pages(struct dma_pinned_list* pinned_list);
351
352dma_cookie_t dma_memcpy_to_iovec(struct dma_chan *chan, struct iovec *iov,
353 struct dma_pinned_list *pinned_list, unsigned char *kdata, size_t len);
354dma_cookie_t dma_memcpy_pg_to_iovec(struct dma_chan *chan, struct iovec *iov,
355 struct dma_pinned_list *pinned_list, struct page *page,
356 unsigned int offset, size_t len);
357
358#endif /* CONFIG_DMA_ENGINE */
359#endif /* DMAENGINE_H */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index ad133fcfb239..1713ace808bf 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -21,7 +21,7 @@ typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
21typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); 21typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *);
22typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); 22typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
23 23
24typedef int (elevator_init_fn) (request_queue_t *, elevator_t *); 24typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *);
25typedef void (elevator_exit_fn) (elevator_t *); 25typedef void (elevator_exit_fn) (elevator_t *);
26 26
27struct elevator_ops 27struct elevator_ops
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index dd7d627bf66f..c115e9e840b4 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -1114,8 +1114,11 @@ static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)
1114 1114
1115 mmsg->mfa = readl(c->in_port); 1115 mmsg->mfa = readl(c->in_port);
1116 if (unlikely(mmsg->mfa >= c->in_queue.len)) { 1116 if (unlikely(mmsg->mfa >= c->in_queue.len)) {
1117 u32 mfa = mmsg->mfa;
1118
1117 mempool_free(mmsg, c->in_msg.mempool); 1119 mempool_free(mmsg, c->in_msg.mempool);
1118 if(mmsg->mfa == I2O_QUEUE_EMPTY) 1120
1121 if (mfa == I2O_QUEUE_EMPTY)
1119 return ERR_PTR(-EBUSY); 1122 return ERR_PTR(-EBUSY);
1120 return ERR_PTR(-EFAULT); 1123 return ERR_PTR(-EFAULT);
1121 } 1124 }
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 28f4f3b36950..899c3d4776f3 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -169,7 +169,7 @@ struct ip_sf_list
169struct ip_mc_list 169struct ip_mc_list
170{ 170{
171 struct in_device *interface; 171 struct in_device *interface;
172 unsigned long multiaddr; 172 __be32 multiaddr;
173 struct ip_sf_list *sources; 173 struct ip_sf_list *sources;
174 struct ip_sf_list *tomb; 174 struct ip_sf_list *tomb;
175 unsigned int sfmode; 175 unsigned int sfmode;
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 6a7621b2b12b..f5fdca1d67e6 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -36,6 +36,7 @@
36#include <linux/nodemask.h> 36#include <linux/nodemask.h>
37 37
38struct vm_area_struct; 38struct vm_area_struct;
39struct mm_struct;
39 40
40#ifdef CONFIG_NUMA 41#ifdef CONFIG_NUMA
41 42
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f4169bbb60eb..e432b743dda2 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -37,6 +37,7 @@
37#include <linux/config.h> 37#include <linux/config.h>
38#include <linux/device.h> 38#include <linux/device.h>
39#include <linux/percpu.h> 39#include <linux/percpu.h>
40#include <linux/dmaengine.h>
40 41
41struct divert_blk; 42struct divert_blk;
42struct vlan_group; 43struct vlan_group;
@@ -311,6 +312,9 @@ struct net_device
311#define NETIF_F_LLTX 4096 /* LockLess TX */ 312#define NETIF_F_LLTX 4096 /* LockLess TX */
312#define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/ 313#define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/
313 314
315#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
316#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
317
314 struct net_device *next_sched; 318 struct net_device *next_sched;
315 319
316 /* Interface index. Unique device identifier */ 320 /* Interface index. Unique device identifier */
@@ -406,7 +410,7 @@ struct net_device
406 * One part is mostly used on xmit path (device) 410 * One part is mostly used on xmit path (device)
407 */ 411 */
408 /* hard_start_xmit synchronizer */ 412 /* hard_start_xmit synchronizer */
409 spinlock_t xmit_lock ____cacheline_aligned_in_smp; 413 spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
410 /* cpu id of processor entered to hard_start_xmit or -1, 414 /* cpu id of processor entered to hard_start_xmit or -1,
411 if nobody entered there. 415 if nobody entered there.
412 */ 416 */
@@ -593,6 +597,9 @@ struct softnet_data
593 struct sk_buff *completion_queue; 597 struct sk_buff *completion_queue;
594 598
595 struct net_device backlog_dev; /* Sorry. 8) */ 599 struct net_device backlog_dev; /* Sorry. 8) */
600#ifdef CONFIG_NET_DMA
601 struct dma_chan *net_dma;
602#endif
596}; 603};
597 604
598DECLARE_PER_CPU(struct softnet_data,softnet_data); 605DECLARE_PER_CPU(struct softnet_data,softnet_data);
@@ -889,11 +896,43 @@ static inline void __netif_rx_complete(struct net_device *dev)
889 clear_bit(__LINK_STATE_RX_SCHED, &dev->state); 896 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
890} 897}
891 898
899static inline void netif_tx_lock(struct net_device *dev)
900{
901 spin_lock(&dev->_xmit_lock);
902 dev->xmit_lock_owner = smp_processor_id();
903}
904
905static inline void netif_tx_lock_bh(struct net_device *dev)
906{
907 spin_lock_bh(&dev->_xmit_lock);
908 dev->xmit_lock_owner = smp_processor_id();
909}
910
911static inline int netif_tx_trylock(struct net_device *dev)
912{
913 int err = spin_trylock(&dev->_xmit_lock);
914 if (!err)
915 dev->xmit_lock_owner = smp_processor_id();
916 return err;
917}
918
919static inline void netif_tx_unlock(struct net_device *dev)
920{
921 dev->xmit_lock_owner = -1;
922 spin_unlock(&dev->_xmit_lock);
923}
924
925static inline void netif_tx_unlock_bh(struct net_device *dev)
926{
927 dev->xmit_lock_owner = -1;
928 spin_unlock_bh(&dev->_xmit_lock);
929}
930
892static inline void netif_tx_disable(struct net_device *dev) 931static inline void netif_tx_disable(struct net_device *dev)
893{ 932{
894 spin_lock_bh(&dev->xmit_lock); 933 netif_tx_lock_bh(dev);
895 netif_stop_queue(dev); 934 netif_stop_queue(dev);
896 spin_unlock_bh(&dev->xmit_lock); 935 netif_tx_unlock_bh(dev);
897} 936}
898 937
899/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 938/* These functions live elsewhere (drivers/net/net_init.c, but related) */
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 3ff88c878308..d2e4bd7a7a14 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -69,6 +69,10 @@ enum ip_conntrack_status {
69 /* Connection is dying (removed from lists), can not be unset. */ 69 /* Connection is dying (removed from lists), can not be unset. */
70 IPS_DYING_BIT = 9, 70 IPS_DYING_BIT = 9,
71 IPS_DYING = (1 << IPS_DYING_BIT), 71 IPS_DYING = (1 << IPS_DYING_BIT),
72
73 /* Connection has fixed timeout. */
74 IPS_FIXED_TIMEOUT_BIT = 10,
75 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
72}; 76};
73 77
74/* Connection tracking event bits */ 78/* Connection tracking event bits */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 668ec946c8e2..b5883ccee295 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -27,13 +27,15 @@ enum ctattr_type {
27 CTA_STATUS, 27 CTA_STATUS,
28 CTA_PROTOINFO, 28 CTA_PROTOINFO,
29 CTA_HELP, 29 CTA_HELP,
30 CTA_NAT, 30 CTA_NAT_SRC,
31#define CTA_NAT CTA_NAT_SRC /* backwards compatibility */
31 CTA_TIMEOUT, 32 CTA_TIMEOUT,
32 CTA_MARK, 33 CTA_MARK,
33 CTA_COUNTERS_ORIG, 34 CTA_COUNTERS_ORIG,
34 CTA_COUNTERS_REPLY, 35 CTA_COUNTERS_REPLY,
35 CTA_USE, 36 CTA_USE,
36 CTA_ID, 37 CTA_ID,
38 CTA_NAT_DST,
37 __CTA_MAX 39 __CTA_MAX
38}; 40};
39#define CTA_MAX (__CTA_MAX - 1) 41#define CTA_MAX (__CTA_MAX - 1)
diff --git a/include/linux/netfilter/xt_CONNSECMARK.h b/include/linux/netfilter/xt_CONNSECMARK.h
new file mode 100644
index 000000000000..c6bd75469ba2
--- /dev/null
+++ b/include/linux/netfilter/xt_CONNSECMARK.h
@@ -0,0 +1,13 @@
1#ifndef _XT_CONNSECMARK_H_target
2#define _XT_CONNSECMARK_H_target
3
4enum {
5 CONNSECMARK_SAVE = 1,
6 CONNSECMARK_RESTORE,
7};
8
9struct xt_connsecmark_target_info {
10 u_int8_t mode;
11};
12
13#endif /*_XT_CONNSECMARK_H_target */
diff --git a/include/linux/netfilter/xt_SECMARK.h b/include/linux/netfilter/xt_SECMARK.h
new file mode 100644
index 000000000000..c53fbffa997d
--- /dev/null
+++ b/include/linux/netfilter/xt_SECMARK.h
@@ -0,0 +1,26 @@
1#ifndef _XT_SECMARK_H_target
2#define _XT_SECMARK_H_target
3
4/*
5 * This is intended for use by various security subsystems (but not
6 * at the same time).
7 *
8 * 'mode' refers to the specific security subsystem which the
9 * packets are being marked for.
10 */
11#define SECMARK_MODE_SEL 0x01 /* SELinux */
12#define SECMARK_SELCTX_MAX 256
13
14struct xt_secmark_target_selinux_info {
15 u_int32_t selsid;
16 char selctx[SECMARK_SELCTX_MAX];
17};
18
19struct xt_secmark_target_info {
20 u_int8_t mode;
21 union {
22 struct xt_secmark_target_selinux_info sel;
23 } u;
24};
25
26#endif /*_XT_SECMARK_H_target */
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
new file mode 100644
index 000000000000..acd7fd77bbee
--- /dev/null
+++ b/include/linux/netfilter/xt_quota.h
@@ -0,0 +1,16 @@
1#ifndef _XT_QUOTA_H
2#define _XT_QUOTA_H
3
4enum xt_quota_flags {
5 XT_QUOTA_INVERT = 0x1,
6};
7#define XT_QUOTA_MASK 0x1
8
9struct xt_quota_info {
10 u_int32_t flags;
11 u_int32_t pad;
12 aligned_u64 quota;
13 struct xt_quota_info *master;
14};
15
16#endif /* _XT_QUOTA_H */
diff --git a/include/linux/netfilter/xt_statistic.h b/include/linux/netfilter/xt_statistic.h
new file mode 100644
index 000000000000..c344e9916e23
--- /dev/null
+++ b/include/linux/netfilter/xt_statistic.h
@@ -0,0 +1,32 @@
1#ifndef _XT_STATISTIC_H
2#define _XT_STATISTIC_H
3
4enum xt_statistic_mode {
5 XT_STATISTIC_MODE_RANDOM,
6 XT_STATISTIC_MODE_NTH,
7 __XT_STATISTIC_MODE_MAX
8};
9#define XT_STATISTIC_MODE_MAX (__XT_STATISTIC_MODE_MAX - 1)
10
11enum xt_statistic_flags {
12 XT_STATISTIC_INVERT = 0x1,
13};
14#define XT_STATISTIC_MASK 0x1
15
16struct xt_statistic_info {
17 u_int16_t mode;
18 u_int16_t flags;
19 union {
20 struct {
21 u_int32_t probability;
22 } random;
23 struct {
24 u_int32_t every;
25 u_int32_t packet;
26 u_int32_t count;
27 } nth;
28 } u;
29 struct xt_statistic_info *master __attribute__((aligned(8)));
30};
31
32#endif /* _XT_STATISTIC_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index d54d7b278e96..e0e9951eb8c3 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -121,6 +121,10 @@ struct ip_conntrack
121 u_int32_t mark; 121 u_int32_t mark;
122#endif 122#endif
123 123
124#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
125 u_int32_t secmark;
126#endif
127
124 /* Traversed often, so hopefully in different cacheline to top */ 128 /* Traversed often, so hopefully in different cacheline to top */
125 /* These are my tuples; original and reply */ 129 /* These are my tuples; original and reply */
126 struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; 130 struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
@@ -154,6 +158,7 @@ struct ip_conntrack_expect
154 unsigned int flags; 158 unsigned int flags;
155 159
156#ifdef CONFIG_IP_NF_NAT_NEEDED 160#ifdef CONFIG_IP_NF_NAT_NEEDED
161 u_int32_t saved_ip;
157 /* This is the original per-proto part, used to map the 162 /* This is the original per-proto part, used to map the
158 * expected connection the way the recipient expects. */ 163 * expected connection the way the recipient expects. */
159 union ip_conntrack_manip_proto saved_proto; 164 union ip_conntrack_manip_proto saved_proto;
@@ -293,6 +298,7 @@ static inline int is_dying(struct ip_conntrack *ct)
293} 298}
294 299
295extern unsigned int ip_conntrack_htable_size; 300extern unsigned int ip_conntrack_htable_size;
301extern int ip_conntrack_checksum;
296 302
297#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) 303#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
298 304
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
index eace86bd2adb..3cbff7379002 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -71,6 +71,13 @@ extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
71 unsigned char **data, int dataoff, 71 unsigned char **data, int dataoff,
72 TransportAddress * addr, u_int16_t port, 72 TransportAddress * addr, u_int16_t port,
73 struct ip_conntrack_expect * exp); 73 struct ip_conntrack_expect * exp);
74extern int (*nat_callforwarding_hook) (struct sk_buff ** pskb,
75 struct ip_conntrack * ct,
76 enum ip_conntrack_info ctinfo,
77 unsigned char **data, int dataoff,
78 TransportAddress * addr,
79 u_int16_t port,
80 struct ip_conntrack_expect * exp);
74extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct, 81extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
75 enum ip_conntrack_info ctinfo, 82 enum ip_conntrack_info ctinfo,
76 unsigned char **data, TransportAddress * addr, 83 unsigned char **data, TransportAddress * addr,
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
index cc98f7aa5abe..3d4a773799fc 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
@@ -1,4 +1,4 @@
1/* Generated by Jing Min Zhao's ASN.1 parser, Mar 15 2006 1/* Generated by Jing Min Zhao's ASN.1 parser, Apr 20 2006
2 * 2 *
3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net> 3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net>
4 * 4 *
@@ -412,6 +412,7 @@ typedef struct Facility_UUIE { /* SEQUENCE */
412 eFacility_UUIE_destinationInfo = (1 << 14), 412 eFacility_UUIE_destinationInfo = (1 << 14),
413 eFacility_UUIE_h245SecurityMode = (1 << 13), 413 eFacility_UUIE_h245SecurityMode = (1 << 13),
414 } options; 414 } options;
415 TransportAddress alternativeAddress;
415 FacilityReason reason; 416 FacilityReason reason;
416 TransportAddress h245Address; 417 TransportAddress h245Address;
417 Facility_UUIE_fastStart fastStart; 418 Facility_UUIE_fastStart fastStart;
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
new file mode 100644
index 000000000000..913dad66c0fb
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
@@ -0,0 +1,44 @@
1#ifndef __IP_CONNTRACK_SIP_H__
2#define __IP_CONNTRACK_SIP_H__
3#ifdef __KERNEL__
4
5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600
7
8#define POS_VIA 0
9#define POS_CONTACT 1
10#define POS_CONTENT 2
11#define POS_MEDIA 3
12#define POS_OWNER 4
13#define POS_CONNECTION 5
14#define POS_REQ_HEADER 6
15#define POS_SDP_HEADER 7
16
17struct sip_header_nfo {
18 const char *lname;
19 const char *sname;
20 const char *ln_str;
21 size_t lnlen;
22 size_t snlen;
23 size_t ln_strlen;
24 int (*match_len)(const char *, const char *, int *);
25};
26
27extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
28 enum ip_conntrack_info ctinfo,
29 struct ip_conntrack *ct,
30 const char **dptr);
31extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
32 enum ip_conntrack_info ctinfo,
33 struct ip_conntrack_expect *exp,
34 const char *dptr);
35
36extern int ct_sip_get_info(const char *dptr, size_t dlen,
37 unsigned int *matchoff,
38 unsigned int *matchlen,
39 struct sip_header_nfo *hnfo);
40extern int ct_sip_lnlen(const char *line, const char *limit);
41extern const char *ct_sip_search(const char *needle, const char *haystack,
42 size_t needle_len, size_t haystack_len);
43#endif /* __KERNEL__ */
44#endif /* __IP_CONNTRACK_SIP_H__ */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 4877e35ae202..936ef82ed76a 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -50,7 +50,7 @@
50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); 50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
51extern acpi_status pci_osc_support_set(u32 flags); 51extern acpi_status pci_osc_support_set(u32 flags);
52#else 52#else
53#if !defined(acpi_status) 53#if !defined(AE_ERROR)
54typedef u32 acpi_status; 54typedef u32 acpi_status;
55#define AE_ERROR (acpi_status) (0x0001) 55#define AE_ERROR (acpi_status) (0x0001)
56#endif 56#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c3fe769c9129..bcfe9d4f56ae 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1897,6 +1897,7 @@
1897#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 1897#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
1898#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 1898#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
1899#define PCI_DEVICE_ID_TIGON3_5782 0x1696 1899#define PCI_DEVICE_ID_TIGON3_5782 0x1696
1900#define PCI_DEVICE_ID_TIGON3_5786 0x169a
1900#define PCI_DEVICE_ID_TIGON3_5787 0x169b 1901#define PCI_DEVICE_ID_TIGON3_5787 0x169b
1901#define PCI_DEVICE_ID_TIGON3_5788 0x169c 1902#define PCI_DEVICE_ID_TIGON3_5788 0x169c
1902#define PCI_DEVICE_ID_TIGON3_5789 0x169d 1903#define PCI_DEVICE_ID_TIGON3_5789 0x169d
@@ -2053,6 +2054,7 @@
2053#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 2054#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960
2054#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 2055#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21
2055#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 2056#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30
2057#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38
2056#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2058#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
2057#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2059#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
2058#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 2060#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index bac0fb389cf1..d5dd471da225 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -159,7 +159,7 @@ struct sadb_spirange {
159struct sadb_x_kmprivate { 159struct sadb_x_kmprivate {
160 uint16_t sadb_x_kmprivate_len; 160 uint16_t sadb_x_kmprivate_len;
161 uint16_t sadb_x_kmprivate_exttype; 161 uint16_t sadb_x_kmprivate_exttype;
162 u_int32_t sadb_x_kmprivate_reserved; 162 uint32_t sadb_x_kmprivate_reserved;
163} __attribute__((packed)); 163} __attribute__((packed));
164/* sizeof(struct sadb_x_kmprivate) == 8 */ 164/* sizeof(struct sadb_x_kmprivate) == 8 */
165 165
diff --git a/include/linux/security.h b/include/linux/security.h
index 1bab48f6aeac..4dfb1b84a9b3 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -805,31 +805,37 @@ struct swap_info_struct;
805 * used by the XFRM system. 805 * used by the XFRM system.
806 * @sec_ctx contains the security context information being provided by 806 * @sec_ctx contains the security context information being provided by
807 * the user-level policy update program (e.g., setkey). 807 * the user-level policy update program (e.g., setkey).
808 * Allocate a security structure to the xp->selector.security field. 808 * Allocate a security structure to the xp->security field.
809 * The security field is initialized to NULL when the xfrm_policy is 809 * The security field is initialized to NULL when the xfrm_policy is
810 * allocated. 810 * allocated.
811 * Return 0 if operation was successful (memory to allocate, legal context) 811 * Return 0 if operation was successful (memory to allocate, legal context)
812 * @xfrm_policy_clone_security: 812 * @xfrm_policy_clone_security:
813 * @old contains an existing xfrm_policy in the SPD. 813 * @old contains an existing xfrm_policy in the SPD.
814 * @new contains a new xfrm_policy being cloned from old. 814 * @new contains a new xfrm_policy being cloned from old.
815 * Allocate a security structure to the new->selector.security field 815 * Allocate a security structure to the new->security field
816 * that contains the information from the old->selector.security field. 816 * that contains the information from the old->security field.
817 * Return 0 if operation was successful (memory to allocate). 817 * Return 0 if operation was successful (memory to allocate).
818 * @xfrm_policy_free_security: 818 * @xfrm_policy_free_security:
819 * @xp contains the xfrm_policy 819 * @xp contains the xfrm_policy
820 * Deallocate xp->selector.security. 820 * Deallocate xp->security.
821 * @xfrm_policy_delete_security:
822 * @xp contains the xfrm_policy.
823 * Authorize deletion of xp->security.
821 * @xfrm_state_alloc_security: 824 * @xfrm_state_alloc_security:
822 * @x contains the xfrm_state being added to the Security Association 825 * @x contains the xfrm_state being added to the Security Association
823 * Database by the XFRM system. 826 * Database by the XFRM system.
824 * @sec_ctx contains the security context information being provided by 827 * @sec_ctx contains the security context information being provided by
825 * the user-level SA generation program (e.g., setkey or racoon). 828 * the user-level SA generation program (e.g., setkey or racoon).
826 * Allocate a security structure to the x->sel.security field. The 829 * Allocate a security structure to the x->security field. The
827 * security field is initialized to NULL when the xfrm_state is 830 * security field is initialized to NULL when the xfrm_state is
828 * allocated. 831 * allocated.
829 * Return 0 if operation was successful (memory to allocate, legal context). 832 * Return 0 if operation was successful (memory to allocate, legal context).
830 * @xfrm_state_free_security: 833 * @xfrm_state_free_security:
831 * @x contains the xfrm_state. 834 * @x contains the xfrm_state.
832 * Deallocate x>sel.security. 835 * Deallocate x->security.
836 * @xfrm_state_delete_security:
837 * @x contains the xfrm_state.
838 * Authorize deletion of x->security.
833 * @xfrm_policy_lookup: 839 * @xfrm_policy_lookup:
834 * @xp contains the xfrm_policy for which the access control is being 840 * @xp contains the xfrm_policy for which the access control is being
835 * checked. 841 * checked.
@@ -1298,8 +1304,10 @@ struct security_operations {
1298 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); 1304 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
1299 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1305 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1300 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1306 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1307 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
1301 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); 1308 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
1302 void (*xfrm_state_free_security) (struct xfrm_state *x); 1309 void (*xfrm_state_free_security) (struct xfrm_state *x);
1310 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1303 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir); 1311 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
1304#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1312#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1305 1313
@@ -2934,11 +2942,21 @@ static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2934 security_ops->xfrm_policy_free_security(xp); 2942 security_ops->xfrm_policy_free_security(xp);
2935} 2943}
2936 2944
2945static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
2946{
2947 return security_ops->xfrm_policy_delete_security(xp);
2948}
2949
2937static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 2950static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2938{ 2951{
2939 return security_ops->xfrm_state_alloc_security(x, sec_ctx); 2952 return security_ops->xfrm_state_alloc_security(x, sec_ctx);
2940} 2953}
2941 2954
2955static inline int security_xfrm_state_delete(struct xfrm_state *x)
2956{
2957 return security_ops->xfrm_state_delete_security(x);
2958}
2959
2942static inline void security_xfrm_state_free(struct xfrm_state *x) 2960static inline void security_xfrm_state_free(struct xfrm_state *x)
2943{ 2961{
2944 security_ops->xfrm_state_free_security(x); 2962 security_ops->xfrm_state_free_security(x);
@@ -2963,6 +2981,11 @@ static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2963{ 2981{
2964} 2982}
2965 2983
2984static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
2985{
2986 return 0;
2987}
2988
2966static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 2989static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2967{ 2990{
2968 return 0; 2991 return 0;
@@ -2972,6 +2995,11 @@ static inline void security_xfrm_state_free(struct xfrm_state *x)
2972{ 2995{
2973} 2996}
2974 2997
2998static inline int security_xfrm_state_delete(struct xfrm_state *x)
2999{
3000 return 0;
3001}
3002
2975static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) 3003static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2976{ 3004{
2977 return 0; 3005 return 0;
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index 4047bcde4484..aad4e390d6a5 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -118,6 +118,27 @@ void selinux_get_ipc_sid(const struct kern_ipc_perm *ipcp, u32 *sid);
118 */ 118 */
119void selinux_get_task_sid(struct task_struct *tsk, u32 *sid); 119void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
120 120
121/**
122 * selinux_string_to_sid - map a security context string to a security ID
123 * @str: the security context string to be mapped
124 * @sid: ID value returned via this.
125 *
126 * Returns 0 if successful, with the SID stored in sid. A value
127 * of zero for sid indicates no SID could be determined (but no error
128 * occurred).
129 */
130int selinux_string_to_sid(char *str, u32 *sid);
131
132/**
133 * selinux_relabel_packet_permission - check permission to relabel a packet
134 * @sid: ID value to be applied to network packet (via SECMARK, most likely)
135 *
136 * Returns 0 if the current task is allowed to label packets with the
137 * supplied security ID. Note that it is implicit that the packet is always
138 * being relabeled from the default unlabled value, and that the access
139 * control decision is made in the AVC.
140 */
141int selinux_relabel_packet_permission(u32 sid);
121 142
122#else 143#else
123 144
@@ -172,6 +193,17 @@ static inline void selinux_get_task_sid(struct task_struct *tsk, u32 *sid)
172 *sid = 0; 193 *sid = 0;
173} 194}
174 195
196static inline int selinux_string_to_sid(const char *str, u32 *sid)
197{
198 *sid = 0;
199 return 0;
200}
201
202static inline int selinux_relabel_packet_permission(u32 sid)
203{
204 return 0;
205}
206
175#endif /* CONFIG_SECURITY_SELINUX */ 207#endif /* CONFIG_SECURITY_SELINUX */
176 208
177#endif /* _LINUX_SELINUX_H */ 209#endif /* _LINUX_SELINUX_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f8f234708b98..93e4db221585 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -29,6 +29,7 @@
29#include <linux/net.h> 29#include <linux/net.h>
30#include <linux/textsearch.h> 30#include <linux/textsearch.h>
31#include <net/checksum.h> 31#include <net/checksum.h>
32#include <linux/dmaengine.h>
32 33
33#define HAVE_ALLOC_SKB /* For the drivers to know */ 34#define HAVE_ALLOC_SKB /* For the drivers to know */
34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 35#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
@@ -209,6 +210,7 @@ enum {
209 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 210 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
210 * @tc_index: Traffic control index 211 * @tc_index: Traffic control index
211 * @tc_verd: traffic control verdict 212 * @tc_verd: traffic control verdict
213 * @secmark: security marking
212 */ 214 */
213 215
214struct sk_buff { 216struct sk_buff {
@@ -285,6 +287,12 @@ struct sk_buff {
285 __u16 tc_verd; /* traffic control verdict */ 287 __u16 tc_verd; /* traffic control verdict */
286#endif 288#endif
287#endif 289#endif
290#ifdef CONFIG_NET_DMA
291 dma_cookie_t dma_cookie;
292#endif
293#ifdef CONFIG_NETWORK_SECMARK
294 __u32 secmark;
295#endif
288 296
289 297
290 /* These elements must be at the end, see alloc_skb() for details. */ 298 /* These elements must be at the end, see alloc_skb() for details. */
@@ -967,15 +975,16 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
967#define NET_SKB_PAD 16 975#define NET_SKB_PAD 16
968#endif 976#endif
969 977
970extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc); 978extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
971 979
972static inline void __skb_trim(struct sk_buff *skb, unsigned int len) 980static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
973{ 981{
974 if (!skb->data_len) { 982 if (unlikely(skb->data_len)) {
975 skb->len = len; 983 WARN_ON(1);
976 skb->tail = skb->data + len; 984 return;
977 } else 985 }
978 ___pskb_trim(skb, len, 0); 986 skb->len = len;
987 skb->tail = skb->data + len;
979} 988}
980 989
981/** 990/**
@@ -985,6 +994,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
985 * 994 *
986 * Cut the length of a buffer down by removing data from the tail. If 995 * Cut the length of a buffer down by removing data from the tail. If
987 * the buffer is already under the length specified it is not modified. 996 * the buffer is already under the length specified it is not modified.
997 * The skb must be linear.
988 */ 998 */
989static inline void skb_trim(struct sk_buff *skb, unsigned int len) 999static inline void skb_trim(struct sk_buff *skb, unsigned int len)
990{ 1000{
@@ -995,12 +1005,10 @@ static inline void skb_trim(struct sk_buff *skb, unsigned int len)
995 1005
996static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) 1006static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
997{ 1007{
998 if (!skb->data_len) { 1008 if (skb->data_len)
999 skb->len = len; 1009 return ___pskb_trim(skb, len);
1000 skb->tail = skb->data+len; 1010 __skb_trim(skb, len);
1001 return 0; 1011 return 0;
1002 }
1003 return ___pskb_trim(skb, len, 1);
1004} 1012}
1005 1013
1006static inline int pskb_trim(struct sk_buff *skb, unsigned int len) 1014static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
@@ -1161,18 +1169,34 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1161 return 0; 1169 return 0;
1162} 1170}
1163 1171
1172static inline int __skb_linearize(struct sk_buff *skb)
1173{
1174 return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM;
1175}
1176
1164/** 1177/**
1165 * skb_linearize - convert paged skb to linear one 1178 * skb_linearize - convert paged skb to linear one
1166 * @skb: buffer to linarize 1179 * @skb: buffer to linarize
1167 * @gfp: allocation mode
1168 * 1180 *
1169 * If there is no free memory -ENOMEM is returned, otherwise zero 1181 * If there is no free memory -ENOMEM is returned, otherwise zero
1170 * is returned and the old skb data released. 1182 * is returned and the old skb data released.
1171 */ 1183 */
1172extern int __skb_linearize(struct sk_buff *skb, gfp_t gfp); 1184static inline int skb_linearize(struct sk_buff *skb)
1173static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp) 1185{
1186 return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0;
1187}
1188
1189/**
1190 * skb_linearize_cow - make sure skb is linear and writable
1191 * @skb: buffer to process
1192 *
1193 * If there is no free memory -ENOMEM is returned, otherwise zero
1194 * is returned and the old skb data released.
1195 */
1196static inline int skb_linearize_cow(struct sk_buff *skb)
1174{ 1197{
1175 return __skb_linearize(skb, gfp); 1198 return skb_is_nonlinear(skb) || skb_cloned(skb) ?
1199 __skb_linearize(skb) : 0;
1176} 1200}
1177 1201
1178/** 1202/**
@@ -1396,5 +1420,23 @@ static inline void nf_reset(struct sk_buff *skb)
1396static inline void nf_reset(struct sk_buff *skb) {} 1420static inline void nf_reset(struct sk_buff *skb) {}
1397#endif /* CONFIG_NETFILTER */ 1421#endif /* CONFIG_NETFILTER */
1398 1422
1423#ifdef CONFIG_NETWORK_SECMARK
1424static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
1425{
1426 to->secmark = from->secmark;
1427}
1428
1429static inline void skb_init_secmark(struct sk_buff *skb)
1430{
1431 skb->secmark = 0;
1432}
1433#else
1434static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
1435{ }
1436
1437static inline void skb_init_secmark(struct sk_buff *skb)
1438{ }
1439#endif
1440
1399#endif /* __KERNEL__ */ 1441#endif /* __KERNEL__ */
1400#endif /* _LINUX_SKBUFF_H */ 1442#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 76eaeff76f82..cee944dbdcd4 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -313,6 +313,7 @@ enum
313 NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, 313 NET_NF_CONNTRACK_FRAG6_TIMEOUT=29,
314 NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, 314 NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30,
315 NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, 315 NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31,
316 NET_NF_CONNTRACK_CHECKSUM=32,
316}; 317};
317 318
318/* /proc/sys/net/ipv4 */ 319/* /proc/sys/net/ipv4 */
@@ -403,6 +404,8 @@ enum
403 NET_TCP_MTU_PROBING=113, 404 NET_TCP_MTU_PROBING=113,
404 NET_TCP_BASE_MSS=114, 405 NET_TCP_BASE_MSS=114,
405 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, 406 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
407 NET_TCP_DMA_COPYBREAK=116,
408 NET_TCP_SLOW_START_AFTER_IDLE=117,
406}; 409};
407 410
408enum { 411enum {
@@ -491,6 +494,7 @@ enum
491 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, 494 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
492 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, 495 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
493 NET_IPV4_NF_CONNTRACK_COUNT=27, 496 NET_IPV4_NF_CONNTRACK_COUNT=27,
497 NET_IPV4_NF_CONNTRACK_CHECKSUM=28,
494}; 498};
495 499
496/* /proc/sys/net/ipv6 */ 500/* /proc/sys/net/ipv6 */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 542d39596bd8..c90daa5da6c3 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -18,6 +18,7 @@
18#define _LINUX_TCP_H 18#define _LINUX_TCP_H
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/dmaengine.h>
21#include <asm/byteorder.h> 22#include <asm/byteorder.h>
22 23
23struct tcphdr { 24struct tcphdr {
@@ -233,6 +234,13 @@ struct tcp_sock {
233 struct iovec *iov; 234 struct iovec *iov;
234 int memory; 235 int memory;
235 int len; 236 int len;
237#ifdef CONFIG_NET_DMA
238 /* members for async copy */
239 struct dma_chan *dma_chan;
240 int wakeup;
241 struct dma_pinned_list *pinned_list;
242 dma_cookie_t dma_cookie;
243#endif
236 } ucopy; 244 } ucopy;
237 245
238 __u32 snd_wl1; /* Sequence for window update */ 246 __u32 snd_wl1; /* Sequence for window update */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 6b42cc474c01..46a15c7a1a13 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -118,6 +118,10 @@ enum
118 XFRM_SHARE_UNIQUE /* Use once */ 118 XFRM_SHARE_UNIQUE /* Use once */
119}; 119};
120 120
121#define XFRM_MODE_TRANSPORT 0
122#define XFRM_MODE_TUNNEL 1
123#define XFRM_MODE_MAX 2
124
121/* Netlink configuration messages. */ 125/* Netlink configuration messages. */
122enum { 126enum {
123 XFRM_MSG_BASE = 0x10, 127 XFRM_MSG_BASE = 0x10,
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index d5147770ad47..ecc42864b001 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -968,6 +968,7 @@ enum ieee80211_state {
968 968
969enum { 969enum {
970 IEEE80211_CH_PASSIVE_ONLY = (1 << 0), 970 IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
971 IEEE80211_CH_80211H_RULES = (1 << 1),
971 IEEE80211_CH_B_ONLY = (1 << 2), 972 IEEE80211_CH_B_ONLY = (1 << 2),
972 IEEE80211_CH_NO_IBSS = (1 << 3), 973 IEEE80211_CH_NO_IBSS = (1 << 3),
973 IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), 974 IEEE80211_CH_UNIFORM_SPREADING = (1 << 4),
@@ -976,10 +977,10 @@ enum {
976}; 977};
977 978
978struct ieee80211_channel { 979struct ieee80211_channel {
979 u32 freq; 980 u32 freq; /* in MHz */
980 u8 channel; 981 u8 channel;
981 u8 flags; 982 u8 flags;
982 u8 max_power; 983 u8 max_power; /* in dBm */
983}; 984};
984 985
985struct ieee80211_geo { 986struct ieee80211_geo {
diff --git a/include/net/ip.h b/include/net/ip.h
index 3d2e5ca62a5a..ead233c9540d 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -147,7 +147,6 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
147struct ipv4_config 147struct ipv4_config
148{ 148{
149 int log_martians; 149 int log_martians;
150 int autoconfig;
151 int no_pmtu_disc; 150 int no_pmtu_disc;
152}; 151};
153 152
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index 090eaa0d71f9..c608812a8e89 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -16,6 +16,7 @@
16#include <linux/if.h> 16#include <linux/if.h>
17#include <linux/if_arp.h> 17#include <linux/if_arp.h>
18#include <linux/llc.h> 18#include <linux/llc.h>
19#include <linux/etherdevice.h>
19#include <net/llc.h> 20#include <net/llc.h>
20 21
21#define LLC_DATAUNIT_PRIM 1 22#define LLC_DATAUNIT_PRIM 1
@@ -61,8 +62,6 @@
61#define LLC_STATUS_CONFLICT 7 /* disconnect conn */ 62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
62#define LLC_STATUS_RESET_DONE 8 /* */ 63#define LLC_STATUS_RESET_DONE 8 /* */
63 64
64extern u8 llc_mac_null_var[IFHWADDRLEN];
65
66/** 65/**
67 * llc_mac_null - determines if a address is a null mac address 66 * llc_mac_null - determines if a address is a null mac address
68 * @mac: Mac address to test if null. 67 * @mac: Mac address to test if null.
@@ -70,16 +69,20 @@ extern u8 llc_mac_null_var[IFHWADDRLEN];
70 * Determines if a given address is a null mac address. Returns 0 if the 69 * Determines if a given address is a null mac address. Returns 0 if the
71 * address is not a null mac, 1 if the address is a null mac. 70 * address is not a null mac, 1 if the address is a null mac.
72 */ 71 */
73static __inline__ int llc_mac_null(u8 *mac) 72static inline int llc_mac_null(const u8 *mac)
74{ 73{
75 return !memcmp(mac, llc_mac_null_var, IFHWADDRLEN); 74 return is_zero_ether_addr(mac);
76} 75}
77 76
78static __inline__ int llc_addrany(struct llc_addr *addr) 77static inline int llc_addrany(const struct llc_addr *addr)
79{ 78{
80 return llc_mac_null(addr->mac) && !addr->lsap; 79 return llc_mac_null(addr->mac) && !addr->lsap;
81} 80}
82 81
82static inline int llc_mac_multicast(const u8 *mac)
83{
84 return is_multicast_ether_addr(mac);
85}
83/** 86/**
84 * llc_mac_match - determines if two mac addresses are the same 87 * llc_mac_match - determines if two mac addresses are the same
85 * @mac1: First mac address to compare. 88 * @mac1: First mac address to compare.
@@ -89,9 +92,9 @@ static __inline__ int llc_addrany(struct llc_addr *addr)
89 * is not a complete match up to len, 1 if a complete match up to len is 92 * is not a complete match up to len, 1 if a complete match up to len is
90 * found. 93 * found.
91 */ 94 */
92static __inline__ int llc_mac_match(u8 *mac1, u8 *mac2) 95static inline int llc_mac_match(const u8 *mac1, const u8 *mac2)
93{ 96{
94 return !memcmp(mac1, mac2, IFHWADDRLEN); 97 return !compare_ether_addr(mac1, mac2);
95} 98}
96 99
97extern int llc_establish_connection(struct sock *sk, u8 *lmac, 100extern int llc_establish_connection(struct sock *sk, u8 *lmac,
diff --git a/include/net/netdma.h b/include/net/netdma.h
new file mode 100644
index 000000000000..19760eb131aa
--- /dev/null
+++ b/include/net/netdma.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that 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 for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef NETDMA_H
22#define NETDMA_H
23#include <linux/config.h>
24#ifdef CONFIG_NET_DMA
25#include <linux/dmaengine.h>
26#include <linux/skbuff.h>
27
28static inline struct dma_chan *get_softnet_dma(void)
29{
30 struct dma_chan *chan;
31 rcu_read_lock();
32 chan = rcu_dereference(__get_cpu_var(softnet_data.net_dma));
33 if (chan)
34 dma_chan_get(chan);
35 rcu_read_unlock();
36 return chan;
37}
38
39int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
40 const struct sk_buff *skb, int offset, struct iovec *to,
41 size_t len, struct dma_pinned_list *pinned_list);
42
43#endif /* CONFIG_NET_DMA */
44#endif /* NETDMA_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 916013ca4a5c..411117815807 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -114,6 +114,10 @@ struct nf_conn
114 u_int32_t mark; 114 u_int32_t mark;
115#endif 115#endif
116 116
117#ifdef CONFIG_NF_CONNTRACK_SECMARK
118 u_int32_t secmark;
119#endif
120
117 /* Storage reserved for other modules: */ 121 /* Storage reserved for other modules: */
118 union nf_conntrack_proto proto; 122 union nf_conntrack_proto proto;
119 123
@@ -285,6 +289,7 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
285} 289}
286 290
287extern unsigned int nf_conntrack_htable_size; 291extern unsigned int nf_conntrack_htable_size;
292extern int nf_conntrack_checksum;
288 293
289#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) 294#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++)
290 295
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h
index 3cac19fb3648..f1b1482d7200 100644
--- a/include/net/netfilter/nf_conntrack_compat.h
+++ b/include/net/netfilter/nf_conntrack_compat.h
@@ -20,6 +20,19 @@ static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
20} 20}
21#endif /* CONFIG_IP_NF_CONNTRACK_MARK */ 21#endif /* CONFIG_IP_NF_CONNTRACK_MARK */
22 22
23#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
24static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
25 u_int32_t *ctinfo)
26{
27 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
28
29 if (ct)
30 return &ct->secmark;
31 else
32 return NULL;
33}
34#endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */
35
23#ifdef CONFIG_IP_NF_CT_ACCT 36#ifdef CONFIG_IP_NF_CT_ACCT
24static inline struct ip_conntrack_counter * 37static inline struct ip_conntrack_counter *
25nf_ct_get_counters(const struct sk_buff *skb) 38nf_ct_get_counters(const struct sk_buff *skb)
@@ -70,6 +83,19 @@ static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
70} 83}
71#endif /* CONFIG_NF_CONNTRACK_MARK */ 84#endif /* CONFIG_NF_CONNTRACK_MARK */
72 85
86#ifdef CONFIG_NF_CONNTRACK_SECMARK
87static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
88 u_int32_t *ctinfo)
89{
90 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
91
92 if (ct)
93 return &ct->secmark;
94 else
95 return NULL;
96}
97#endif /* CONFIG_NF_CONNTRACK_MARK */
98
73#ifdef CONFIG_NF_CT_ACCT 99#ifdef CONFIG_NF_CT_ACCT
74static inline struct ip_conntrack_counter * 100static inline struct ip_conntrack_counter *
75nf_ct_get_counters(const struct sk_buff *skb) 101nf_ct_get_counters(const struct sk_buff *skb)
diff --git a/include/net/raw.h b/include/net/raw.h
index e67b28a0248c..d83571fe4c69 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -36,7 +36,7 @@ extern rwlock_t raw_v4_lock;
36 36
37 37
38extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, 38extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
39 unsigned long raddr, unsigned long laddr, 39 __be32 raddr, __be32 laddr,
40 int dif); 40 int dif);
41 41
42extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); 42extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index aa6033ca7cd8..b2b40f951ae6 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -255,7 +255,7 @@ extern int sctp_debug_flag;
255#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) 255#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
256#define SCTP_ENABLE_DEBUG 256#define SCTP_ENABLE_DEBUG
257#define SCTP_DISABLE_DEBUG 257#define SCTP_DISABLE_DEBUG
258#define SCTP_ASSERT(expr, str, func) 258#define SCTP_ASSERT(expr, str, func) BUG_ON(!(expr))
259 259
260#endif /* SCTP_DEBUG */ 260#endif /* SCTP_DEBUG */
261 261
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 7f4fea173fb1..5f69158c1006 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -555,7 +555,8 @@ struct sctp_af {
555 int (*to_addr_param) (const union sctp_addr *, 555 int (*to_addr_param) (const union sctp_addr *,
556 union sctp_addr_param *); 556 union sctp_addr_param *);
557 int (*addr_valid) (union sctp_addr *, 557 int (*addr_valid) (union sctp_addr *,
558 struct sctp_sock *); 558 struct sctp_sock *,
559 const struct sk_buff *);
559 sctp_scope_t (*scope) (union sctp_addr *); 560 sctp_scope_t (*scope) (union sctp_addr *);
560 void (*inaddr_any) (union sctp_addr *, unsigned short); 561 void (*inaddr_any) (union sctp_addr *, unsigned short);
561 int (*is_any) (const union sctp_addr *); 562 int (*is_any) (const union sctp_addr *);
diff --git a/include/net/sock.h b/include/net/sock.h
index c9fad6fb629b..96565ff0de6a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -132,6 +132,7 @@ struct sock_common {
132 * @sk_receive_queue: incoming packets 132 * @sk_receive_queue: incoming packets
133 * @sk_wmem_alloc: transmit queue bytes committed 133 * @sk_wmem_alloc: transmit queue bytes committed
134 * @sk_write_queue: Packet sending queue 134 * @sk_write_queue: Packet sending queue
135 * @sk_async_wait_queue: DMA copied packets
135 * @sk_omem_alloc: "o" is "option" or "other" 136 * @sk_omem_alloc: "o" is "option" or "other"
136 * @sk_wmem_queued: persistent queue size 137 * @sk_wmem_queued: persistent queue size
137 * @sk_forward_alloc: space allocated forward 138 * @sk_forward_alloc: space allocated forward
@@ -205,6 +206,7 @@ struct sock {
205 atomic_t sk_omem_alloc; 206 atomic_t sk_omem_alloc;
206 struct sk_buff_head sk_receive_queue; 207 struct sk_buff_head sk_receive_queue;
207 struct sk_buff_head sk_write_queue; 208 struct sk_buff_head sk_write_queue;
209 struct sk_buff_head sk_async_wait_queue;
208 int sk_wmem_queued; 210 int sk_wmem_queued;
209 int sk_forward_alloc; 211 int sk_forward_alloc;
210 gfp_t sk_allocation; 212 gfp_t sk_allocation;
@@ -871,10 +873,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock)
871 if (filter) { 873 if (filter) {
872 unsigned int pkt_len = sk_run_filter(skb, filter->insns, 874 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
873 filter->len); 875 filter->len);
874 if (!pkt_len) 876 err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
875 err = -EPERM;
876 else
877 skb_trim(skb, pkt_len);
878 } 877 }
879 878
880 if (needlock) 879 if (needlock)
@@ -1271,11 +1270,22 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1271 * This routine must be called with interrupts disabled or with the socket 1270 * This routine must be called with interrupts disabled or with the socket
1272 * locked so that the sk_buff queue operation is ok. 1271 * locked so that the sk_buff queue operation is ok.
1273*/ 1272*/
1274static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb) 1273#ifdef CONFIG_NET_DMA
1274static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early)
1275{
1276 __skb_unlink(skb, &sk->sk_receive_queue);
1277 if (!copied_early)
1278 __kfree_skb(skb);
1279 else
1280 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
1281}
1282#else
1283static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early)
1275{ 1284{
1276 __skb_unlink(skb, &sk->sk_receive_queue); 1285 __skb_unlink(skb, &sk->sk_receive_queue);
1277 __kfree_skb(skb); 1286 __kfree_skb(skb);
1278} 1287}
1288#endif
1279 1289
1280extern void sock_enable_timestamp(struct sock *sk); 1290extern void sock_enable_timestamp(struct sock *sk);
1281extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1291extern int sock_get_timestamp(struct sock *, struct timeval __user *);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 3c989db8a7aa..bfc71f954bbe 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -28,6 +28,7 @@
28#include <linux/cache.h> 28#include <linux/cache.h>
29#include <linux/percpu.h> 29#include <linux/percpu.h>
30#include <linux/skbuff.h> 30#include <linux/skbuff.h>
31#include <linux/dmaengine.h>
31 32
32#include <net/inet_connection_sock.h> 33#include <net/inet_connection_sock.h>
33#include <net/inet_timewait_sock.h> 34#include <net/inet_timewait_sock.h>
@@ -218,6 +219,7 @@ extern int sysctl_tcp_adv_win_scale;
218extern int sysctl_tcp_tw_reuse; 219extern int sysctl_tcp_tw_reuse;
219extern int sysctl_tcp_frto; 220extern int sysctl_tcp_frto;
220extern int sysctl_tcp_low_latency; 221extern int sysctl_tcp_low_latency;
222extern int sysctl_tcp_dma_copybreak;
221extern int sysctl_tcp_nometrics_save; 223extern int sysctl_tcp_nometrics_save;
222extern int sysctl_tcp_moderate_rcvbuf; 224extern int sysctl_tcp_moderate_rcvbuf;
223extern int sysctl_tcp_tso_win_divisor; 225extern int sysctl_tcp_tso_win_divisor;
@@ -225,6 +227,7 @@ extern int sysctl_tcp_abc;
225extern int sysctl_tcp_mtu_probing; 227extern int sysctl_tcp_mtu_probing;
226extern int sysctl_tcp_base_mss; 228extern int sysctl_tcp_base_mss;
227extern int sysctl_tcp_workaround_signed_windows; 229extern int sysctl_tcp_workaround_signed_windows;
230extern int sysctl_tcp_slow_start_after_idle;
228 231
229extern atomic_t tcp_memory_allocated; 232extern atomic_t tcp_memory_allocated;
230extern atomic_t tcp_sockets_allocated; 233extern atomic_t tcp_sockets_allocated;
@@ -293,6 +296,8 @@ extern int tcp_rcv_established(struct sock *sk,
293 296
294extern void tcp_rcv_space_adjust(struct sock *sk); 297extern void tcp_rcv_space_adjust(struct sock *sk);
295 298
299extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
300
296extern int tcp_twsk_unique(struct sock *sk, 301extern int tcp_twsk_unique(struct sock *sk,
297 struct sock *sktw, void *twp); 302 struct sock *sktw, void *twp);
298 303
@@ -628,7 +633,7 @@ struct tcp_congestion_ops {
628 /* return slow start threshold (required) */ 633 /* return slow start threshold (required) */
629 u32 (*ssthresh)(struct sock *sk); 634 u32 (*ssthresh)(struct sock *sk);
630 /* lower bound for congestion window (optional) */ 635 /* lower bound for congestion window (optional) */
631 u32 (*min_cwnd)(struct sock *sk); 636 u32 (*min_cwnd)(const struct sock *sk);
632 /* do new cwnd calculation (required) */ 637 /* do new cwnd calculation (required) */
633 void (*cong_avoid)(struct sock *sk, u32 ack, 638 void (*cong_avoid)(struct sock *sk, u32 ack,
634 u32 rtt, u32 in_flight, int good_ack); 639 u32 rtt, u32 in_flight, int good_ack);
@@ -663,7 +668,7 @@ extern struct tcp_congestion_ops tcp_init_congestion_ops;
663extern u32 tcp_reno_ssthresh(struct sock *sk); 668extern u32 tcp_reno_ssthresh(struct sock *sk);
664extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, 669extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack,
665 u32 rtt, u32 in_flight, int flag); 670 u32 rtt, u32 in_flight, int flag);
666extern u32 tcp_reno_min_cwnd(struct sock *sk); 671extern u32 tcp_reno_min_cwnd(const struct sock *sk);
667extern struct tcp_congestion_ops tcp_reno; 672extern struct tcp_congestion_ops tcp_reno;
668 673
669static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 674static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -817,6 +822,12 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
817 tp->ucopy.len = 0; 822 tp->ucopy.len = 0;
818 tp->ucopy.memory = 0; 823 tp->ucopy.memory = 0;
819 skb_queue_head_init(&tp->ucopy.prequeue); 824 skb_queue_head_init(&tp->ucopy.prequeue);
825#ifdef CONFIG_NET_DMA
826 tp->ucopy.dma_chan = NULL;
827 tp->ucopy.wakeup = 0;
828 tp->ucopy.pinned_list = NULL;
829 tp->ucopy.dma_cookie = 0;
830#endif
820} 831}
821 832
822/* Packet is added to VJ-style prequeue for processing in process 833/* Packet is added to VJ-style prequeue for processing in process
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index afa508d92c93..9c5ee9f20b65 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -20,6 +20,8 @@
20#include <net/ip6_fib.h> 20#include <net/ip6_fib.h>
21 21
22#define XFRM_ALIGN8(len) (((len) + 7) & ~7) 22#define XFRM_ALIGN8(len) (((len) + 7) & ~7)
23#define MODULE_ALIAS_XFRM_MODE(family, encap) \
24 MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap))
23 25
24extern struct sock *xfrm_nl; 26extern struct sock *xfrm_nl;
25extern u32 sysctl_xfrm_aevent_etime; 27extern u32 sysctl_xfrm_aevent_etime;
@@ -164,6 +166,7 @@ struct xfrm_state
164 /* Reference to data common to all the instances of this 166 /* Reference to data common to all the instances of this
165 * transformer. */ 167 * transformer. */
166 struct xfrm_type *type; 168 struct xfrm_type *type;
169 struct xfrm_mode *mode;
167 170
168 /* Security context */ 171 /* Security context */
169 struct xfrm_sec_ctx *security; 172 struct xfrm_sec_ctx *security;
@@ -204,8 +207,8 @@ struct xfrm_type;
204struct xfrm_dst; 207struct xfrm_dst;
205struct xfrm_policy_afinfo { 208struct xfrm_policy_afinfo {
206 unsigned short family; 209 unsigned short family;
207 rwlock_t lock; 210 struct xfrm_type *type_map[IPPROTO_MAX];
208 struct xfrm_type_map *type_map; 211 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
209 struct dst_ops *dst_ops; 212 struct dst_ops *dst_ops;
210 void (*garbage_collect)(void); 213 void (*garbage_collect)(void);
211 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); 214 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl);
@@ -232,7 +235,6 @@ extern int __xfrm_state_delete(struct xfrm_state *x);
232 235
233struct xfrm_state_afinfo { 236struct xfrm_state_afinfo {
234 unsigned short family; 237 unsigned short family;
235 rwlock_t lock;
236 struct list_head *state_bydst; 238 struct list_head *state_bydst;
237 struct list_head *state_byspi; 239 struct list_head *state_byspi;
238 int (*init_flags)(struct xfrm_state *x); 240 int (*init_flags)(struct xfrm_state *x);
@@ -264,16 +266,24 @@ struct xfrm_type
264 u32 (*get_max_size)(struct xfrm_state *, int size); 266 u32 (*get_max_size)(struct xfrm_state *, int size);
265}; 267};
266 268
267struct xfrm_type_map {
268 rwlock_t lock;
269 struct xfrm_type *map[256];
270};
271
272extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 269extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
273extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); 270extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family);
274extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family); 271extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family);
275extern void xfrm_put_type(struct xfrm_type *type); 272extern void xfrm_put_type(struct xfrm_type *type);
276 273
274struct xfrm_mode {
275 int (*input)(struct xfrm_state *x, struct sk_buff *skb);
276 int (*output)(struct sk_buff *skb);
277
278 struct module *owner;
279 unsigned int encap;
280};
281
282extern int xfrm_register_mode(struct xfrm_mode *mode, int family);
283extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family);
284extern struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family);
285extern void xfrm_put_mode(struct xfrm_mode *mode);
286
277struct xfrm_tmpl 287struct xfrm_tmpl
278{ 288{
279/* id in template is interpreted as: 289/* id in template is interpreted as:
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
new file mode 100644
index 000000000000..fcb5ba87dcc5
--- /dev/null
+++ b/include/rdma/ib_addr.h
@@ -0,0 +1,114 @@
1/*
2 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
4 *
5 * This Software is licensed under one of the following licenses:
6 *
7 * 1) under the terms of the "Common Public License 1.0" a copy of which is
8 * available from the Open Source Initiative, see
9 * http://www.opensource.org/licenses/cpl.php.
10 *
11 * 2) under the terms of the "The BSD License" a copy of which is
12 * available from the Open Source Initiative, see
13 * http://www.opensource.org/licenses/bsd-license.php.
14 *
15 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
16 * copy of which is available from the Open Source Initiative, see
17 * http://www.opensource.org/licenses/gpl-license.php.
18 *
19 * Licensee has the right to choose one of the above licenses.
20 *
21 * Redistributions of source code must retain the above copyright
22 * notice and one of the license notices.
23 *
24 * Redistributions in binary form must reproduce both the above copyright
25 * notice, one of the license notices in the documentation
26 * and/or other materials provided with the distribution.
27 *
28 */
29
30#if !defined(IB_ADDR_H)
31#define IB_ADDR_H
32
33#include <linux/in.h>
34#include <linux/in6.h>
35#include <linux/netdevice.h>
36#include <linux/socket.h>
37#include <rdma/ib_verbs.h>
38
39struct rdma_dev_addr {
40 unsigned char src_dev_addr[MAX_ADDR_LEN];
41 unsigned char dst_dev_addr[MAX_ADDR_LEN];
42 unsigned char broadcast[MAX_ADDR_LEN];
43 enum ib_node_type dev_type;
44};
45
46/**
47 * rdma_translate_ip - Translate a local IP address to an RDMA hardware
48 * address.
49 */
50int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr);
51
52/**
53 * rdma_resolve_ip - Resolve source and destination IP addresses to
54 * RDMA hardware addresses.
55 * @src_addr: An optional source address to use in the resolution. If a
56 * source address is not provided, a usable address will be returned via
57 * the callback.
58 * @dst_addr: The destination address to resolve.
59 * @addr: A reference to a data location that will receive the resolved
60 * addresses. The data location must remain valid until the callback has
61 * been invoked.
62 * @timeout_ms: Amount of time to wait for the address resolution to complete.
63 * @callback: Call invoked once address resolution has completed, timed out,
64 * or been canceled. A status of 0 indicates success.
65 * @context: User-specified context associated with the call.
66 */
67int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr,
68 struct rdma_dev_addr *addr, int timeout_ms,
69 void (*callback)(int status, struct sockaddr *src_addr,
70 struct rdma_dev_addr *addr, void *context),
71 void *context);
72
73void rdma_addr_cancel(struct rdma_dev_addr *addr);
74
75static inline int ip_addr_size(struct sockaddr *addr)
76{
77 return addr->sa_family == AF_INET6 ?
78 sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in);
79}
80
81static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
82{
83 return ((u16)dev_addr->broadcast[8] << 8) | (u16)dev_addr->broadcast[9];
84}
85
86static inline void ib_addr_set_pkey(struct rdma_dev_addr *dev_addr, u16 pkey)
87{
88 dev_addr->broadcast[8] = pkey >> 8;
89 dev_addr->broadcast[9] = (unsigned char) pkey;
90}
91
92static inline union ib_gid *ib_addr_get_sgid(struct rdma_dev_addr *dev_addr)
93{
94 return (union ib_gid *) (dev_addr->src_dev_addr + 4);
95}
96
97static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr,
98 union ib_gid *gid)
99{
100 memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid);
101}
102
103static inline union ib_gid *ib_addr_get_dgid(struct rdma_dev_addr *dev_addr)
104{
105 return (union ib_gid *) (dev_addr->dst_dev_addr + 4);
106}
107
108static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr,
109 union ib_gid *gid)
110{
111 memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid);
112}
113
114#endif /* IB_ADDR_H */
diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h
index 5bf9834f7dca..f179d233ffc3 100644
--- a/include/rdma/ib_cache.h
+++ b/include/rdma/ib_cache.h
@@ -102,4 +102,17 @@ int ib_find_cached_pkey(struct ib_device *device,
102 u16 pkey, 102 u16 pkey,
103 u16 *index); 103 u16 *index);
104 104
105/**
106 * ib_get_cached_lmc - Returns a cached lmc table entry
107 * @device: The device to query.
108 * @port_num: The port number of the device to query.
109 * @lmc: The lmc value for the specified port for that device.
110 *
111 * ib_get_cached_lmc() fetches the specified lmc table entry stored in
112 * the local software cache.
113 */
114int ib_get_cached_lmc(struct ib_device *device,
115 u8 port_num,
116 u8 *lmc);
117
105#endif /* _IB_CACHE_H */ 118#endif /* _IB_CACHE_H */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index 0a9fcd59eb43..c9b4738be9d6 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -32,7 +32,7 @@
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE. 33 * SOFTWARE.
34 * 34 *
35 * $Id: ib_cm.h 2730 2005-06-28 16:43:03Z sean.hefty $ 35 * $Id: ib_cm.h 4311 2005-12-05 18:42:01Z sean.hefty $
36 */ 36 */
37#if !defined(IB_CM_H) 37#if !defined(IB_CM_H)
38#define IB_CM_H 38#define IB_CM_H
@@ -102,7 +102,8 @@ enum ib_cm_data_size {
102 IB_CM_APR_INFO_LENGTH = 72, 102 IB_CM_APR_INFO_LENGTH = 72,
103 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216, 103 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216,
104 IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136, 104 IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136,
105 IB_CM_SIDR_REP_INFO_LENGTH = 72 105 IB_CM_SIDR_REP_INFO_LENGTH = 72,
106 IB_CM_COMPARE_SIZE = 64
106}; 107};
107 108
108struct ib_cm_id; 109struct ib_cm_id;
@@ -238,7 +239,6 @@ struct ib_cm_sidr_rep_event_param {
238 u32 qpn; 239 u32 qpn;
239 void *info; 240 void *info;
240 u8 info_len; 241 u8 info_len;
241
242}; 242};
243 243
244struct ib_cm_event { 244struct ib_cm_event {
@@ -317,6 +317,15 @@ void ib_destroy_cm_id(struct ib_cm_id *cm_id);
317 317
318#define IB_SERVICE_ID_AGN_MASK __constant_cpu_to_be64(0xFF00000000000000ULL) 318#define IB_SERVICE_ID_AGN_MASK __constant_cpu_to_be64(0xFF00000000000000ULL)
319#define IB_CM_ASSIGN_SERVICE_ID __constant_cpu_to_be64(0x0200000000000000ULL) 319#define IB_CM_ASSIGN_SERVICE_ID __constant_cpu_to_be64(0x0200000000000000ULL)
320#define IB_CMA_SERVICE_ID __constant_cpu_to_be64(0x0000000001000000ULL)
321#define IB_CMA_SERVICE_ID_MASK __constant_cpu_to_be64(0xFFFFFFFFFF000000ULL)
322#define IB_SDP_SERVICE_ID __constant_cpu_to_be64(0x0000000000010000ULL)
323#define IB_SDP_SERVICE_ID_MASK __constant_cpu_to_be64(0xFFFFFFFFFFFF0000ULL)
324
325struct ib_cm_compare_data {
326 u8 data[IB_CM_COMPARE_SIZE];
327 u8 mask[IB_CM_COMPARE_SIZE];
328};
320 329
321/** 330/**
322 * ib_cm_listen - Initiates listening on the specified service ID for 331 * ib_cm_listen - Initiates listening on the specified service ID for
@@ -330,10 +339,12 @@ void ib_destroy_cm_id(struct ib_cm_id *cm_id);
330 * range of service IDs. If set to 0, the service ID is matched 339 * range of service IDs. If set to 0, the service ID is matched
331 * exactly. This parameter is ignored if %service_id is set to 340 * exactly. This parameter is ignored if %service_id is set to
332 * IB_CM_ASSIGN_SERVICE_ID. 341 * IB_CM_ASSIGN_SERVICE_ID.
342 * @compare_data: This parameter is optional. It specifies data that must
343 * appear in the private data of a connection request for the specified
344 * listen request.
333 */ 345 */
334int ib_cm_listen(struct ib_cm_id *cm_id, 346int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id, __be64 service_mask,
335 __be64 service_id, 347 struct ib_cm_compare_data *compare_data);
336 __be64 service_mask);
337 348
338struct ib_cm_req_param { 349struct ib_cm_req_param {
339 struct ib_sa_path_rec *primary_path; 350 struct ib_sa_path_rec *primary_path;
@@ -535,7 +546,6 @@ struct ib_cm_sidr_req_param {
535 const void *private_data; 546 const void *private_data;
536 u8 private_data_len; 547 u8 private_data_len;
537 u8 max_cm_retries; 548 u8 max_cm_retries;
538 u16 pkey;
539}; 549};
540 550
541/** 551/**
@@ -559,7 +569,7 @@ struct ib_cm_sidr_rep_param {
559}; 569};
560 570
561/** 571/**
562 * ib_send_cm_sidr_rep - Sends a service ID resolution request to the 572 * ib_send_cm_sidr_rep - Sends a service ID resolution reply to the
563 * remote node. 573 * remote node.
564 * @cm_id: Communication identifier associated with the received service ID 574 * @cm_id: Communication identifier associated with the received service ID
565 * resolution request. 575 * resolution request.
diff --git a/include/rdma/ib_marshall.h b/include/rdma/ib_marshall.h
new file mode 100644
index 000000000000..66bf4d7d0dfb
--- /dev/null
+++ b/include/rdma/ib_marshall.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (c) 2005 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#if !defined(IB_USER_MARSHALL_H)
34#define IB_USER_MARSHALL_H
35
36#include <rdma/ib_verbs.h>
37#include <rdma/ib_sa.h>
38#include <rdma/ib_user_verbs.h>
39#include <rdma/ib_user_sa.h>
40
41void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst,
42 struct ib_qp_attr *src);
43
44void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst,
45 struct ib_sa_path_rec *src);
46
47void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst,
48 struct ib_user_path_rec *src);
49
50#endif /* IB_USER_MARSHALL_H */
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index ad63c215efe5..c99e4420fd7e 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -370,5 +370,12 @@ ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num,
370 context, query); 370 context, query);
371} 371}
372 372
373/**
374 * ib_init_ah_from_path - Initialize address handle attributes based on an SA
375 * path record.
376 */
377int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
378 struct ib_sa_path_rec *rec,
379 struct ib_ah_attr *ah_attr);
373 380
374#endif /* IB_SA_H */ 381#endif /* IB_SA_H */
diff --git a/include/rdma/ib_smi.h b/include/rdma/ib_smi.h
index 87f60737f695..f29af135ba83 100644
--- a/include/rdma/ib_smi.h
+++ b/include/rdma/ib_smi.h
@@ -85,6 +85,42 @@ struct ib_smp {
85#define IB_SMP_ATTR_LED_INFO __constant_htons(0x0031) 85#define IB_SMP_ATTR_LED_INFO __constant_htons(0x0031)
86#define IB_SMP_ATTR_VENDOR_MASK __constant_htons(0xFF00) 86#define IB_SMP_ATTR_VENDOR_MASK __constant_htons(0xFF00)
87 87
88struct ib_port_info {
89 __be64 mkey;
90 __be64 gid_prefix;
91 __be16 lid;
92 __be16 sm_lid;
93 __be32 cap_mask;
94 __be16 diag_code;
95 __be16 mkey_lease_period;
96 u8 local_port_num;
97 u8 link_width_enabled;
98 u8 link_width_supported;
99 u8 link_width_active;
100 u8 linkspeed_portstate; /* 4 bits, 4 bits */
101 u8 portphysstate_linkdown; /* 4 bits, 4 bits */
102 u8 mkeyprot_resv_lmc; /* 2 bits, 3, 3 */
103 u8 linkspeedactive_enabled; /* 4 bits, 4 bits */
104 u8 neighbormtu_mastersmsl; /* 4 bits, 4 bits */
105 u8 vlcap_inittype; /* 4 bits, 4 bits */
106 u8 vl_high_limit;
107 u8 vl_arb_high_cap;
108 u8 vl_arb_low_cap;
109 u8 inittypereply_mtucap; /* 4 bits, 4 bits */
110 u8 vlstallcnt_hoqlife; /* 3 bits, 5 bits */
111 u8 operationalvl_pei_peo_fpi_fpo; /* 4 bits, 1, 1, 1, 1 */
112 __be16 mkey_violations;
113 __be16 pkey_violations;
114 __be16 qkey_violations;
115 u8 guid_cap;
116 u8 clientrereg_resv_subnetto; /* 1 bit, 2 bits, 5 */
117 u8 resv_resptimevalue; /* 3 bits, 5 bits */
118 u8 localphyerrors_overrunerrors; /* 4 bits, 4 bits */
119 __be16 max_credit_hint;
120 u8 resv;
121 u8 link_roundtrip_latency[3];
122};
123
88static inline u8 124static inline u8
89ib_get_smp_direction(struct ib_smp *smp) 125ib_get_smp_direction(struct ib_smp *smp)
90{ 126{
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h
index 19be116047f6..066c20b7cdfb 100644
--- a/include/rdma/ib_user_cm.h
+++ b/include/rdma/ib_user_cm.h
@@ -30,13 +30,13 @@
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE. 31 * SOFTWARE.
32 * 32 *
33 * $Id: ib_user_cm.h 2576 2005-06-09 17:00:30Z libor $ 33 * $Id: ib_user_cm.h 4019 2005-11-11 00:33:09Z sean.hefty $
34 */ 34 */
35 35
36#ifndef IB_USER_CM_H 36#ifndef IB_USER_CM_H
37#define IB_USER_CM_H 37#define IB_USER_CM_H
38 38
39#include <linux/types.h> 39#include <rdma/ib_user_sa.h>
40 40
41#define IB_USER_CM_ABI_VERSION 4 41#define IB_USER_CM_ABI_VERSION 4
42 42
@@ -110,58 +110,6 @@ struct ib_ucm_init_qp_attr {
110 __u32 qp_state; 110 __u32 qp_state;
111}; 111};
112 112
113struct ib_ucm_ah_attr {
114 __u8 grh_dgid[16];
115 __u32 grh_flow_label;
116 __u16 dlid;
117 __u16 reserved;
118 __u8 grh_sgid_index;
119 __u8 grh_hop_limit;
120 __u8 grh_traffic_class;
121 __u8 sl;
122 __u8 src_path_bits;
123 __u8 static_rate;
124 __u8 is_global;
125 __u8 port_num;
126};
127
128struct ib_ucm_init_qp_attr_resp {
129 __u32 qp_attr_mask;
130 __u32 qp_state;
131 __u32 cur_qp_state;
132 __u32 path_mtu;
133 __u32 path_mig_state;
134 __u32 qkey;
135 __u32 rq_psn;
136 __u32 sq_psn;
137 __u32 dest_qp_num;
138 __u32 qp_access_flags;
139
140 struct ib_ucm_ah_attr ah_attr;
141 struct ib_ucm_ah_attr alt_ah_attr;
142
143 /* ib_qp_cap */
144 __u32 max_send_wr;
145 __u32 max_recv_wr;
146 __u32 max_send_sge;
147 __u32 max_recv_sge;
148 __u32 max_inline_data;
149
150 __u16 pkey_index;
151 __u16 alt_pkey_index;
152 __u8 en_sqd_async_notify;
153 __u8 sq_draining;
154 __u8 max_rd_atomic;
155 __u8 max_dest_rd_atomic;
156 __u8 min_rnr_timer;
157 __u8 port_num;
158 __u8 timeout;
159 __u8 retry_cnt;
160 __u8 rnr_retry;
161 __u8 alt_port_num;
162 __u8 alt_timeout;
163};
164
165struct ib_ucm_listen { 113struct ib_ucm_listen {
166 __be64 service_id; 114 __be64 service_id;
167 __be64 service_mask; 115 __be64 service_mask;
@@ -180,28 +128,6 @@ struct ib_ucm_private_data {
180 __u8 reserved[3]; 128 __u8 reserved[3];
181}; 129};
182 130
183struct ib_ucm_path_rec {
184 __u8 dgid[16];
185 __u8 sgid[16];
186 __be16 dlid;
187 __be16 slid;
188 __u32 raw_traffic;
189 __be32 flow_label;
190 __u32 reversible;
191 __u32 mtu;
192 __be16 pkey;
193 __u8 hop_limit;
194 __u8 traffic_class;
195 __u8 numb_path;
196 __u8 sl;
197 __u8 mtu_selector;
198 __u8 rate_selector;
199 __u8 rate;
200 __u8 packet_life_time_selector;
201 __u8 packet_life_time;
202 __u8 preference;
203};
204
205struct ib_ucm_req { 131struct ib_ucm_req {
206 __u32 id; 132 __u32 id;
207 __u32 qpn; 133 __u32 qpn;
@@ -274,7 +200,7 @@ struct ib_ucm_sidr_req {
274 __be64 sid; 200 __be64 sid;
275 __u64 data; 201 __u64 data;
276 __u64 path; 202 __u64 path;
277 __u16 pkey; 203 __u16 reserved_pkey;
278 __u8 len; 204 __u8 len;
279 __u8 max_cm_retries; 205 __u8 max_cm_retries;
280 __u8 reserved[4]; 206 __u8 reserved[4];
@@ -304,8 +230,8 @@ struct ib_ucm_event_get {
304}; 230};
305 231
306struct ib_ucm_req_event_resp { 232struct ib_ucm_req_event_resp {
307 struct ib_ucm_path_rec primary_path; 233 struct ib_user_path_rec primary_path;
308 struct ib_ucm_path_rec alternate_path; 234 struct ib_user_path_rec alternate_path;
309 __be64 remote_ca_guid; 235 __be64 remote_ca_guid;
310 __u32 remote_qkey; 236 __u32 remote_qkey;
311 __u32 remote_qpn; 237 __u32 remote_qpn;
@@ -349,7 +275,7 @@ struct ib_ucm_mra_event_resp {
349}; 275};
350 276
351struct ib_ucm_lap_event_resp { 277struct ib_ucm_lap_event_resp {
352 struct ib_ucm_path_rec path; 278 struct ib_user_path_rec path;
353}; 279};
354 280
355struct ib_ucm_apr_event_resp { 281struct ib_ucm_apr_event_resp {
diff --git a/include/rdma/ib_user_sa.h b/include/rdma/ib_user_sa.h
new file mode 100644
index 000000000000..659120157e14
--- /dev/null
+++ b/include/rdma/ib_user_sa.h
@@ -0,0 +1,60 @@
1/*
2 * Copyright (c) 2005 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef IB_USER_SA_H
34#define IB_USER_SA_H
35
36#include <linux/types.h>
37
38struct ib_user_path_rec {
39 __u8 dgid[16];
40 __u8 sgid[16];
41 __be16 dlid;
42 __be16 slid;
43 __u32 raw_traffic;
44 __be32 flow_label;
45 __u32 reversible;
46 __u32 mtu;
47 __be16 pkey;
48 __u8 hop_limit;
49 __u8 traffic_class;
50 __u8 numb_path;
51 __u8 sl;
52 __u8 mtu_selector;
53 __u8 rate_selector;
54 __u8 rate;
55 __u8 packet_life_time_selector;
56 __u8 packet_life_time;
57 __u8 preference;
58};
59
60#endif /* IB_USER_SA_H */
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
index 338ed4333063..7b5372010f4b 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/rdma/ib_user_verbs.h
@@ -32,7 +32,7 @@
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE. 33 * SOFTWARE.
34 * 34 *
35 * $Id: ib_user_verbs.h 2708 2005-06-24 17:27:21Z roland $ 35 * $Id: ib_user_verbs.h 4019 2005-11-11 00:33:09Z sean.hefty $
36 */ 36 */
37 37
38#ifndef IB_USER_VERBS_H 38#ifndef IB_USER_VERBS_H
@@ -323,6 +323,64 @@ struct ib_uverbs_destroy_cq_resp {
323 __u32 async_events_reported; 323 __u32 async_events_reported;
324}; 324};
325 325
326struct ib_uverbs_global_route {
327 __u8 dgid[16];
328 __u32 flow_label;
329 __u8 sgid_index;
330 __u8 hop_limit;
331 __u8 traffic_class;
332 __u8 reserved;
333};
334
335struct ib_uverbs_ah_attr {
336 struct ib_uverbs_global_route grh;
337 __u16 dlid;
338 __u8 sl;
339 __u8 src_path_bits;
340 __u8 static_rate;
341 __u8 is_global;
342 __u8 port_num;
343 __u8 reserved;
344};
345
346struct ib_uverbs_qp_attr {
347 __u32 qp_attr_mask;
348 __u32 qp_state;
349 __u32 cur_qp_state;
350 __u32 path_mtu;
351 __u32 path_mig_state;
352 __u32 qkey;
353 __u32 rq_psn;
354 __u32 sq_psn;
355 __u32 dest_qp_num;
356 __u32 qp_access_flags;
357
358 struct ib_uverbs_ah_attr ah_attr;
359 struct ib_uverbs_ah_attr alt_ah_attr;
360
361 /* ib_qp_cap */
362 __u32 max_send_wr;
363 __u32 max_recv_wr;
364 __u32 max_send_sge;
365 __u32 max_recv_sge;
366 __u32 max_inline_data;
367
368 __u16 pkey_index;
369 __u16 alt_pkey_index;
370 __u8 en_sqd_async_notify;
371 __u8 sq_draining;
372 __u8 max_rd_atomic;
373 __u8 max_dest_rd_atomic;
374 __u8 min_rnr_timer;
375 __u8 port_num;
376 __u8 timeout;
377 __u8 retry_cnt;
378 __u8 rnr_retry;
379 __u8 alt_port_num;
380 __u8 alt_timeout;
381 __u8 reserved[5];
382};
383
326struct ib_uverbs_create_qp { 384struct ib_uverbs_create_qp {
327 __u64 response; 385 __u64 response;
328 __u64 user_handle; 386 __u64 user_handle;
@@ -541,26 +599,6 @@ struct ib_uverbs_post_srq_recv_resp {
541 __u32 bad_wr; 599 __u32 bad_wr;
542}; 600};
543 601
544struct ib_uverbs_global_route {
545 __u8 dgid[16];
546 __u32 flow_label;
547 __u8 sgid_index;
548 __u8 hop_limit;
549 __u8 traffic_class;
550 __u8 reserved;
551};
552
553struct ib_uverbs_ah_attr {
554 struct ib_uverbs_global_route grh;
555 __u16 dlid;
556 __u8 sl;
557 __u8 src_path_bits;
558 __u8 static_rate;
559 __u8 is_global;
560 __u8 port_num;
561 __u8 reserved;
562};
563
564struct ib_uverbs_create_ah { 602struct ib_uverbs_create_ah {
565 __u64 response; 603 __u64 response;
566 __u64 user_handle; 604 __u64 user_handle;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 6bbf1b364400..ee1f3a355666 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -260,7 +260,8 @@ enum ib_event_type {
260 IB_EVENT_SM_CHANGE, 260 IB_EVENT_SM_CHANGE,
261 IB_EVENT_SRQ_ERR, 261 IB_EVENT_SRQ_ERR,
262 IB_EVENT_SRQ_LIMIT_REACHED, 262 IB_EVENT_SRQ_LIMIT_REACHED,
263 IB_EVENT_QP_LAST_WQE_REACHED 263 IB_EVENT_QP_LAST_WQE_REACHED,
264 IB_EVENT_CLIENT_REREGISTER
264}; 265};
265 266
266struct ib_event { 267struct ib_event {
@@ -696,8 +697,12 @@ struct ib_ucontext {
696struct ib_uobject { 697struct ib_uobject {
697 u64 user_handle; /* handle given to us by userspace */ 698 u64 user_handle; /* handle given to us by userspace */
698 struct ib_ucontext *context; /* associated user context */ 699 struct ib_ucontext *context; /* associated user context */
700 void *object; /* containing object */
699 struct list_head list; /* link to context's list */ 701 struct list_head list; /* link to context's list */
700 u32 id; /* index into kernel idr */ 702 u32 id; /* index into kernel idr */
703 struct kref ref;
704 struct rw_semaphore mutex; /* protects .live */
705 int live;
701}; 706};
702 707
703struct ib_umem { 708struct ib_umem {
@@ -827,6 +832,7 @@ struct ib_cache {
827 struct ib_event_handler event_handler; 832 struct ib_event_handler event_handler;
828 struct ib_pkey_cache **pkey_cache; 833 struct ib_pkey_cache **pkey_cache;
829 struct ib_gid_cache **gid_cache; 834 struct ib_gid_cache **gid_cache;
835 u8 *lmc_cache;
830}; 836};
831 837
832struct ib_device { 838struct ib_device {
@@ -1086,6 +1092,20 @@ int ib_dealloc_pd(struct ib_pd *pd);
1086struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); 1092struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
1087 1093
1088/** 1094/**
1095 * ib_init_ah_from_wc - Initializes address handle attributes from a
1096 * work completion.
1097 * @device: Device on which the received message arrived.
1098 * @port_num: Port on which the received message arrived.
1099 * @wc: Work completion associated with the received message.
1100 * @grh: References the received global route header. This parameter is
1101 * ignored unless the work completion indicates that the GRH is valid.
1102 * @ah_attr: Returned attributes that can be used when creating an address
1103 * handle for replying to the message.
1104 */
1105int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, struct ib_wc *wc,
1106 struct ib_grh *grh, struct ib_ah_attr *ah_attr);
1107
1108/**
1089 * ib_create_ah_from_wc - Creates an address handle associated with the 1109 * ib_create_ah_from_wc - Creates an address handle associated with the
1090 * sender of the specified work completion. 1110 * sender of the specified work completion.
1091 * @pd: The protection domain associated with the address handle. 1111 * @pd: The protection domain associated with the address handle.
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
new file mode 100644
index 000000000000..402c63d7226b
--- /dev/null
+++ b/include/rdma/rdma_cm.h
@@ -0,0 +1,256 @@
1/*
2 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
4 *
5 * This Software is licensed under one of the following licenses:
6 *
7 * 1) under the terms of the "Common Public License 1.0" a copy of which is
8 * available from the Open Source Initiative, see
9 * http://www.opensource.org/licenses/cpl.php.
10 *
11 * 2) under the terms of the "The BSD License" a copy of which is
12 * available from the Open Source Initiative, see
13 * http://www.opensource.org/licenses/bsd-license.php.
14 *
15 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
16 * copy of which is available from the Open Source Initiative, see
17 * http://www.opensource.org/licenses/gpl-license.php.
18 *
19 * Licensee has the right to choose one of the above licenses.
20 *
21 * Redistributions of source code must retain the above copyright
22 * notice and one of the license notices.
23 *
24 * Redistributions in binary form must reproduce both the above copyright
25 * notice, one of the license notices in the documentation
26 * and/or other materials provided with the distribution.
27 *
28 */
29
30#if !defined(RDMA_CM_H)
31#define RDMA_CM_H
32
33#include <linux/socket.h>
34#include <linux/in6.h>
35#include <rdma/ib_addr.h>
36#include <rdma/ib_sa.h>
37
38/*
39 * Upon receiving a device removal event, users must destroy the associated
40 * RDMA identifier and release all resources allocated with the device.
41 */
42enum rdma_cm_event_type {
43 RDMA_CM_EVENT_ADDR_RESOLVED,
44 RDMA_CM_EVENT_ADDR_ERROR,
45 RDMA_CM_EVENT_ROUTE_RESOLVED,
46 RDMA_CM_EVENT_ROUTE_ERROR,
47 RDMA_CM_EVENT_CONNECT_REQUEST,
48 RDMA_CM_EVENT_CONNECT_RESPONSE,
49 RDMA_CM_EVENT_CONNECT_ERROR,
50 RDMA_CM_EVENT_UNREACHABLE,
51 RDMA_CM_EVENT_REJECTED,
52 RDMA_CM_EVENT_ESTABLISHED,
53 RDMA_CM_EVENT_DISCONNECTED,
54 RDMA_CM_EVENT_DEVICE_REMOVAL,
55};
56
57enum rdma_port_space {
58 RDMA_PS_SDP = 0x0001,
59 RDMA_PS_TCP = 0x0106,
60 RDMA_PS_UDP = 0x0111,
61 RDMA_PS_SCTP = 0x0183
62};
63
64struct rdma_addr {
65 struct sockaddr src_addr;
66 u8 src_pad[sizeof(struct sockaddr_in6) -
67 sizeof(struct sockaddr)];
68 struct sockaddr dst_addr;
69 u8 dst_pad[sizeof(struct sockaddr_in6) -
70 sizeof(struct sockaddr)];
71 struct rdma_dev_addr dev_addr;
72};
73
74struct rdma_route {
75 struct rdma_addr addr;
76 struct ib_sa_path_rec *path_rec;
77 int num_paths;
78};
79
80struct rdma_cm_event {
81 enum rdma_cm_event_type event;
82 int status;
83 void *private_data;
84 u8 private_data_len;
85};
86
87struct rdma_cm_id;
88
89/**
90 * rdma_cm_event_handler - Callback used to report user events.
91 *
92 * Notes: Users may not call rdma_destroy_id from this callback to destroy
93 * the passed in id, or a corresponding listen id. Returning a
94 * non-zero value from the callback will destroy the passed in id.
95 */
96typedef int (*rdma_cm_event_handler)(struct rdma_cm_id *id,
97 struct rdma_cm_event *event);
98
99struct rdma_cm_id {
100 struct ib_device *device;
101 void *context;
102 struct ib_qp *qp;
103 rdma_cm_event_handler event_handler;
104 struct rdma_route route;
105 enum rdma_port_space ps;
106 u8 port_num;
107};
108
109/**
110 * rdma_create_id - Create an RDMA identifier.
111 *
112 * @event_handler: User callback invoked to report events associated with the
113 * returned rdma_id.
114 * @context: User specified context associated with the id.
115 * @ps: RDMA port space.
116 */
117struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
118 void *context, enum rdma_port_space ps);
119
120void rdma_destroy_id(struct rdma_cm_id *id);
121
122/**
123 * rdma_bind_addr - Bind an RDMA identifier to a source address and
124 * associated RDMA device, if needed.
125 *
126 * @id: RDMA identifier.
127 * @addr: Local address information. Wildcard values are permitted.
128 *
129 * This associates a source address with the RDMA identifier before calling
130 * rdma_listen. If a specific local address is given, the RDMA identifier will
131 * be bound to a local RDMA device.
132 */
133int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr);
134
135/**
136 * rdma_resolve_addr - Resolve destination and optional source addresses
137 * from IP addresses to an RDMA address. If successful, the specified
138 * rdma_cm_id will be bound to a local device.
139 *
140 * @id: RDMA identifier.
141 * @src_addr: Source address information. This parameter may be NULL.
142 * @dst_addr: Destination address information.
143 * @timeout_ms: Time to wait for resolution to complete.
144 */
145int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
146 struct sockaddr *dst_addr, int timeout_ms);
147
148/**
149 * rdma_resolve_route - Resolve the RDMA address bound to the RDMA identifier
150 * into route information needed to establish a connection.
151 *
152 * This is called on the client side of a connection.
153 * Users must have first called rdma_resolve_addr to resolve a dst_addr
154 * into an RDMA address before calling this routine.
155 */
156int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms);
157
158/**
159 * rdma_create_qp - Allocate a QP and associate it with the specified RDMA
160 * identifier.
161 *
162 * QPs allocated to an rdma_cm_id will automatically be transitioned by the CMA
163 * through their states.
164 */
165int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
166 struct ib_qp_init_attr *qp_init_attr);
167
168/**
169 * rdma_destroy_qp - Deallocate the QP associated with the specified RDMA
170 * identifier.
171 *
172 * Users must destroy any QP associated with an RDMA identifier before
173 * destroying the RDMA ID.
174 */
175void rdma_destroy_qp(struct rdma_cm_id *id);
176
177/**
178 * rdma_init_qp_attr - Initializes the QP attributes for use in transitioning
179 * to a specified QP state.
180 * @id: Communication identifier associated with the QP attributes to
181 * initialize.
182 * @qp_attr: On input, specifies the desired QP state. On output, the
183 * mandatory and desired optional attributes will be set in order to
184 * modify the QP to the specified state.
185 * @qp_attr_mask: The QP attribute mask that may be used to transition the
186 * QP to the specified state.
187 *
188 * Users must set the @qp_attr->qp_state to the desired QP state. This call
189 * will set all required attributes for the given transition, along with
190 * known optional attributes. Users may override the attributes returned from
191 * this call before calling ib_modify_qp.
192 *
193 * Users that wish to have their QP automatically transitioned through its
194 * states can associate a QP with the rdma_cm_id by calling rdma_create_qp().
195 */
196int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
197 int *qp_attr_mask);
198
199struct rdma_conn_param {
200 const void *private_data;
201 u8 private_data_len;
202 u8 responder_resources;
203 u8 initiator_depth;
204 u8 flow_control;
205 u8 retry_count; /* ignored when accepting */
206 u8 rnr_retry_count;
207 /* Fields below ignored if a QP is created on the rdma_cm_id. */
208 u8 srq;
209 u32 qp_num;
210 enum ib_qp_type qp_type;
211};
212
213/**
214 * rdma_connect - Initiate an active connection request.
215 *
216 * Users must have resolved a route for the rdma_cm_id to connect with
217 * by having called rdma_resolve_route before calling this routine.
218 */
219int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
220
221/**
222 * rdma_listen - This function is called by the passive side to
223 * listen for incoming connection requests.
224 *
225 * Users must have bound the rdma_cm_id to a local address by calling
226 * rdma_bind_addr before calling this routine.
227 */
228int rdma_listen(struct rdma_cm_id *id, int backlog);
229
230/**
231 * rdma_accept - Called to accept a connection request or response.
232 * @id: Connection identifier associated with the request.
233 * @conn_param: Information needed to establish the connection. This must be
234 * provided if accepting a connection request. If accepting a connection
235 * response, this parameter must be NULL.
236 *
237 * Typically, this routine is only called by the listener to accept a connection
238 * request. It must also be called on the active side of a connection if the
239 * user is performing their own QP transitions.
240 */
241int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
242
243/**
244 * rdma_reject - Called to reject a connection request or response.
245 */
246int rdma_reject(struct rdma_cm_id *id, const void *private_data,
247 u8 private_data_len);
248
249/**
250 * rdma_disconnect - This function disconnects the associated QP and
251 * transitions it into the error state.
252 */
253int rdma_disconnect(struct rdma_cm_id *id);
254
255#endif /* RDMA_CM_H */
256
diff --git a/include/rdma/rdma_cm_ib.h b/include/rdma/rdma_cm_ib.h
new file mode 100644
index 000000000000..e8c3af1804d4
--- /dev/null
+++ b/include/rdma/rdma_cm_ib.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2006 Intel Corporation. All rights reserved.
3 *
4 * This Software is licensed under one of the following licenses:
5 *
6 * 1) under the terms of the "Common Public License 1.0" a copy of which is
7 * available from the Open Source Initiative, see
8 * http://www.opensource.org/licenses/cpl.php.
9 *
10 * 2) under the terms of the "The BSD License" a copy of which is
11 * available from the Open Source Initiative, see
12 * http://www.opensource.org/licenses/bsd-license.php.
13 *
14 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
15 * copy of which is available from the Open Source Initiative, see
16 * http://www.opensource.org/licenses/gpl-license.php.
17 *
18 * Licensee has the right to choose one of the above licenses.
19 *
20 * Redistributions of source code must retain the above copyright
21 * notice and one of the license notices.
22 *
23 * Redistributions in binary form must reproduce both the above copyright
24 * notice, one of the license notices in the documentation
25 * and/or other materials provided with the distribution.
26 *
27 */
28
29#if !defined(RDMA_CM_IB_H)
30#define RDMA_CM_IB_H
31
32#include <rdma/rdma_cm.h>
33
34/**
35 * rdma_set_ib_paths - Manually sets the path records used to establish a
36 * connection.
37 * @id: Connection identifier associated with the request.
38 * @path_rec: Reference to the path record
39 *
40 * This call permits a user to specify routing information for rdma_cm_id's
41 * bound to Infiniband devices. It is called on the client side of a
42 * connection and replaces the call to rdma_resolve_route.
43 */
44int rdma_set_ib_paths(struct rdma_cm_id *id,
45 struct ib_sa_path_rec *path_rec, int num_paths);
46
47#endif /* RDMA_CM_IB_H */
diff --git a/include/scsi/srp.h b/include/scsi/srp.h
index 637f77eccf0c..ad178fa78f66 100644
--- a/include/scsi/srp.h
+++ b/include/scsi/srp.h
@@ -87,6 +87,11 @@ enum srp_login_rej_reason {
87 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006 87 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
88}; 88};
89 89
90enum {
91 SRP_REV10_IB_IO_CLASS = 0xff00,
92 SRP_REV16A_IB_IO_CLASS = 0x0100
93};
94
90struct srp_direct_buf { 95struct srp_direct_buf {
91 __be64 va; 96 __be64 va;
92 __be32 key; 97 __be32 key;
diff --git a/kernel/exit.c b/kernel/exit.c
index e95b93282210..e06d0c10a24e 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -881,14 +881,6 @@ fastcall NORET_TYPE void do_exit(long code)
881 881
882 tsk->flags |= PF_EXITING; 882 tsk->flags |= PF_EXITING;
883 883
884 /*
885 * Make sure we don't try to process any timer firings
886 * while we are already exiting.
887 */
888 tsk->it_virt_expires = cputime_zero;
889 tsk->it_prof_expires = cputime_zero;
890 tsk->it_sched_expires = 0;
891
892 if (unlikely(in_atomic())) 884 if (unlikely(in_atomic()))
893 printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", 885 printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
894 current->comm, current->pid, 886 current->comm, current->pid,
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 520f6c59948d..d38d9ec3276c 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -555,9 +555,6 @@ static void arm_timer(struct k_itimer *timer, union cpu_time_count now)
555 struct cpu_timer_list *next; 555 struct cpu_timer_list *next;
556 unsigned long i; 556 unsigned long i;
557 557
558 if (CPUCLOCK_PERTHREAD(timer->it_clock) && (p->flags & PF_EXITING))
559 return;
560
561 head = (CPUCLOCK_PERTHREAD(timer->it_clock) ? 558 head = (CPUCLOCK_PERTHREAD(timer->it_clock) ?
562 p->cpu_timers : p->signal->cpu_timers); 559 p->cpu_timers : p->signal->cpu_timers);
563 head += CPUCLOCK_WHICH(timer->it_clock); 560 head += CPUCLOCK_WHICH(timer->it_clock);
@@ -1173,6 +1170,9 @@ static void check_process_timers(struct task_struct *tsk,
1173 } 1170 }
1174 t = tsk; 1171 t = tsk;
1175 do { 1172 do {
1173 if (unlikely(t->flags & PF_EXITING))
1174 continue;
1175
1176 ticks = cputime_add(cputime_add(t->utime, t->stime), 1176 ticks = cputime_add(cputime_add(t->utime, t->stime),
1177 prof_left); 1177 prof_left);
1178 if (!cputime_eq(prof_expires, cputime_zero) && 1178 if (!cputime_eq(prof_expires, cputime_zero) &&
@@ -1193,11 +1193,7 @@ static void check_process_timers(struct task_struct *tsk,
1193 t->it_sched_expires > sched)) { 1193 t->it_sched_expires > sched)) {
1194 t->it_sched_expires = sched; 1194 t->it_sched_expires = sched;
1195 } 1195 }
1196 1196 } while ((t = next_thread(t)) != tsk);
1197 do {
1198 t = next_thread(t);
1199 } while (unlikely(t->flags & PF_EXITING));
1200 } while (t != tsk);
1201 } 1197 }
1202} 1198}
1203 1199
@@ -1289,30 +1285,30 @@ void run_posix_cpu_timers(struct task_struct *tsk)
1289 1285
1290#undef UNEXPIRED 1286#undef UNEXPIRED
1291 1287
1292 BUG_ON(tsk->exit_state);
1293
1294 /* 1288 /*
1295 * Double-check with locks held. 1289 * Double-check with locks held.
1296 */ 1290 */
1297 read_lock(&tasklist_lock); 1291 read_lock(&tasklist_lock);
1298 spin_lock(&tsk->sighand->siglock); 1292 if (likely(tsk->signal != NULL)) {
1293 spin_lock(&tsk->sighand->siglock);
1299 1294
1300 /* 1295 /*
1301 * Here we take off tsk->cpu_timers[N] and tsk->signal->cpu_timers[N] 1296 * Here we take off tsk->cpu_timers[N] and tsk->signal->cpu_timers[N]
1302 * all the timers that are firing, and put them on the firing list. 1297 * all the timers that are firing, and put them on the firing list.
1303 */ 1298 */
1304 check_thread_timers(tsk, &firing); 1299 check_thread_timers(tsk, &firing);
1305 check_process_timers(tsk, &firing); 1300 check_process_timers(tsk, &firing);
1306 1301
1307 /* 1302 /*
1308 * We must release these locks before taking any timer's lock. 1303 * We must release these locks before taking any timer's lock.
1309 * There is a potential race with timer deletion here, as the 1304 * There is a potential race with timer deletion here, as the
1310 * siglock now protects our private firing list. We have set 1305 * siglock now protects our private firing list. We have set
1311 * the firing flag in each timer, so that a deletion attempt 1306 * the firing flag in each timer, so that a deletion attempt
1312 * that gets the timer lock before we do will give it up and 1307 * that gets the timer lock before we do will give it up and
1313 * spin until we've taken care of that timer below. 1308 * spin until we've taken care of that timer below.
1314 */ 1309 */
1315 spin_unlock(&tsk->sighand->siglock); 1310 spin_unlock(&tsk->sighand->siglock);
1311 }
1316 read_unlock(&tasklist_lock); 1312 read_unlock(&tasklist_lock);
1317 1313
1318 /* 1314 /*
diff --git a/kernel/power/main.c b/kernel/power/main.c
index a6d9ef46009e..0a907f0dc56b 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -86,6 +86,7 @@ static int suspend_prepare(suspend_state_t state)
86 goto Thaw; 86 goto Thaw;
87 } 87 }
88 88
89 suspend_console();
89 if ((error = device_suspend(PMSG_SUSPEND))) { 90 if ((error = device_suspend(PMSG_SUSPEND))) {
90 printk(KERN_ERR "Some devices failed to suspend\n"); 91 printk(KERN_ERR "Some devices failed to suspend\n");
91 goto Finish; 92 goto Finish;
@@ -133,6 +134,7 @@ int suspend_enter(suspend_state_t state)
133static void suspend_finish(suspend_state_t state) 134static void suspend_finish(suspend_state_t state)
134{ 135{
135 device_resume(); 136 device_resume();
137 resume_console();
136 thaw_processes(); 138 thaw_processes();
137 enable_nonboot_cpus(); 139 enable_nonboot_cpus();
138 if (pm_ops && pm_ops->finish) 140 if (pm_ops && pm_ops->finish)
diff --git a/kernel/printk.c b/kernel/printk.c
index c056f3324432..19a955619294 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -67,6 +67,7 @@ EXPORT_SYMBOL(oops_in_progress);
67 * driver system. 67 * driver system.
68 */ 68 */
69static DECLARE_MUTEX(console_sem); 69static DECLARE_MUTEX(console_sem);
70static DECLARE_MUTEX(secondary_console_sem);
70struct console *console_drivers; 71struct console *console_drivers;
71/* 72/*
72 * This is used for debugging the mess that is the VT code by 73 * This is used for debugging the mess that is the VT code by
@@ -76,7 +77,7 @@ struct console *console_drivers;
76 * path in the console code where we end up in places I want 77 * path in the console code where we end up in places I want
77 * locked without the console sempahore held 78 * locked without the console sempahore held
78 */ 79 */
79static int console_locked; 80static int console_locked, console_suspended;
80 81
81/* 82/*
82 * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars 83 * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars
@@ -698,6 +699,23 @@ int __init add_preferred_console(char *name, int idx, char *options)
698} 699}
699 700
700/** 701/**
702 * suspend_console - suspend the console subsystem
703 *
704 * This disables printk() while we go into suspend states
705 */
706void suspend_console(void)
707{
708 acquire_console_sem();
709 console_suspended = 1;
710}
711
712void resume_console(void)
713{
714 console_suspended = 0;
715 release_console_sem();
716}
717
718/**
701 * acquire_console_sem - lock the console system for exclusive use. 719 * acquire_console_sem - lock the console system for exclusive use.
702 * 720 *
703 * Acquires a semaphore which guarantees that the caller has 721 * Acquires a semaphore which guarantees that the caller has
@@ -708,6 +726,10 @@ int __init add_preferred_console(char *name, int idx, char *options)
708void acquire_console_sem(void) 726void acquire_console_sem(void)
709{ 727{
710 BUG_ON(in_interrupt()); 728 BUG_ON(in_interrupt());
729 if (console_suspended) {
730 down(&secondary_console_sem);
731 return;
732 }
711 down(&console_sem); 733 down(&console_sem);
712 console_locked = 1; 734 console_locked = 1;
713 console_may_schedule = 1; 735 console_may_schedule = 1;
@@ -750,6 +772,10 @@ void release_console_sem(void)
750 unsigned long _con_start, _log_end; 772 unsigned long _con_start, _log_end;
751 unsigned long wake_klogd = 0; 773 unsigned long wake_klogd = 0;
752 774
775 if (console_suspended) {
776 up(&secondary_console_sem);
777 return;
778 }
753 for ( ; ; ) { 779 for ( ; ; ) {
754 spin_lock_irqsave(&logbuf_lock, flags); 780 spin_lock_irqsave(&logbuf_lock, flags);
755 wake_klogd |= log_start - log_end; 781 wake_klogd |= log_start - log_end;
diff --git a/mm/shmem.c b/mm/shmem.c
index 4c5e68e4e9ae..1e43c8a865ba 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1780,6 +1780,7 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry)
1780 if (!simple_empty(dentry)) 1780 if (!simple_empty(dentry))
1781 return -ENOTEMPTY; 1781 return -ENOTEMPTY;
1782 1782
1783 dentry->d_inode->i_nlink--;
1783 dir->i_nlink--; 1784 dir->i_nlink--;
1784 return shmem_unlink(dir, dentry); 1785 return shmem_unlink(dir, dentry);
1785} 1786}
@@ -2102,6 +2103,7 @@ static int shmem_fill_super(struct super_block *sb,
2102 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 2103 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
2103 sb->s_magic = TMPFS_MAGIC; 2104 sb->s_magic = TMPFS_MAGIC;
2104 sb->s_op = &shmem_ops; 2105 sb->s_op = &shmem_ops;
2106 sb->s_time_gran = 1;
2105 2107
2106 inode = shmem_get_inode(sb, S_IFDIR | mode, 0); 2108 inode = shmem_get_inode(sb, S_IFDIR | mode, 0);
2107 if (!inode) 2109 if (!inode)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4649a63a8cb6..440a733fe2e9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1061,7 +1061,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, unsigned long nr_pages,
1061loop_again: 1061loop_again:
1062 total_scanned = 0; 1062 total_scanned = 0;
1063 nr_reclaimed = 0; 1063 nr_reclaimed = 0;
1064 sc.may_writepage = !laptop_mode, 1064 sc.may_writepage = !laptop_mode;
1065 sc.nr_mapped = read_page_state(nr_mapped); 1065 sc.nr_mapped = read_page_state(nr_mapped);
1066 1066
1067 inc_page_state(pageoutrun); 1067 inc_page_state(pageoutrun);
diff --git a/net/Kconfig b/net/Kconfig
index 4193cdcd3ae7..c6cec5aa5486 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -66,6 +66,13 @@ source "net/ipv6/Kconfig"
66 66
67endif # if INET 67endif # if INET
68 68
69config NETWORK_SECMARK
70 bool "Security Marking"
71 help
72 This enables security marking of network packets, similar
73 to nfmark, but designated for security purposes.
74 If you are unsure how to answer this question, answer N.
75
69menuconfig NETFILTER 76menuconfig NETFILTER
70 bool "Network packet filtering (replaces ipchains)" 77 bool "Network packet filtering (replaces ipchains)"
71 ---help--- 78 ---help---
@@ -215,6 +222,21 @@ config NET_PKTGEN
215 To compile this code as a module, choose M here: the 222 To compile this code as a module, choose M here: the
216 module will be called pktgen. 223 module will be called pktgen.
217 224
225config NET_TCPPROBE
226 tristate "TCP connection probing"
227 depends on INET && EXPERIMENTAL && PROC_FS && KPROBES
228 ---help---
229 This module allows for capturing the changes to TCP connection
230 state in response to incoming packets. It is used for debugging
231 TCP congestion avoidance modules. If you don't understand
232 what was just said, you don't need it: say N.
233
234 Documentation on how to use the packet generator can be found
235 at http://linux-net.osdl.org/index.php/TcpProbe
236
237 To compile this code as a module, choose M here: the
238 module will be called tcp_probe.
239
218endmenu 240endmenu
219 241
220endmenu 242endmenu
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 72d852982664..f92f9c94d2c7 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -98,7 +98,7 @@ static void unlink_clip_vcc(struct clip_vcc *clip_vcc)
98 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);
99 return; 99 return;
100 } 100 }
101 spin_lock_bh(&entry->neigh->dev->xmit_lock); /* block clip_start_xmit() */ 101 netif_tx_lock_bh(entry->neigh->dev); /* block clip_start_xmit() */
102 entry->neigh->used = jiffies; 102 entry->neigh->used = jiffies;
103 for (walk = &entry->vccs; *walk; walk = &(*walk)->next) 103 for (walk = &entry->vccs; *walk; walk = &(*walk)->next)
104 if (*walk == clip_vcc) { 104 if (*walk == clip_vcc) {
@@ -122,7 +122,7 @@ static void unlink_clip_vcc(struct clip_vcc *clip_vcc)
122 printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc " 122 printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc "
123 "0x%p)\n", entry, clip_vcc); 123 "0x%p)\n", entry, clip_vcc);
124 out: 124 out:
125 spin_unlock_bh(&entry->neigh->dev->xmit_lock); 125 netif_tx_unlock_bh(entry->neigh->dev);
126} 126}
127 127
128/* The neighbour entry n->lock is held. */ 128/* The neighbour entry n->lock is held. */
diff --git a/net/bridge/Makefile b/net/bridge/Makefile
index 59556e40e143..f444c12cde5a 100644
--- a/net/bridge/Makefile
+++ b/net/bridge/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_BRIDGE) += bridge.o
6 6
7bridge-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \ 7bridge-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \
8 br_ioctl.o br_notify.o br_stp.o br_stp_bpdu.o \ 8 br_ioctl.o br_notify.o br_stp.o br_stp_bpdu.o \
9 br_stp_if.o br_stp_timer.o 9 br_stp_if.o br_stp_timer.o br_netlink.o
10 10
11bridge-$(CONFIG_SYSFS) += br_sysfs_if.o br_sysfs_br.o 11bridge-$(CONFIG_SYSFS) += br_sysfs_if.o br_sysfs_br.o
12 12
diff --git a/net/bridge/br.c b/net/bridge/br.c
index 12da21afb9ca..654401ceb2db 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -30,36 +30,46 @@ static struct llc_sap *br_stp_sap;
30 30
31static int __init br_init(void) 31static int __init br_init(void)
32{ 32{
33 int err;
34
33 br_stp_sap = llc_sap_open(LLC_SAP_BSPAN, br_stp_rcv); 35 br_stp_sap = llc_sap_open(LLC_SAP_BSPAN, br_stp_rcv);
34 if (!br_stp_sap) { 36 if (!br_stp_sap) {
35 printk(KERN_ERR "bridge: can't register sap for STP\n"); 37 printk(KERN_ERR "bridge: can't register sap for STP\n");
36 return -EBUSY; 38 return -EADDRINUSE;
37 } 39 }
38 40
39 br_fdb_init(); 41 br_fdb_init();
40 42
41#ifdef CONFIG_BRIDGE_NETFILTER 43 err = br_netfilter_init();
42 if (br_netfilter_init()) 44 if (err)
43 return 1; 45 goto err_out1;
44#endif 46
47 err = register_netdevice_notifier(&br_device_notifier);
48 if (err)
49 goto err_out2;
50
51 br_netlink_init();
45 brioctl_set(br_ioctl_deviceless_stub); 52 brioctl_set(br_ioctl_deviceless_stub);
46 br_handle_frame_hook = br_handle_frame; 53 br_handle_frame_hook = br_handle_frame;
47 54
48 br_fdb_get_hook = br_fdb_get; 55 br_fdb_get_hook = br_fdb_get;
49 br_fdb_put_hook = br_fdb_put; 56 br_fdb_put_hook = br_fdb_put;
50 57
51 register_netdevice_notifier(&br_device_notifier);
52
53 return 0; 58 return 0;
59
60err_out2:
61 br_netfilter_fini();
62err_out1:
63 llc_sap_put(br_stp_sap);
64 return err;
54} 65}
55 66
56static void __exit br_deinit(void) 67static void __exit br_deinit(void)
57{ 68{
58 rcu_assign_pointer(br_stp_sap->rcv_func, NULL); 69 rcu_assign_pointer(br_stp_sap->rcv_func, NULL);
59 70
60#ifdef CONFIG_BRIDGE_NETFILTER 71 br_netlink_fini();
61 br_netfilter_fini(); 72 br_netfilter_fini();
62#endif
63 unregister_netdevice_notifier(&br_device_notifier); 73 unregister_netdevice_notifier(&br_device_notifier);
64 brioctl_set(NULL); 74 brioctl_set(NULL);
65 75
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 0c88a2ac32c1..2afdc7c0736c 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -145,9 +145,9 @@ static int br_set_tx_csum(struct net_device *dev, u32 data)
145 struct net_bridge *br = netdev_priv(dev); 145 struct net_bridge *br = netdev_priv(dev);
146 146
147 if (data) 147 if (data)
148 br->feature_mask |= NETIF_F_IP_CSUM; 148 br->feature_mask |= NETIF_F_NO_CSUM;
149 else 149 else
150 br->feature_mask &= ~NETIF_F_IP_CSUM; 150 br->feature_mask &= ~NETIF_F_ALL_CSUM;
151 151
152 br_features_recompute(br); 152 br_features_recompute(br);
153 return 0; 153 return 0;
@@ -185,5 +185,5 @@ void br_dev_setup(struct net_device *dev)
185 dev->priv_flags = IFF_EBRIDGE; 185 dev->priv_flags = IFF_EBRIDGE;
186 186
187 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST 187 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
188 | NETIF_F_HIGHDMA | NETIF_F_TSO | NETIF_F_IP_CSUM; 188 | NETIF_F_HIGHDMA | NETIF_F_TSO | NETIF_F_NO_CSUM;
189} 189}
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index 56f3aa47e758..0dca027ceb80 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -20,14 +20,11 @@
20#include <linux/netfilter_bridge.h> 20#include <linux/netfilter_bridge.h>
21#include "br_private.h" 21#include "br_private.h"
22 22
23/* Don't forward packets to originating port or forwarding diasabled */
23static inline int should_deliver(const struct net_bridge_port *p, 24static inline int should_deliver(const struct net_bridge_port *p,
24 const struct sk_buff *skb) 25 const struct sk_buff *skb)
25{ 26{
26 if (skb->dev == p->dev || 27 return (skb->dev != p->dev && p->state == BR_STATE_FORWARDING);
27 p->state != BR_STATE_FORWARDING)
28 return 0;
29
30 return 1;
31} 28}
32 29
33static inline unsigned packet_length(const struct sk_buff *skb) 30static inline unsigned packet_length(const struct sk_buff *skb)
@@ -55,10 +52,9 @@ int br_dev_queue_push_xmit(struct sk_buff *skb)
55 52
56int br_forward_finish(struct sk_buff *skb) 53int br_forward_finish(struct sk_buff *skb)
57{ 54{
58 NF_HOOK(PF_BRIDGE, NF_BR_POST_ROUTING, skb, NULL, skb->dev, 55 return NF_HOOK(PF_BRIDGE, NF_BR_POST_ROUTING, skb, NULL, skb->dev,
59 br_dev_queue_push_xmit); 56 br_dev_queue_push_xmit);
60 57
61 return 0;
62} 58}
63 59
64static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb) 60static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index f5d47bf4f967..fdec773f5b52 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -372,12 +372,17 @@ void br_features_recompute(struct net_bridge *br)
372 struct net_bridge_port *p; 372 struct net_bridge_port *p;
373 unsigned long features, checksum; 373 unsigned long features, checksum;
374 374
375 features = br->feature_mask &~ NETIF_F_IP_CSUM; 375 checksum = br->feature_mask & NETIF_F_ALL_CSUM ? NETIF_F_NO_CSUM : 0;
376 checksum = br->feature_mask & NETIF_F_IP_CSUM; 376 features = br->feature_mask & ~NETIF_F_ALL_CSUM;
377 377
378 list_for_each_entry(p, &br->port_list, list) { 378 list_for_each_entry(p, &br->port_list, list) {
379 if (!(p->dev->features 379 if (checksum & NETIF_F_NO_CSUM &&
380 & (NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM))) 380 !(p->dev->features & NETIF_F_NO_CSUM))
381 checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
382 if (checksum & NETIF_F_HW_CSUM &&
383 !(p->dev->features & NETIF_F_HW_CSUM))
384 checksum ^= NETIF_F_HW_CSUM | NETIF_F_IP_CSUM;
385 if (!(p->dev->features & NETIF_F_IP_CSUM))
381 checksum = 0; 386 checksum = 0;
382 features &= p->dev->features; 387 features &= p->dev->features;
383 } 388 }
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 3da9264449f7..3e41f9d6d51c 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -407,12 +407,8 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
407 if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { 407 if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) {
408 if (pkt_len + sizeof(struct ipv6hdr) > skb->len) 408 if (pkt_len + sizeof(struct ipv6hdr) > skb->len)
409 goto inhdr_error; 409 goto inhdr_error;
410 if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { 410 if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr)))
411 if (__pskb_trim(skb, pkt_len + sizeof(struct ipv6hdr))) 411 goto inhdr_error;
412 goto inhdr_error;
413 if (skb->ip_summed == CHECKSUM_HW)
414 skb->ip_summed = CHECKSUM_NONE;
415 }
416 } 412 }
417 if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb)) 413 if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb))
418 goto inhdr_error; 414 goto inhdr_error;
@@ -495,11 +491,7 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
495 if (skb->len < len || len < 4 * iph->ihl) 491 if (skb->len < len || len < 4 * iph->ihl)
496 goto inhdr_error; 492 goto inhdr_error;
497 493
498 if (skb->len > len) { 494 pskb_trim_rcsum(skb, len);
499 __pskb_trim(skb, len);
500 if (skb->ip_summed == CHECKSUM_HW)
501 skb->ip_summed = CHECKSUM_NONE;
502 }
503 495
504 nf_bridge_put(skb->nf_bridge); 496 nf_bridge_put(skb->nf_bridge);
505 if (!nf_bridge_alloc(skb)) 497 if (!nf_bridge_alloc(skb))
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
new file mode 100644
index 000000000000..881d7d1a732a
--- /dev/null
+++ b/net/bridge/br_netlink.c
@@ -0,0 +1,199 @@
1/*
2 * Bridge netlink control interface
3 *
4 * Authors:
5 * Stephen Hemminger <shemminger@osdl.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/rtnetlink.h>
15#include "br_private.h"
16
17/*
18 * Create one netlink message for one interface
19 * Contains port and master info as well as carrier and bridge state.
20 */
21static int br_fill_ifinfo(struct sk_buff *skb, const struct net_bridge_port *port,
22 u32 pid, u32 seq, int event, unsigned int flags)
23{
24 const struct net_bridge *br = port->br;
25 const struct net_device *dev = port->dev;
26 struct ifinfomsg *r;
27 struct nlmsghdr *nlh;
28 unsigned char *b = skb->tail;
29 u32 mtu = dev->mtu;
30 u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN;
31 u8 portstate = port->state;
32
33 pr_debug("br_fill_info event %d port %s master %s\n",
34 event, dev->name, br->dev->name);
35
36 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags);
37 r = NLMSG_DATA(nlh);
38 r->ifi_family = AF_BRIDGE;
39 r->__ifi_pad = 0;
40 r->ifi_type = dev->type;
41 r->ifi_index = dev->ifindex;
42 r->ifi_flags = dev_get_flags(dev);
43 r->ifi_change = 0;
44
45 RTA_PUT(skb, IFLA_IFNAME, strlen(dev->name)+1, dev->name);
46
47 RTA_PUT(skb, IFLA_MASTER, sizeof(int), &br->dev->ifindex);
48
49 if (dev->addr_len)
50 RTA_PUT(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr);
51
52 RTA_PUT(skb, IFLA_MTU, sizeof(mtu), &mtu);
53 if (dev->ifindex != dev->iflink)
54 RTA_PUT(skb, IFLA_LINK, sizeof(int), &dev->iflink);
55
56
57 RTA_PUT(skb, IFLA_OPERSTATE, sizeof(operstate), &operstate);
58
59 if (event == RTM_NEWLINK)
60 RTA_PUT(skb, IFLA_PROTINFO, sizeof(portstate), &portstate);
61
62 nlh->nlmsg_len = skb->tail - b;
63
64 return skb->len;
65
66nlmsg_failure:
67rtattr_failure:
68
69 skb_trim(skb, b - skb->data);
70 return -EINVAL;
71}
72
73/*
74 * Notify listeners of a change in port information
75 */
76void br_ifinfo_notify(int event, struct net_bridge_port *port)
77{
78 struct sk_buff *skb;
79 int err = -ENOMEM;
80
81 pr_debug("bridge notify event=%d\n", event);
82 skb = alloc_skb(NLMSG_SPACE(sizeof(struct ifinfomsg) + 128),
83 GFP_ATOMIC);
84 if (!skb)
85 goto err_out;
86
87 err = br_fill_ifinfo(skb, port, current->pid, 0, event, 0);
88 if (err)
89 goto err_kfree;
90
91 NETLINK_CB(skb).dst_group = RTNLGRP_LINK;
92 netlink_broadcast(rtnl, skb, 0, RTNLGRP_LINK, GFP_ATOMIC);
93 return;
94
95err_kfree:
96 kfree_skb(skb);
97err_out:
98 netlink_set_err(rtnl, 0, RTNLGRP_LINK, err);
99}
100
101/*
102 * Dump information about all ports, in response to GETLINK
103 */
104static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
105{
106 struct net_device *dev;
107 int idx;
108 int s_idx = cb->args[0];
109 int err = 0;
110
111 read_lock(&dev_base_lock);
112 for (dev = dev_base, idx = 0; dev; dev = dev->next) {
113 struct net_bridge_port *p = dev->br_port;
114
115 /* not a bridge port */
116 if (!p)
117 continue;
118
119 if (idx < s_idx)
120 continue;
121
122 err = br_fill_ifinfo(skb, p, NETLINK_CB(cb->skb).pid,
123 cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI);
124 if (err <= 0)
125 break;
126 ++idx;
127 }
128 read_unlock(&dev_base_lock);
129
130 cb->args[0] = idx;
131
132 return skb->len;
133}
134
135/*
136 * Change state of port (ie from forwarding to blocking etc)
137 * Used by spanning tree in user space.
138 */
139static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
140{
141 struct rtattr **rta = arg;
142 struct ifinfomsg *ifm = NLMSG_DATA(nlh);
143 struct net_device *dev;
144 struct net_bridge_port *p;
145 u8 new_state;
146
147 if (ifm->ifi_family != AF_BRIDGE)
148 return -EPFNOSUPPORT;
149
150 /* Must pass valid state as PROTINFO */
151 if (rta[IFLA_PROTINFO-1]) {
152 u8 *pstate = RTA_DATA(rta[IFLA_PROTINFO-1]);
153 new_state = *pstate;
154 } else
155 return -EINVAL;
156
157 if (new_state > BR_STATE_BLOCKING)
158 return -EINVAL;
159
160 /* Find bridge port */
161 dev = __dev_get_by_index(ifm->ifi_index);
162 if (!dev)
163 return -ENODEV;
164
165 p = dev->br_port;
166 if (!p)
167 return -EINVAL;
168
169 /* if kernel STP is running, don't allow changes */
170 if (p->br->stp_enabled)
171 return -EBUSY;
172
173 if (!netif_running(dev))
174 return -ENETDOWN;
175
176 if (!netif_carrier_ok(dev) && new_state != BR_STATE_DISABLED)
177 return -ENETDOWN;
178
179 p->state = new_state;
180 br_log_state(p);
181 return 0;
182}
183
184
185static struct rtnetlink_link bridge_rtnetlink_table[RTM_NR_MSGTYPES] = {
186 [RTM_GETLINK - RTM_BASE] = { .dumpit = br_dump_ifinfo, },
187 [RTM_SETLINK - RTM_BASE] = { .doit = br_rtm_setlink, },
188};
189
190void __init br_netlink_init(void)
191{
192 rtnetlink_links[PF_BRIDGE] = bridge_rtnetlink_table;
193}
194
195void __exit br_netlink_fini(void)
196{
197 rtnetlink_links[PF_BRIDGE] = NULL;
198}
199
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index a43a9c1d50d7..20278494e4da 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/rtnetlink.h>
17 18
18#include "br_private.h" 19#include "br_private.h"
19 20
@@ -49,6 +50,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
49 50
50 case NETDEV_CHANGEADDR: 51 case NETDEV_CHANGEADDR:
51 br_fdb_changeaddr(p, dev->dev_addr); 52 br_fdb_changeaddr(p, dev->dev_addr);
53 br_ifinfo_notify(RTM_NEWLINK, p);
52 br_stp_recalculate_bridge_id(br); 54 br_stp_recalculate_bridge_id(br);
53 break; 55 break;
54 56
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 86ecea7ed372..c491fb2f280e 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -29,7 +29,7 @@
29 29
30#define BR_PORT_DEBOUNCE (HZ/10) 30#define BR_PORT_DEBOUNCE (HZ/10)
31 31
32#define BR_VERSION "2.1" 32#define BR_VERSION "2.2"
33 33
34typedef struct bridge_id bridge_id; 34typedef struct bridge_id bridge_id;
35typedef struct mac_addr mac_addr; 35typedef struct mac_addr mac_addr;
@@ -192,8 +192,13 @@ extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
192extern int br_ioctl_deviceless_stub(unsigned int cmd, void __user *arg); 192extern int br_ioctl_deviceless_stub(unsigned int cmd, void __user *arg);
193 193
194/* br_netfilter.c */ 194/* br_netfilter.c */
195#ifdef CONFIG_BRIDGE_NETFILTER
195extern int br_netfilter_init(void); 196extern int br_netfilter_init(void);
196extern void br_netfilter_fini(void); 197extern void br_netfilter_fini(void);
198#else
199#define br_netfilter_init() (0)
200#define br_netfilter_fini() do { } while(0)
201#endif
197 202
198/* br_stp.c */ 203/* br_stp.c */
199extern void br_log_state(const struct net_bridge_port *p); 204extern void br_log_state(const struct net_bridge_port *p);
@@ -232,6 +237,11 @@ extern struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
232extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); 237extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
233 238
234 239
240/* br_netlink.c */
241extern void br_netlink_init(void);
242extern void br_netlink_fini(void);
243extern void br_ifinfo_notify(int event, struct net_bridge_port *port);
244
235#ifdef CONFIG_SYSFS 245#ifdef CONFIG_SYSFS
236/* br_sysfs_if.c */ 246/* br_sysfs_if.c */
237extern struct sysfs_ops brport_sysfs_ops; 247extern struct sysfs_ops brport_sysfs_ops;
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 23dea1422c9a..14cd025079af 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/smp_lock.h> 17#include <linux/smp_lock.h>
18#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
19#include <linux/rtnetlink.h>
19 20
20#include "br_private.h" 21#include "br_private.h"
21#include "br_private_stp.h" 22#include "br_private_stp.h"
@@ -86,6 +87,7 @@ void br_stp_disable_bridge(struct net_bridge *br)
86void br_stp_enable_port(struct net_bridge_port *p) 87void br_stp_enable_port(struct net_bridge_port *p)
87{ 88{
88 br_init_port(p); 89 br_init_port(p);
90 br_ifinfo_notify(RTM_NEWLINK, p);
89 br_port_state_selection(p->br); 91 br_port_state_selection(p->br);
90} 92}
91 93
@@ -99,6 +101,8 @@ void br_stp_disable_port(struct net_bridge_port *p)
99 printk(KERN_INFO "%s: port %i(%s) entering %s state\n", 101 printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
100 br->dev->name, p->port_no, p->dev->name, "disabled"); 102 br->dev->name, p->port_no, p->dev->name, "disabled");
101 103
104 br_ifinfo_notify(RTM_DELLINK, p);
105
102 wasroot = br_is_root_bridge(br); 106 wasroot = br_is_root_bridge(br);
103 br_become_designated_port(p); 107 br_become_designated_port(p);
104 p->state = BR_STATE_DISABLED; 108 p->state = BR_STATE_DISABLED;
diff --git a/net/core/Makefile b/net/core/Makefile
index 79fe12cced27..e9bd2467d5a9 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_NET_DIVERT) += dv.o
16obj-$(CONFIG_NET_PKTGEN) += pktgen.o 16obj-$(CONFIG_NET_PKTGEN) += pktgen.o
17obj-$(CONFIG_WIRELESS_EXT) += wireless.o 17obj-$(CONFIG_WIRELESS_EXT) += wireless.o
18obj-$(CONFIG_NETPOLL) += netpoll.o 18obj-$(CONFIG_NETPOLL) += netpoll.o
19obj-$(CONFIG_NET_DMA) += user_dma.o
diff --git a/net/core/dev.c b/net/core/dev.c
index 4fba549caf29..ab39fe17cb58 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -115,6 +115,7 @@
115#include <net/iw_handler.h> 115#include <net/iw_handler.h>
116#include <asm/current.h> 116#include <asm/current.h>
117#include <linux/audit.h> 117#include <linux/audit.h>
118#include <linux/dmaengine.h>
118 119
119/* 120/*
120 * The list of packet types we will receive (as opposed to discard) 121 * The list of packet types we will receive (as opposed to discard)
@@ -148,6 +149,12 @@ static DEFINE_SPINLOCK(ptype_lock);
148static struct list_head ptype_base[16]; /* 16 way hashed list */ 149static struct list_head ptype_base[16]; /* 16 way hashed list */
149static struct list_head ptype_all; /* Taps */ 150static struct list_head ptype_all; /* Taps */
150 151
152#ifdef CONFIG_NET_DMA
153static struct dma_client *net_dma_client;
154static unsigned int net_dma_count;
155static spinlock_t net_dma_event_lock;
156#endif
157
151/* 158/*
152 * The @dev_base list is protected by @dev_base_lock and the rtnl 159 * The @dev_base list is protected by @dev_base_lock and the rtnl
153 * semaphore. 160 * semaphore.
@@ -1215,75 +1222,15 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
1215#define illegal_highdma(dev, skb) (0) 1222#define illegal_highdma(dev, skb) (0)
1216#endif 1223#endif
1217 1224
1218/* Keep head the same: replace data */
1219int __skb_linearize(struct sk_buff *skb, gfp_t gfp_mask)
1220{
1221 unsigned int size;
1222 u8 *data;
1223 long offset;
1224 struct skb_shared_info *ninfo;
1225 int headerlen = skb->data - skb->head;
1226 int expand = (skb->tail + skb->data_len) - skb->end;
1227
1228 if (skb_shared(skb))
1229 BUG();
1230
1231 if (expand <= 0)
1232 expand = 0;
1233
1234 size = skb->end - skb->head + expand;
1235 size = SKB_DATA_ALIGN(size);
1236 data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
1237 if (!data)
1238 return -ENOMEM;
1239
1240 /* Copy entire thing */
1241 if (skb_copy_bits(skb, -headerlen, data, headerlen + skb->len))
1242 BUG();
1243
1244 /* Set up shinfo */
1245 ninfo = (struct skb_shared_info*)(data + size);
1246 atomic_set(&ninfo->dataref, 1);
1247 ninfo->tso_size = skb_shinfo(skb)->tso_size;
1248 ninfo->tso_segs = skb_shinfo(skb)->tso_segs;
1249 ninfo->nr_frags = 0;
1250 ninfo->frag_list = NULL;
1251
1252 /* Offset between the two in bytes */
1253 offset = data - skb->head;
1254
1255 /* Free old data. */
1256 skb_release_data(skb);
1257
1258 skb->head = data;
1259 skb->end = data + size;
1260
1261 /* Set up new pointers */
1262 skb->h.raw += offset;
1263 skb->nh.raw += offset;
1264 skb->mac.raw += offset;
1265 skb->tail += offset;
1266 skb->data += offset;
1267
1268 /* We are no longer a clone, even if we were. */
1269 skb->cloned = 0;
1270
1271 skb->tail += skb->data_len;
1272 skb->data_len = 0;
1273 return 0;
1274}
1275
1276#define HARD_TX_LOCK(dev, cpu) { \ 1225#define HARD_TX_LOCK(dev, cpu) { \
1277 if ((dev->features & NETIF_F_LLTX) == 0) { \ 1226 if ((dev->features & NETIF_F_LLTX) == 0) { \
1278 spin_lock(&dev->xmit_lock); \ 1227 netif_tx_lock(dev); \
1279 dev->xmit_lock_owner = cpu; \
1280 } \ 1228 } \
1281} 1229}
1282 1230
1283#define HARD_TX_UNLOCK(dev) { \ 1231#define HARD_TX_UNLOCK(dev) { \
1284 if ((dev->features & NETIF_F_LLTX) == 0) { \ 1232 if ((dev->features & NETIF_F_LLTX) == 0) { \
1285 dev->xmit_lock_owner = -1; \ 1233 netif_tx_unlock(dev); \
1286 spin_unlock(&dev->xmit_lock); \
1287 } \ 1234 } \
1288} 1235}
1289 1236
@@ -1321,7 +1268,7 @@ int dev_queue_xmit(struct sk_buff *skb)
1321 1268
1322 if (skb_shinfo(skb)->frag_list && 1269 if (skb_shinfo(skb)->frag_list &&
1323 !(dev->features & NETIF_F_FRAGLIST) && 1270 !(dev->features & NETIF_F_FRAGLIST) &&
1324 __skb_linearize(skb, GFP_ATOMIC)) 1271 __skb_linearize(skb))
1325 goto out_kfree_skb; 1272 goto out_kfree_skb;
1326 1273
1327 /* Fragmented skb is linearized if device does not support SG, 1274 /* Fragmented skb is linearized if device does not support SG,
@@ -1330,14 +1277,14 @@ int dev_queue_xmit(struct sk_buff *skb)
1330 */ 1277 */
1331 if (skb_shinfo(skb)->nr_frags && 1278 if (skb_shinfo(skb)->nr_frags &&
1332 (!(dev->features & NETIF_F_SG) || illegal_highdma(dev, skb)) && 1279 (!(dev->features & NETIF_F_SG) || illegal_highdma(dev, skb)) &&
1333 __skb_linearize(skb, GFP_ATOMIC)) 1280 __skb_linearize(skb))
1334 goto out_kfree_skb; 1281 goto out_kfree_skb;
1335 1282
1336 /* If packet is not checksummed and device does not support 1283 /* If packet is not checksummed and device does not support
1337 * checksumming for this protocol, complete checksumming here. 1284 * checksumming for this protocol, complete checksumming here.
1338 */ 1285 */
1339 if (skb->ip_summed == CHECKSUM_HW && 1286 if (skb->ip_summed == CHECKSUM_HW &&
1340 (!(dev->features & (NETIF_F_HW_CSUM | NETIF_F_NO_CSUM)) && 1287 (!(dev->features & NETIF_F_GEN_CSUM) &&
1341 (!(dev->features & NETIF_F_IP_CSUM) || 1288 (!(dev->features & NETIF_F_IP_CSUM) ||
1342 skb->protocol != htons(ETH_P_IP)))) 1289 skb->protocol != htons(ETH_P_IP))))
1343 if (skb_checksum_help(skb, 0)) 1290 if (skb_checksum_help(skb, 0))
@@ -1382,8 +1329,8 @@ int dev_queue_xmit(struct sk_buff *skb)
1382 /* The device has no queue. Common case for software devices: 1329 /* The device has no queue. Common case for software devices:
1383 loopback, all the sorts of tunnels... 1330 loopback, all the sorts of tunnels...
1384 1331
1385 Really, it is unlikely that xmit_lock protection is necessary here. 1332 Really, it is unlikely that netif_tx_lock protection is necessary
1386 (f.e. loopback and IP tunnels are clean ignoring statistics 1333 here. (f.e. loopback and IP tunnels are clean ignoring statistics
1387 counters.) 1334 counters.)
1388 However, it is possible, that they rely on protection 1335 However, it is possible, that they rely on protection
1389 made by us here. 1336 made by us here.
@@ -1846,6 +1793,19 @@ static void net_rx_action(struct softirq_action *h)
1846 } 1793 }
1847 } 1794 }
1848out: 1795out:
1796#ifdef CONFIG_NET_DMA
1797 /*
1798 * There may not be any more sk_buffs coming right now, so push
1799 * any pending DMA copies to hardware
1800 */
1801 if (net_dma_client) {
1802 struct dma_chan *chan;
1803 rcu_read_lock();
1804 list_for_each_entry_rcu(chan, &net_dma_client->channels, client_node)
1805 dma_async_memcpy_issue_pending(chan);
1806 rcu_read_unlock();
1807 }
1808#endif
1849 local_irq_enable(); 1809 local_irq_enable();
1850 return; 1810 return;
1851 1811
@@ -2785,7 +2745,7 @@ int register_netdevice(struct net_device *dev)
2785 BUG_ON(dev->reg_state != NETREG_UNINITIALIZED); 2745 BUG_ON(dev->reg_state != NETREG_UNINITIALIZED);
2786 2746
2787 spin_lock_init(&dev->queue_lock); 2747 spin_lock_init(&dev->queue_lock);
2788 spin_lock_init(&dev->xmit_lock); 2748 spin_lock_init(&dev->_xmit_lock);
2789 dev->xmit_lock_owner = -1; 2749 dev->xmit_lock_owner = -1;
2790#ifdef CONFIG_NET_CLS_ACT 2750#ifdef CONFIG_NET_CLS_ACT
2791 spin_lock_init(&dev->ingress_lock); 2751 spin_lock_init(&dev->ingress_lock);
@@ -2829,9 +2789,7 @@ int register_netdevice(struct net_device *dev)
2829 2789
2830 /* Fix illegal SG+CSUM combinations. */ 2790 /* Fix illegal SG+CSUM combinations. */
2831 if ((dev->features & NETIF_F_SG) && 2791 if ((dev->features & NETIF_F_SG) &&
2832 !(dev->features & (NETIF_F_IP_CSUM | 2792 !(dev->features & NETIF_F_ALL_CSUM)) {
2833 NETIF_F_NO_CSUM |
2834 NETIF_F_HW_CSUM))) {
2835 printk("%s: Dropping NETIF_F_SG since no checksum feature.\n", 2793 printk("%s: Dropping NETIF_F_SG since no checksum feature.\n",
2836 dev->name); 2794 dev->name);
2837 dev->features &= ~NETIF_F_SG; 2795 dev->features &= ~NETIF_F_SG;
@@ -3300,6 +3258,88 @@ static int dev_cpu_callback(struct notifier_block *nfb,
3300} 3258}
3301#endif /* CONFIG_HOTPLUG_CPU */ 3259#endif /* CONFIG_HOTPLUG_CPU */
3302 3260
3261#ifdef CONFIG_NET_DMA
3262/**
3263 * net_dma_rebalance -
3264 * This is called when the number of channels allocated to the net_dma_client
3265 * changes. The net_dma_client tries to have one DMA channel per CPU.
3266 */
3267static void net_dma_rebalance(void)
3268{
3269 unsigned int cpu, i, n;
3270 struct dma_chan *chan;
3271
3272 lock_cpu_hotplug();
3273
3274 if (net_dma_count == 0) {
3275 for_each_online_cpu(cpu)
3276 rcu_assign_pointer(per_cpu(softnet_data.net_dma, cpu), NULL);
3277 unlock_cpu_hotplug();
3278 return;
3279 }
3280
3281 i = 0;
3282 cpu = first_cpu(cpu_online_map);
3283
3284 rcu_read_lock();
3285 list_for_each_entry(chan, &net_dma_client->channels, client_node) {
3286 n = ((num_online_cpus() / net_dma_count)
3287 + (i < (num_online_cpus() % net_dma_count) ? 1 : 0));
3288
3289 while(n) {
3290 per_cpu(softnet_data.net_dma, cpu) = chan;
3291 cpu = next_cpu(cpu, cpu_online_map);
3292 n--;
3293 }
3294 i++;
3295 }
3296 rcu_read_unlock();
3297
3298 unlock_cpu_hotplug();
3299}
3300
3301/**
3302 * netdev_dma_event - event callback for the net_dma_client
3303 * @client: should always be net_dma_client
3304 * @chan:
3305 * @event:
3306 */
3307static void netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
3308 enum dma_event event)
3309{
3310 spin_lock(&net_dma_event_lock);
3311 switch (event) {
3312 case DMA_RESOURCE_ADDED:
3313 net_dma_count++;
3314 net_dma_rebalance();
3315 break;
3316 case DMA_RESOURCE_REMOVED:
3317 net_dma_count--;
3318 net_dma_rebalance();
3319 break;
3320 default:
3321 break;
3322 }
3323 spin_unlock(&net_dma_event_lock);
3324}
3325
3326/**
3327 * netdev_dma_regiser - register the networking subsystem as a DMA client
3328 */
3329static int __init netdev_dma_register(void)
3330{
3331 spin_lock_init(&net_dma_event_lock);
3332 net_dma_client = dma_async_client_register(netdev_dma_event);
3333 if (net_dma_client == NULL)
3334 return -ENOMEM;
3335
3336 dma_async_client_chan_request(net_dma_client, num_online_cpus());
3337 return 0;
3338}
3339
3340#else
3341static int __init netdev_dma_register(void) { return -ENODEV; }
3342#endif /* CONFIG_NET_DMA */
3303 3343
3304/* 3344/*
3305 * Initialize the DEV module. At boot time this walks the device list and 3345 * Initialize the DEV module. At boot time this walks the device list and
@@ -3353,6 +3393,8 @@ static int __init net_dev_init(void)
3353 atomic_set(&queue->backlog_dev.refcnt, 1); 3393 atomic_set(&queue->backlog_dev.refcnt, 1);
3354 } 3394 }
3355 3395
3396 netdev_dma_register();
3397
3356 dev_boot_phase = 0; 3398 dev_boot_phase = 0;
3357 3399
3358 open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL); 3400 open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
@@ -3371,7 +3413,6 @@ subsys_initcall(net_dev_init);
3371EXPORT_SYMBOL(__dev_get_by_index); 3413EXPORT_SYMBOL(__dev_get_by_index);
3372EXPORT_SYMBOL(__dev_get_by_name); 3414EXPORT_SYMBOL(__dev_get_by_name);
3373EXPORT_SYMBOL(__dev_remove_pack); 3415EXPORT_SYMBOL(__dev_remove_pack);
3374EXPORT_SYMBOL(__skb_linearize);
3375EXPORT_SYMBOL(dev_valid_name); 3416EXPORT_SYMBOL(dev_valid_name);
3376EXPORT_SYMBOL(dev_add_pack); 3417EXPORT_SYMBOL(dev_add_pack);
3377EXPORT_SYMBOL(dev_alloc_name); 3418EXPORT_SYMBOL(dev_alloc_name);
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 05d60850840e..c57d887da2ef 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -62,7 +62,7 @@
62 * Device mc lists are changed by bh at least if IPv6 is enabled, 62 * Device mc lists are changed by bh at least if IPv6 is enabled,
63 * so that it must be bh protected. 63 * so that it must be bh protected.
64 * 64 *
65 * We block accesses to device mc filters with dev->xmit_lock. 65 * We block accesses to device mc filters with netif_tx_lock.
66 */ 66 */
67 67
68/* 68/*
@@ -93,9 +93,9 @@ static void __dev_mc_upload(struct net_device *dev)
93 93
94void dev_mc_upload(struct net_device *dev) 94void dev_mc_upload(struct net_device *dev)
95{ 95{
96 spin_lock_bh(&dev->xmit_lock); 96 netif_tx_lock_bh(dev);
97 __dev_mc_upload(dev); 97 __dev_mc_upload(dev);
98 spin_unlock_bh(&dev->xmit_lock); 98 netif_tx_unlock_bh(dev);
99} 99}
100 100
101/* 101/*
@@ -107,7 +107,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
107 int err = 0; 107 int err = 0;
108 struct dev_mc_list *dmi, **dmip; 108 struct dev_mc_list *dmi, **dmip;
109 109
110 spin_lock_bh(&dev->xmit_lock); 110 netif_tx_lock_bh(dev);
111 111
112 for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; dmip = &dmi->next) { 112 for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; dmip = &dmi->next) {
113 /* 113 /*
@@ -139,13 +139,13 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
139 */ 139 */
140 __dev_mc_upload(dev); 140 __dev_mc_upload(dev);
141 141
142 spin_unlock_bh(&dev->xmit_lock); 142 netif_tx_unlock_bh(dev);
143 return 0; 143 return 0;
144 } 144 }
145 } 145 }
146 err = -ENOENT; 146 err = -ENOENT;
147done: 147done:
148 spin_unlock_bh(&dev->xmit_lock); 148 netif_tx_unlock_bh(dev);
149 return err; 149 return err;
150} 150}
151 151
@@ -160,7 +160,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
160 160
161 dmi1 = kmalloc(sizeof(*dmi), GFP_ATOMIC); 161 dmi1 = kmalloc(sizeof(*dmi), GFP_ATOMIC);
162 162
163 spin_lock_bh(&dev->xmit_lock); 163 netif_tx_lock_bh(dev);
164 for (dmi = dev->mc_list; dmi != NULL; dmi = dmi->next) { 164 for (dmi = dev->mc_list; dmi != NULL; dmi = dmi->next) {
165 if (memcmp(dmi->dmi_addr, addr, dmi->dmi_addrlen) == 0 && 165 if (memcmp(dmi->dmi_addr, addr, dmi->dmi_addrlen) == 0 &&
166 dmi->dmi_addrlen == alen) { 166 dmi->dmi_addrlen == alen) {
@@ -176,7 +176,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
176 } 176 }
177 177
178 if ((dmi = dmi1) == NULL) { 178 if ((dmi = dmi1) == NULL) {
179 spin_unlock_bh(&dev->xmit_lock); 179 netif_tx_unlock_bh(dev);
180 return -ENOMEM; 180 return -ENOMEM;
181 } 181 }
182 memcpy(dmi->dmi_addr, addr, alen); 182 memcpy(dmi->dmi_addr, addr, alen);
@@ -189,11 +189,11 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
189 189
190 __dev_mc_upload(dev); 190 __dev_mc_upload(dev);
191 191
192 spin_unlock_bh(&dev->xmit_lock); 192 netif_tx_unlock_bh(dev);
193 return 0; 193 return 0;
194 194
195done: 195done:
196 spin_unlock_bh(&dev->xmit_lock); 196 netif_tx_unlock_bh(dev);
197 kfree(dmi1); 197 kfree(dmi1);
198 return err; 198 return err;
199} 199}
@@ -204,7 +204,7 @@ done:
204 204
205void dev_mc_discard(struct net_device *dev) 205void dev_mc_discard(struct net_device *dev)
206{ 206{
207 spin_lock_bh(&dev->xmit_lock); 207 netif_tx_lock_bh(dev);
208 208
209 while (dev->mc_list != NULL) { 209 while (dev->mc_list != NULL) {
210 struct dev_mc_list *tmp = dev->mc_list; 210 struct dev_mc_list *tmp = dev->mc_list;
@@ -215,7 +215,7 @@ void dev_mc_discard(struct net_device *dev)
215 } 215 }
216 dev->mc_count = 0; 216 dev->mc_count = 0;
217 217
218 spin_unlock_bh(&dev->xmit_lock); 218 netif_tx_unlock_bh(dev);
219} 219}
220 220
221#ifdef CONFIG_PROC_FS 221#ifdef CONFIG_PROC_FS
@@ -250,7 +250,7 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v)
250 struct dev_mc_list *m; 250 struct dev_mc_list *m;
251 struct net_device *dev = v; 251 struct net_device *dev = v;
252 252
253 spin_lock_bh(&dev->xmit_lock); 253 netif_tx_lock_bh(dev);
254 for (m = dev->mc_list; m; m = m->next) { 254 for (m = dev->mc_list; m; m = m->next) {
255 int i; 255 int i;
256 256
@@ -262,7 +262,7 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v)
262 262
263 seq_putc(seq, '\n'); 263 seq_putc(seq, '\n');
264 } 264 }
265 spin_unlock_bh(&dev->xmit_lock); 265 netif_tx_unlock_bh(dev);
266 return 0; 266 return 0;
267} 267}
268 268
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index e6f76106a99b..33ce7ed6afc6 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -30,7 +30,7 @@ u32 ethtool_op_get_link(struct net_device *dev)
30 30
31u32 ethtool_op_get_tx_csum(struct net_device *dev) 31u32 ethtool_op_get_tx_csum(struct net_device *dev)
32{ 32{
33 return (dev->features & (NETIF_F_IP_CSUM | NETIF_F_HW_CSUM)) != 0; 33 return (dev->features & NETIF_F_ALL_CSUM) != 0;
34} 34}
35 35
36int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) 36int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
@@ -551,9 +551,7 @@ static int ethtool_set_sg(struct net_device *dev, char __user *useraddr)
551 return -EFAULT; 551 return -EFAULT;
552 552
553 if (edata.data && 553 if (edata.data &&
554 !(dev->features & (NETIF_F_IP_CSUM | 554 !(dev->features & NETIF_F_ALL_CSUM))
555 NETIF_F_NO_CSUM |
556 NETIF_F_HW_CSUM)))
557 return -EINVAL; 555 return -EINVAL;
558 556
559 return __ethtool_set_sg(dev, edata.data); 557 return __ethtool_set_sg(dev, edata.data);
@@ -591,7 +589,7 @@ static int ethtool_set_tso(struct net_device *dev, char __user *useraddr)
591 589
592static int ethtool_get_ufo(struct net_device *dev, char __user *useraddr) 590static int ethtool_get_ufo(struct net_device *dev, char __user *useraddr)
593{ 591{
594 struct ethtool_value edata = { ETHTOOL_GTSO }; 592 struct ethtool_value edata = { ETHTOOL_GUFO };
595 593
596 if (!dev->ethtool_ops->get_ufo) 594 if (!dev->ethtool_ops->get_ufo)
597 return -EOPNOTSUPP; 595 return -EOPNOTSUPP;
@@ -600,6 +598,7 @@ static int ethtool_get_ufo(struct net_device *dev, char __user *useraddr)
600 return -EFAULT; 598 return -EFAULT;
601 return 0; 599 return 0;
602} 600}
601
603static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr) 602static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr)
604{ 603{
605 struct ethtool_value edata; 604 struct ethtool_value edata;
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index e8e05cebd95a..9cb781830380 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -273,24 +273,21 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
273 273
274 do { 274 do {
275 npinfo->tries--; 275 npinfo->tries--;
276 spin_lock(&np->dev->xmit_lock); 276 netif_tx_lock(np->dev);
277 np->dev->xmit_lock_owner = smp_processor_id();
278 277
279 /* 278 /*
280 * network drivers do not expect to be called if the queue is 279 * network drivers do not expect to be called if the queue is
281 * stopped. 280 * stopped.
282 */ 281 */
283 if (netif_queue_stopped(np->dev)) { 282 if (netif_queue_stopped(np->dev)) {
284 np->dev->xmit_lock_owner = -1; 283 netif_tx_unlock(np->dev);
285 spin_unlock(&np->dev->xmit_lock);
286 netpoll_poll(np); 284 netpoll_poll(np);
287 udelay(50); 285 udelay(50);
288 continue; 286 continue;
289 } 287 }
290 288
291 status = np->dev->hard_start_xmit(skb, np->dev); 289 status = np->dev->hard_start_xmit(skb, np->dev);
292 np->dev->xmit_lock_owner = -1; 290 netif_tx_unlock(np->dev);
293 spin_unlock(&np->dev->xmit_lock);
294 291
295 /* success */ 292 /* success */
296 if(!status) { 293 if(!status) {
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index c23e9c06ee23..67ed14ddabd2 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2897,7 +2897,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
2897 } 2897 }
2898 } 2898 }
2899 2899
2900 spin_lock_bh(&odev->xmit_lock); 2900 netif_tx_lock_bh(odev);
2901 if (!netif_queue_stopped(odev)) { 2901 if (!netif_queue_stopped(odev)) {
2902 2902
2903 atomic_inc(&(pkt_dev->skb->users)); 2903 atomic_inc(&(pkt_dev->skb->users));
@@ -2942,7 +2942,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
2942 pkt_dev->next_tx_ns = 0; 2942 pkt_dev->next_tx_ns = 0;
2943 } 2943 }
2944 2944
2945 spin_unlock_bh(&odev->xmit_lock); 2945 netif_tx_unlock_bh(odev);
2946 2946
2947 /* If pkt_dev->count is zero, then run forever */ 2947 /* If pkt_dev->count is zero, then run forever */
2948 if ((pkt_dev->count != 0) && (pkt_dev->sofar >= pkt_dev->count)) { 2948 if ((pkt_dev->count != 0) && (pkt_dev->sofar >= pkt_dev->count)) {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index fb3770f9c094..bb7210f4005e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -464,7 +464,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
464 n->tc_verd = CLR_TC_MUNGED(n->tc_verd); 464 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
465 C(input_dev); 465 C(input_dev);
466#endif 466#endif
467 467 skb_copy_secmark(n, skb);
468#endif 468#endif
469 C(truesize); 469 C(truesize);
470 atomic_set(&n->users, 1); 470 atomic_set(&n->users, 1);
@@ -526,6 +526,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
526#endif 526#endif
527 new->tc_index = old->tc_index; 527 new->tc_index = old->tc_index;
528#endif 528#endif
529 skb_copy_secmark(new, old);
529 atomic_set(&new->users, 1); 530 atomic_set(&new->users, 1);
530 skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size; 531 skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size;
531 skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs; 532 skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs;
@@ -800,12 +801,10 @@ struct sk_buff *skb_pad(struct sk_buff *skb, int pad)
800 return nskb; 801 return nskb;
801} 802}
802 803
803/* Trims skb to length len. It can change skb pointers, if "realloc" is 1. 804/* Trims skb to length len. It can change skb pointers.
804 * If realloc==0 and trimming is impossible without change of data,
805 * it is BUG().
806 */ 805 */
807 806
808int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc) 807int ___pskb_trim(struct sk_buff *skb, unsigned int len)
809{ 808{
810 int offset = skb_headlen(skb); 809 int offset = skb_headlen(skb);
811 int nfrags = skb_shinfo(skb)->nr_frags; 810 int nfrags = skb_shinfo(skb)->nr_frags;
@@ -815,7 +814,6 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc)
815 int end = offset + skb_shinfo(skb)->frags[i].size; 814 int end = offset + skb_shinfo(skb)->frags[i].size;
816 if (end > len) { 815 if (end > len) {
817 if (skb_cloned(skb)) { 816 if (skb_cloned(skb)) {
818 BUG_ON(!realloc);
819 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) 817 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
820 return -ENOMEM; 818 return -ENOMEM;
821 } 819 }
diff --git a/net/core/sock.c b/net/core/sock.c
index ed2afdb9ea2d..5d820c376653 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -832,6 +832,9 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
832 atomic_set(&newsk->sk_omem_alloc, 0); 832 atomic_set(&newsk->sk_omem_alloc, 0);
833 skb_queue_head_init(&newsk->sk_receive_queue); 833 skb_queue_head_init(&newsk->sk_receive_queue);
834 skb_queue_head_init(&newsk->sk_write_queue); 834 skb_queue_head_init(&newsk->sk_write_queue);
835#ifdef CONFIG_NET_DMA
836 skb_queue_head_init(&newsk->sk_async_wait_queue);
837#endif
835 838
836 rwlock_init(&newsk->sk_dst_lock); 839 rwlock_init(&newsk->sk_dst_lock);
837 rwlock_init(&newsk->sk_callback_lock); 840 rwlock_init(&newsk->sk_callback_lock);
@@ -1383,6 +1386,9 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1383 skb_queue_head_init(&sk->sk_receive_queue); 1386 skb_queue_head_init(&sk->sk_receive_queue);
1384 skb_queue_head_init(&sk->sk_write_queue); 1387 skb_queue_head_init(&sk->sk_write_queue);
1385 skb_queue_head_init(&sk->sk_error_queue); 1388 skb_queue_head_init(&sk->sk_error_queue);
1389#ifdef CONFIG_NET_DMA
1390 skb_queue_head_init(&sk->sk_async_wait_queue);
1391#endif
1386 1392
1387 sk->sk_send_head = NULL; 1393 sk->sk_send_head = NULL;
1388 1394
diff --git a/net/core/user_dma.c b/net/core/user_dma.c
new file mode 100644
index 000000000000..b7c98dbcdb81
--- /dev/null
+++ b/net/core/user_dma.c
@@ -0,0 +1,131 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 * Portions based on net/core/datagram.c and copyrighted by their authors.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59
17 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 * The full GNU General Public License is included in this distribution in the
20 * file called COPYING.
21 */
22
23/*
24 * This code allows the net stack to make use of a DMA engine for
25 * skb to iovec copies.
26 */
27
28#include <linux/dmaengine.h>
29#include <linux/socket.h>
30#include <linux/rtnetlink.h> /* for BUG_TRAP */
31#include <net/tcp.h>
32
33#define NET_DMA_DEFAULT_COPYBREAK 4096
34
35int sysctl_tcp_dma_copybreak = NET_DMA_DEFAULT_COPYBREAK;
36
37/**
38 * dma_skb_copy_datagram_iovec - Copy a datagram to an iovec.
39 * @skb - buffer to copy
40 * @offset - offset in the buffer to start copying from
41 * @iovec - io vector to copy to
42 * @len - amount of data to copy from buffer to iovec
43 * @pinned_list - locked iovec buffer data
44 *
45 * Note: the iovec is modified during the copy.
46 */
47int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
48 struct sk_buff *skb, int offset, struct iovec *to,
49 size_t len, struct dma_pinned_list *pinned_list)
50{
51 int start = skb_headlen(skb);
52 int i, copy = start - offset;
53 dma_cookie_t cookie = 0;
54
55 /* Copy header. */
56 if (copy > 0) {
57 if (copy > len)
58 copy = len;
59 cookie = dma_memcpy_to_iovec(chan, to, pinned_list,
60 skb->data + offset, copy);
61 if (cookie < 0)
62 goto fault;
63 len -= copy;
64 if (len == 0)
65 goto end;
66 offset += copy;
67 }
68
69 /* Copy paged appendix. Hmm... why does this look so complicated? */
70 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
71 int end;
72
73 BUG_TRAP(start <= offset + len);
74
75 end = start + skb_shinfo(skb)->frags[i].size;
76 copy = end - offset;
77 if ((copy = end - offset) > 0) {
78 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
79 struct page *page = frag->page;
80
81 if (copy > len)
82 copy = len;
83
84 cookie = dma_memcpy_pg_to_iovec(chan, to, pinned_list, page,
85 frag->page_offset + offset - start, copy);
86 if (cookie < 0)
87 goto fault;
88 len -= copy;
89 if (len == 0)
90 goto end;
91 offset += copy;
92 }
93 start = end;
94 }
95
96 if (skb_shinfo(skb)->frag_list) {
97 struct sk_buff *list = skb_shinfo(skb)->frag_list;
98
99 for (; list; list = list->next) {
100 int end;
101
102 BUG_TRAP(start <= offset + len);
103
104 end = start + list->len;
105 copy = end - offset;
106 if (copy > 0) {
107 if (copy > len)
108 copy = len;
109 cookie = dma_skb_copy_datagram_iovec(chan, list,
110 offset - start, to, copy,
111 pinned_list);
112 if (cookie < 0)
113 goto fault;
114 len -= copy;
115 if (len == 0)
116 goto end;
117 offset += copy;
118 }
119 start = end;
120 }
121 }
122
123end:
124 if (!len) {
125 skb->dma_cookie = cookie;
126 return cookie;
127 }
128
129fault:
130 return -EFAULT;
131}
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index b5981e5f6b00..8c211c58893b 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -452,6 +452,7 @@ found:
452 (unsigned long long) 452 (unsigned long long)
453 avr->dccpavr_ack_ackno); 453 avr->dccpavr_ack_ackno);
454 dccp_ackvec_throw_record(av, avr); 454 dccp_ackvec_throw_record(av, avr);
455 break;
455 } 456 }
456 /* 457 /*
457 * If it wasn't received, continue scanning... we might 458 * If it wasn't received, continue scanning... we might
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 2e0ee8355c41..5317fd3e6691 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -719,7 +719,7 @@ int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
719 } 719 }
720 dccp_pr_debug("packet_type=%s\n", 720 dccp_pr_debug("packet_type=%s\n",
721 dccp_packet_name(dh->dccph_type)); 721 dccp_packet_name(dh->dccph_type));
722 sk_eat_skb(sk, skb); 722 sk_eat_skb(sk, skb, 0);
723verify_sock_status: 723verify_sock_status:
724 if (sock_flag(sk, SOCK_DONE)) { 724 if (sock_flag(sk, SOCK_DONE)) {
725 len = 0; 725 len = 0;
@@ -773,7 +773,7 @@ verify_sock_status:
773 } 773 }
774 found_fin_ok: 774 found_fin_ok:
775 if (!(flags & MSG_PEEK)) 775 if (!(flags & MSG_PEEK))
776 sk_eat_skb(sk, skb); 776 sk_eat_skb(sk, skb, 0);
777 break; 777 break;
778 } while (1); 778 } while (1);
779out: 779out:
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
index 547523b41c81..a2ba9db1c376 100644
--- a/net/decnet/dn_nsp_in.c
+++ b/net/decnet/dn_nsp_in.c
@@ -801,8 +801,7 @@ got_it:
801 * We linearize everything except data segments here. 801 * We linearize everything except data segments here.
802 */ 802 */
803 if (cb->nsp_flags & ~0x60) { 803 if (cb->nsp_flags & ~0x60) {
804 if (unlikely(skb_is_nonlinear(skb)) && 804 if (unlikely(skb_linearize(skb)))
805 skb_linearize(skb, GFP_ATOMIC) != 0)
806 goto free_out; 805 goto free_out;
807 } 806 }
808 807
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index e172cf98d7fc..5abf7057af00 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -629,8 +629,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
629 padlen); 629 padlen);
630 630
631 if (flags & DN_RT_PKT_CNTL) { 631 if (flags & DN_RT_PKT_CNTL) {
632 if (unlikely(skb_is_nonlinear(skb)) && 632 if (unlikely(skb_linearize(skb)))
633 skb_linearize(skb, GFP_ATOMIC) != 0)
634 goto dump_it; 633 goto dump_it;
635 634
636 switch(flags & DN_RT_CNTL_MSK) { 635 switch(flags & DN_RT_CNTL_MSK) {
diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c
index 22aa6199185b..0e65ff4e33fc 100644
--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -388,7 +388,7 @@ ieee80211softmac_wx_set_genie(struct net_device *dev,
388 memcpy(mac->wpa.IE, extra, wrqu->data.length); 388 memcpy(mac->wpa.IE, extra, wrqu->data.length);
389 dprintk(KERN_INFO PFX "generic IE set to "); 389 dprintk(KERN_INFO PFX "generic IE set to ");
390 for (i=0;i<wrqu->data.length;i++) 390 for (i=0;i<wrqu->data.length;i++)
391 dprintk("%.2x", mac->wpa.IE[i]); 391 dprintk("%.2x", (u8)mac->wpa.IE[i]);
392 dprintk("\n"); 392 dprintk("\n");
393 mac->wpa.IElen = wrqu->data.length; 393 mac->wpa.IElen = wrqu->data.length;
394 } else { 394 } else {
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index e40f75322377..da33393be45f 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -414,6 +414,24 @@ config INET_TUNNEL
414 tristate 414 tristate
415 default n 415 default n
416 416
417config INET_XFRM_MODE_TRANSPORT
418 tristate "IP: IPsec transport mode"
419 default y
420 select XFRM
421 ---help---
422 Support for IPsec transport mode.
423
424 If unsure, say Y.
425
426config INET_XFRM_MODE_TUNNEL
427 tristate "IP: IPsec tunnel mode"
428 default y
429 select XFRM
430 ---help---
431 Support for IPsec tunnel mode.
432
433 If unsure, say Y.
434
417config INET_DIAG 435config INET_DIAG
418 tristate "INET: socket monitoring interface" 436 tristate "INET: socket monitoring interface"
419 default y 437 default y
@@ -532,6 +550,38 @@ config TCP_CONG_SCALABLE
532 properties, though is known to have fairness issues. 550 properties, though is known to have fairness issues.
533 See http://www-lce.eng.cam.ac.uk/~ctk21/scalable/ 551 See http://www-lce.eng.cam.ac.uk/~ctk21/scalable/
534 552
553config TCP_CONG_LP
554 tristate "TCP Low Priority"
555 depends on EXPERIMENTAL
556 default n
557 ---help---
558 TCP Low Priority (TCP-LP), a distributed algorithm whose goal is
559 to utiliza only the excess network bandwidth as compared to the
560 ``fair share`` of bandwidth as targeted by TCP.
561 See http://www-ece.rice.edu/networks/TCP-LP/
562
563config TCP_CONG_VENO
564 tristate "TCP Veno"
565 depends on EXPERIMENTAL
566 default n
567 ---help---
568 TCP Veno is a sender-side only enhancement of TCP to obtain better
569 throughput over wireless networks. TCP Veno makes use of state
570 distinguishing to circumvent the difficult judgment of the packet loss
571 type. TCP Veno cuts down less congestion window in response to random
572 loss packets.
573 See http://www.ntu.edu.sg/home5/ZHOU0022/papers/CPFu03a.pdf
574
575config TCP_CONG_COMPOUND
576 tristate "TCP Compound"
577 depends on EXPERIMENTAL
578 default n
579 ---help---
580 TCP Compound is a sender-side only change to TCP that uses
581 a mixed Reno/Vegas approach to calculate the cwnd.
582 For further details look here:
583 ftp://ftp.research.microsoft.com/pub/tr/TR-2005-86.pdf
584
535endmenu 585endmenu
536 586
537config TCP_CONG_BIC 587config TCP_CONG_BIC
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index 9ef50a0b9d2c..38b8039bdd55 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -24,6 +24,8 @@ obj-$(CONFIG_INET_ESP) += esp4.o
24obj-$(CONFIG_INET_IPCOMP) += ipcomp.o 24obj-$(CONFIG_INET_IPCOMP) += ipcomp.o
25obj-$(CONFIG_INET_XFRM_TUNNEL) += xfrm4_tunnel.o 25obj-$(CONFIG_INET_XFRM_TUNNEL) += xfrm4_tunnel.o
26obj-$(CONFIG_INET_TUNNEL) += tunnel4.o 26obj-$(CONFIG_INET_TUNNEL) += tunnel4.o
27obj-$(CONFIG_INET_XFRM_MODE_TRANSPORT) += xfrm4_mode_transport.o
28obj-$(CONFIG_INET_XFRM_MODE_TUNNEL) += xfrm4_mode_tunnel.o
27obj-$(CONFIG_IP_PNP) += ipconfig.o 29obj-$(CONFIG_IP_PNP) += ipconfig.o
28obj-$(CONFIG_IP_ROUTE_MULTIPATH_RR) += multipath_rr.o 30obj-$(CONFIG_IP_ROUTE_MULTIPATH_RR) += multipath_rr.o
29obj-$(CONFIG_IP_ROUTE_MULTIPATH_RANDOM) += multipath_random.o 31obj-$(CONFIG_IP_ROUTE_MULTIPATH_RANDOM) += multipath_random.o
@@ -34,6 +36,7 @@ obj-$(CONFIG_IP_VS) += ipvs/
34obj-$(CONFIG_INET_DIAG) += inet_diag.o 36obj-$(CONFIG_INET_DIAG) += inet_diag.o
35obj-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o 37obj-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o
36obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o 38obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o
39obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o
37obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o 40obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o
38obj-$(CONFIG_TCP_CONG_CUBIC) += tcp_cubic.o 41obj-$(CONFIG_TCP_CONG_CUBIC) += tcp_cubic.o
39obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o 42obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o
@@ -41,7 +44,10 @@ obj-$(CONFIG_TCP_CONG_HSTCP) += tcp_highspeed.o
41obj-$(CONFIG_TCP_CONG_HYBLA) += tcp_hybla.o 44obj-$(CONFIG_TCP_CONG_HYBLA) += tcp_hybla.o
42obj-$(CONFIG_TCP_CONG_HTCP) += tcp_htcp.o 45obj-$(CONFIG_TCP_CONG_HTCP) += tcp_htcp.o
43obj-$(CONFIG_TCP_CONG_VEGAS) += tcp_vegas.o 46obj-$(CONFIG_TCP_CONG_VEGAS) += tcp_vegas.o
47obj-$(CONFIG_TCP_CONG_VENO) += tcp_veno.o
44obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o 48obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o
49obj-$(CONFIG_TCP_CONG_LP) += tcp_lp.o
50obj-$(CONFIG_TCP_CONG_COMPOUND) += tcp_compound.o
45 51
46obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \ 52obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
47 xfrm4_output.o 53 xfrm4_output.o
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index e2e4771fa4c6..c7782230080d 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -119,6 +119,7 @@ error:
119static int ah_input(struct xfrm_state *x, struct sk_buff *skb) 119static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
120{ 120{
121 int ah_hlen; 121 int ah_hlen;
122 int ihl;
122 struct iphdr *iph; 123 struct iphdr *iph;
123 struct ip_auth_hdr *ah; 124 struct ip_auth_hdr *ah;
124 struct ah_data *ahp; 125 struct ah_data *ahp;
@@ -149,13 +150,14 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
149 ah = (struct ip_auth_hdr*)skb->data; 150 ah = (struct ip_auth_hdr*)skb->data;
150 iph = skb->nh.iph; 151 iph = skb->nh.iph;
151 152
152 memcpy(work_buf, iph, iph->ihl*4); 153 ihl = skb->data - skb->nh.raw;
154 memcpy(work_buf, iph, ihl);
153 155
154 iph->ttl = 0; 156 iph->ttl = 0;
155 iph->tos = 0; 157 iph->tos = 0;
156 iph->frag_off = 0; 158 iph->frag_off = 0;
157 iph->check = 0; 159 iph->check = 0;
158 if (iph->ihl != 5) { 160 if (ihl > sizeof(*iph)) {
159 u32 dummy; 161 u32 dummy;
160 if (ip_clear_mutable_options(iph, &dummy)) 162 if (ip_clear_mutable_options(iph, &dummy))
161 goto out; 163 goto out;
@@ -164,7 +166,7 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
164 u8 auth_data[MAX_AH_AUTH_LEN]; 166 u8 auth_data[MAX_AH_AUTH_LEN];
165 167
166 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); 168 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len);
167 skb_push(skb, skb->data - skb->nh.raw); 169 skb_push(skb, ihl);
168 ahp->icv(ahp, skb, ah->auth_data); 170 ahp->icv(ahp, skb, ah->auth_data);
169 if (memcmp(ah->auth_data, auth_data, ahp->icv_trunc_len)) { 171 if (memcmp(ah->auth_data, auth_data, ahp->icv_trunc_len)) {
170 x->stats.integrity_failed++; 172 x->stats.integrity_failed++;
@@ -172,11 +174,8 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
172 } 174 }
173 } 175 }
174 ((struct iphdr*)work_buf)->protocol = ah->nexthdr; 176 ((struct iphdr*)work_buf)->protocol = ah->nexthdr;
175 skb->nh.raw = skb_pull(skb, ah_hlen); 177 skb->h.raw = memcpy(skb->nh.raw += ah_hlen, work_buf, ihl);
176 memcpy(skb->nh.raw, work_buf, iph->ihl*4); 178 __skb_pull(skb, ah_hlen + ihl);
177 skb->nh.iph->tot_len = htons(skb->len);
178 skb_pull(skb, skb->nh.iph->ihl*4);
179 skb->h.raw = skb->data;
180 179
181 return 0; 180 return 0;
182 181
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 9d1881c07a32..9bbdd4494551 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -143,10 +143,9 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
143 int alen = esp->auth.icv_trunc_len; 143 int alen = esp->auth.icv_trunc_len;
144 int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen; 144 int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen;
145 int nfrags; 145 int nfrags;
146 int encap_len = 0; 146 int ihl;
147 u8 nexthdr[2]; 147 u8 nexthdr[2];
148 struct scatterlist *sg; 148 struct scatterlist *sg;
149 u8 workbuf[60];
150 int padlen; 149 int padlen;
151 150
152 if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr))) 151 if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr)))
@@ -177,7 +176,6 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
177 skb->ip_summed = CHECKSUM_NONE; 176 skb->ip_summed = CHECKSUM_NONE;
178 177
179 esph = (struct ip_esp_hdr*)skb->data; 178 esph = (struct ip_esp_hdr*)skb->data;
180 iph = skb->nh.iph;
181 179
182 /* Get ivec. This can be wrong, check against another impls. */ 180 /* Get ivec. This can be wrong, check against another impls. */
183 if (esp->conf.ivlen) 181 if (esp->conf.ivlen)
@@ -204,12 +202,12 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
204 202
205 /* ... check padding bits here. Silly. :-) */ 203 /* ... check padding bits here. Silly. :-) */
206 204
205 iph = skb->nh.iph;
206 ihl = iph->ihl * 4;
207
207 if (x->encap) { 208 if (x->encap) {
208 struct xfrm_encap_tmpl *encap = x->encap; 209 struct xfrm_encap_tmpl *encap = x->encap;
209 struct udphdr *uh; 210 struct udphdr *uh = (void *)(skb->nh.raw + ihl);
210
211 uh = (struct udphdr *)(iph + 1);
212 encap_len = (void*)esph - (void*)uh;
213 211
214 /* 212 /*
215 * 1) if the NAT-T peer's IP or port changed then 213 * 1) if the NAT-T peer's IP or port changed then
@@ -246,11 +244,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
246 244
247 iph->protocol = nexthdr[1]; 245 iph->protocol = nexthdr[1];
248 pskb_trim(skb, skb->len - alen - padlen - 2); 246 pskb_trim(skb, skb->len - alen - padlen - 2);
249 memcpy(workbuf, skb->nh.raw, iph->ihl*4); 247 skb->h.raw = __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen) - ihl;
250 skb->h.raw = skb_pull(skb, sizeof(struct ip_esp_hdr) + esp->conf.ivlen);
251 skb->nh.raw += encap_len + sizeof(struct ip_esp_hdr) + esp->conf.ivlen;
252 memcpy(skb->nh.raw, workbuf, iph->ihl*4);
253 skb->nh.iph->tot_len = htons(skb->len);
254 248
255 return 0; 249 return 0;
256 250
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index cdde96390960..31387abf53a2 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -666,3 +666,4 @@ void __init ip_fib_init(void)
666} 666}
667 667
668EXPORT_SYMBOL(inet_addr_type); 668EXPORT_SYMBOL(inet_addr_type);
669EXPORT_SYMBOL(ip_dev_find);
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 2a0455911ee0..017900172f7d 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -730,7 +730,6 @@ out_err:
730static void icmp_redirect(struct sk_buff *skb) 730static void icmp_redirect(struct sk_buff *skb)
731{ 731{
732 struct iphdr *iph; 732 struct iphdr *iph;
733 unsigned long ip;
734 733
735 if (skb->len < sizeof(struct iphdr)) 734 if (skb->len < sizeof(struct iphdr))
736 goto out_err; 735 goto out_err;
@@ -742,7 +741,6 @@ static void icmp_redirect(struct sk_buff *skb)
742 goto out; 741 goto out;
743 742
744 iph = (struct iphdr *)skb->data; 743 iph = (struct iphdr *)skb->data;
745 ip = iph->daddr;
746 744
747 switch (skb->h.icmph->code & 7) { 745 switch (skb->h.icmph->code & 7) {
748 case ICMP_REDIR_NET: 746 case ICMP_REDIR_NET:
@@ -752,7 +750,8 @@ static void icmp_redirect(struct sk_buff *skb)
752 */ 750 */
753 case ICMP_REDIR_HOST: 751 case ICMP_REDIR_HOST:
754 case ICMP_REDIR_HOSTTOS: 752 case ICMP_REDIR_HOSTTOS:
755 ip_rt_redirect(skb->nh.iph->saddr, ip, skb->h.icmph->un.gateway, 753 ip_rt_redirect(skb->nh.iph->saddr, iph->daddr,
754 skb->h.icmph->un.gateway,
756 iph->saddr, skb->dev); 755 iph->saddr, skb->dev);
757 break; 756 break;
758 } 757 }
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index d512239a1473..ab680c851aa2 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2361,7 +2361,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v)
2361 } 2361 }
2362 2362
2363 seq_printf(seq, 2363 seq_printf(seq,
2364 "\t\t\t\t%08lX %5d %d:%08lX\t\t%d\n", 2364 "\t\t\t\t%08X %5d %d:%08lX\t\t%d\n",
2365 im->multiaddr, im->users, 2365 im->multiaddr, im->users,
2366 im->tm_running, im->tm_running ? 2366 im->tm_running, im->tm_running ?
2367 jiffies_to_clock_t(im->timer.expires-jiffies) : 0, 2367 jiffies_to_clock_t(im->timer.expires-jiffies) : 0,
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 0923add122b4..9f0bb529ab70 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -116,6 +116,7 @@ sr_failed:
116 116
117too_many_hops: 117too_many_hops:
118 /* Tell the sender its packet died... */ 118 /* Tell the sender its packet died... */
119 IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
119 icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); 120 icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);
120drop: 121drop:
121 kfree_skb(skb); 122 kfree_skb(skb);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index cff9c3a72daf..8538aac3d148 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -410,6 +410,7 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
410 nf_bridge_get(to->nf_bridge); 410 nf_bridge_get(to->nf_bridge);
411#endif 411#endif
412#endif 412#endif
413 skb_copy_secmark(to, from);
413} 414}
414 415
415/* 416/*
@@ -839,7 +840,7 @@ int ip_append_data(struct sock *sk,
839 */ 840 */
840 if (transhdrlen && 841 if (transhdrlen &&
841 length + fragheaderlen <= mtu && 842 length + fragheaderlen <= mtu &&
842 rt->u.dst.dev->features&(NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) && 843 rt->u.dst.dev->features & NETIF_F_ALL_CSUM &&
843 !exthdrlen) 844 !exthdrlen)
844 csummode = CHECKSUM_HW; 845 csummode = CHECKSUM_HW;
845 846
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index 95278b22b669..3ed8b57a1002 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -45,7 +45,6 @@ static LIST_HEAD(ipcomp_tfms_list);
45static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) 45static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb)
46{ 46{
47 int err, plen, dlen; 47 int err, plen, dlen;
48 struct iphdr *iph;
49 struct ipcomp_data *ipcd = x->data; 48 struct ipcomp_data *ipcd = x->data;
50 u8 *start, *scratch; 49 u8 *start, *scratch;
51 struct crypto_tfm *tfm; 50 struct crypto_tfm *tfm;
@@ -74,8 +73,6 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb)
74 73
75 skb_put(skb, dlen - plen); 74 skb_put(skb, dlen - plen);
76 memcpy(skb->data, scratch, dlen); 75 memcpy(skb->data, scratch, dlen);
77 iph = skb->nh.iph;
78 iph->tot_len = htons(dlen + iph->ihl * 4);
79out: 76out:
80 put_cpu(); 77 put_cpu();
81 return err; 78 return err;
@@ -83,34 +80,21 @@ out:
83 80
84static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) 81static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb)
85{ 82{
86 u8 nexthdr; 83 int err = -ENOMEM;
87 int err = 0;
88 struct iphdr *iph; 84 struct iphdr *iph;
89 union { 85 struct ip_comp_hdr *ipch;
90 struct iphdr iph;
91 char buf[60];
92 } tmp_iph;
93
94 86
95 if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && 87 if (skb_linearize_cow(skb))
96 skb_linearize(skb, GFP_ATOMIC) != 0) {
97 err = -ENOMEM;
98 goto out; 88 goto out;
99 }
100 89
101 skb->ip_summed = CHECKSUM_NONE; 90 skb->ip_summed = CHECKSUM_NONE;
102 91
103 /* Remove ipcomp header and decompress original payload */ 92 /* Remove ipcomp header and decompress original payload */
104 iph = skb->nh.iph; 93 iph = skb->nh.iph;
105 memcpy(&tmp_iph, iph, iph->ihl * 4); 94 ipch = (void *)skb->data;
106 nexthdr = *(u8 *)skb->data; 95 iph->protocol = ipch->nexthdr;
107 skb_pull(skb, sizeof(struct ip_comp_hdr)); 96 skb->h.raw = skb->nh.raw + sizeof(*ipch);
108 skb->nh.raw += sizeof(struct ip_comp_hdr); 97 __skb_pull(skb, sizeof(*ipch));
109 memcpy(skb->nh.raw, &tmp_iph, tmp_iph.iph.ihl * 4);
110 iph = skb->nh.iph;
111 iph->tot_len = htons(ntohs(iph->tot_len) - sizeof(struct ip_comp_hdr));
112 iph->protocol = nexthdr;
113 skb->h.raw = skb->data;
114 err = ipcomp_decompress(x, skb); 98 err = ipcomp_decompress(x, skb);
115 99
116out: 100out:
@@ -171,10 +155,8 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb)
171 goto out_ok; 155 goto out_ok;
172 } 156 }
173 157
174 if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && 158 if (skb_linearize_cow(skb))
175 skb_linearize(skb, GFP_ATOMIC) != 0) {
176 goto out_ok; 159 goto out_ok;
177 }
178 160
179 err = ipcomp_compress(x, skb); 161 err = ipcomp_compress(x, skb);
180 iph = skb->nh.iph; 162 iph = skb->nh.iph;
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index d4072533da21..e1d7f5fbc526 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -55,6 +55,18 @@ config IP_NF_CONNTRACK_MARK
55 of packets, but this mark value is kept in the conntrack session 55 of packets, but this mark value is kept in the conntrack session
56 instead of the individual packets. 56 instead of the individual packets.
57 57
58config IP_NF_CONNTRACK_SECMARK
59 bool 'Connection tracking security mark support'
60 depends on IP_NF_CONNTRACK && NETWORK_SECMARK
61 help
62 This option enables security markings to be applied to
63 connections. Typically they are copied to connections from
64 packets using the CONNSECMARK target and copied back from
65 connections to packets with the same target, with the packets
66 being originally labeled via SECMARK.
67
68 If unsure, say 'N'.
69
58config IP_NF_CONNTRACK_EVENTS 70config IP_NF_CONNTRACK_EVENTS
59 bool "Connection tracking events (EXPERIMENTAL)" 71 bool "Connection tracking events (EXPERIMENTAL)"
60 depends on EXPERIMENTAL && IP_NF_CONNTRACK 72 depends on EXPERIMENTAL && IP_NF_CONNTRACK
@@ -142,6 +154,8 @@ config IP_NF_TFTP
142config IP_NF_AMANDA 154config IP_NF_AMANDA
143 tristate "Amanda backup protocol support" 155 tristate "Amanda backup protocol support"
144 depends on IP_NF_CONNTRACK 156 depends on IP_NF_CONNTRACK
157 select TEXTSEARCH
158 select TEXTSEARCH_KMP
145 help 159 help
146 If you are running the Amanda backup package <http://www.amanda.org/> 160 If you are running the Amanda backup package <http://www.amanda.org/>
147 on this machine or machines that will be MASQUERADED through this 161 on this machine or machines that will be MASQUERADED through this
@@ -181,14 +195,26 @@ config IP_NF_H323
181 With this module you can support H.323 on a connection tracking/NAT 195 With this module you can support H.323 on a connection tracking/NAT
182 firewall. 196 firewall.
183 197
184 This module supports RAS, Fast-start, H.245 tunnelling, RTP/RTCP 198 This module supports RAS, Fast Start, H.245 Tunnelling, Call
185 and T.120 based data and applications including audio, video, FAX, 199 Forwarding, RTP/RTCP and T.120 based audio, video, fax, chat,
186 chat, whiteboard, file transfer, etc. For more information, please 200 whiteboard, file transfer, etc. For more information, please
187 see http://nath323.sourceforge.net/. 201 visit http://nath323.sourceforge.net/.
188 202
189 If you want to compile it as a module, say 'M' here and read 203 If you want to compile it as a module, say 'M' here and read
190 Documentation/modules.txt. If unsure, say 'N'. 204 Documentation/modules.txt. If unsure, say 'N'.
191 205
206config IP_NF_SIP
207 tristate "SIP protocol support (EXPERIMENTAL)"
208 depends on IP_NF_CONNTRACK && EXPERIMENTAL
209 help
210 SIP is an application-layer control protocol that can establish,
211 modify, and terminate multimedia sessions (conferences) such as
212 Internet telephony calls. With the ip_conntrack_sip and
213 the ip_nat_sip modules you can support the protocol on a connection
214 tracking/NATing firewall.
215
216 To compile it as a module, choose M here. If unsure, say Y.
217
192config IP_NF_QUEUE 218config IP_NF_QUEUE
193 tristate "IP Userspace queueing via NETLINK (OBSOLETE)" 219 tristate "IP Userspace queueing via NETLINK (OBSOLETE)"
194 help 220 help
@@ -501,6 +527,12 @@ config IP_NF_NAT_H323
501 default IP_NF_NAT if IP_NF_H323=y 527 default IP_NF_NAT if IP_NF_H323=y
502 default m if IP_NF_H323=m 528 default m if IP_NF_H323=m
503 529
530config IP_NF_NAT_SIP
531 tristate
532 depends on IP_NF_IPTABLES!=n && IP_NF_CONNTRACK!=n && IP_NF_NAT!=n
533 default IP_NF_NAT if IP_NF_SIP=y
534 default m if IP_NF_SIP=m
535
504# mangle + specific targets 536# mangle + specific targets
505config IP_NF_MANGLE 537config IP_NF_MANGLE
506 tristate "Packet mangling" 538 tristate "Packet mangling"
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile
index 461cb1eb5de7..3ded4a3af59c 100644
--- a/net/ipv4/netfilter/Makefile
+++ b/net/ipv4/netfilter/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_IP_NF_AMANDA) += ip_conntrack_amanda.o
31obj-$(CONFIG_IP_NF_TFTP) += ip_conntrack_tftp.o 31obj-$(CONFIG_IP_NF_TFTP) += ip_conntrack_tftp.o
32obj-$(CONFIG_IP_NF_FTP) += ip_conntrack_ftp.o 32obj-$(CONFIG_IP_NF_FTP) += ip_conntrack_ftp.o
33obj-$(CONFIG_IP_NF_IRC) += ip_conntrack_irc.o 33obj-$(CONFIG_IP_NF_IRC) += ip_conntrack_irc.o
34obj-$(CONFIG_IP_NF_SIP) += ip_conntrack_sip.o
34obj-$(CONFIG_IP_NF_NETBIOS_NS) += ip_conntrack_netbios_ns.o 35obj-$(CONFIG_IP_NF_NETBIOS_NS) += ip_conntrack_netbios_ns.o
35 36
36# NAT helpers 37# NAT helpers
@@ -40,6 +41,7 @@ obj-$(CONFIG_IP_NF_NAT_AMANDA) += ip_nat_amanda.o
40obj-$(CONFIG_IP_NF_NAT_TFTP) += ip_nat_tftp.o 41obj-$(CONFIG_IP_NF_NAT_TFTP) += ip_nat_tftp.o
41obj-$(CONFIG_IP_NF_NAT_FTP) += ip_nat_ftp.o 42obj-$(CONFIG_IP_NF_NAT_FTP) += ip_nat_ftp.o
42obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o 43obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o
44obj-$(CONFIG_IP_NF_NAT_SIP) += ip_nat_sip.o
43 45
44# generic IP tables 46# generic IP tables
45obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o 47obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c
index a604b1ccfdaa..0a7bd7f04061 100644
--- a/net/ipv4/netfilter/ip_conntrack_amanda.c
+++ b/net/ipv4/netfilter/ip_conntrack_amanda.c
@@ -17,33 +17,29 @@
17 * this value. 17 * this value.
18 * 18 *
19 */ 19 */
20
21#include <linux/in.h>
22#include <linux/kernel.h> 20#include <linux/kernel.h>
23#include <linux/module.h> 21#include <linux/module.h>
24#include <linux/netfilter.h>
25#include <linux/ip.h>
26#include <linux/moduleparam.h> 22#include <linux/moduleparam.h>
23#include <linux/textsearch.h>
24#include <linux/skbuff.h>
25#include <linux/in.h>
26#include <linux/ip.h>
27#include <linux/udp.h> 27#include <linux/udp.h>
28#include <net/checksum.h>
29#include <net/udp.h>
30 28
29#include <linux/netfilter.h>
31#include <linux/netfilter_ipv4/ip_conntrack_helper.h> 30#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
32#include <linux/netfilter_ipv4/ip_conntrack_amanda.h> 31#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
33 32
34static unsigned int master_timeout = 300; 33static unsigned int master_timeout = 300;
34static char *ts_algo = "kmp";
35 35
36MODULE_AUTHOR("Brian J. Murrell <netfilter@interlinx.bc.ca>"); 36MODULE_AUTHOR("Brian J. Murrell <netfilter@interlinx.bc.ca>");
37MODULE_DESCRIPTION("Amanda connection tracking module"); 37MODULE_DESCRIPTION("Amanda connection tracking module");
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39module_param(master_timeout, uint, 0600); 39module_param(master_timeout, uint, 0600);
40MODULE_PARM_DESC(master_timeout, "timeout for the master connection"); 40MODULE_PARM_DESC(master_timeout, "timeout for the master connection");
41 41module_param(ts_algo, charp, 0400);
42static const char *conns[] = { "DATA ", "MESG ", "INDEX " }; 42MODULE_PARM_DESC(ts_algo, "textsearch algorithm to use (default kmp)");
43
44/* This is slow, but it's simple. --RR */
45static char *amanda_buffer;
46static DEFINE_SPINLOCK(amanda_buffer_lock);
47 43
48unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb, 44unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb,
49 enum ip_conntrack_info ctinfo, 45 enum ip_conntrack_info ctinfo,
@@ -52,12 +48,48 @@ unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb,
52 struct ip_conntrack_expect *exp); 48 struct ip_conntrack_expect *exp);
53EXPORT_SYMBOL_GPL(ip_nat_amanda_hook); 49EXPORT_SYMBOL_GPL(ip_nat_amanda_hook);
54 50
51enum amanda_strings {
52 SEARCH_CONNECT,
53 SEARCH_NEWLINE,
54 SEARCH_DATA,
55 SEARCH_MESG,
56 SEARCH_INDEX,
57};
58
59static struct {
60 char *string;
61 size_t len;
62 struct ts_config *ts;
63} search[] = {
64 [SEARCH_CONNECT] = {
65 .string = "CONNECT ",
66 .len = 8,
67 },
68 [SEARCH_NEWLINE] = {
69 .string = "\n",
70 .len = 1,
71 },
72 [SEARCH_DATA] = {
73 .string = "DATA ",
74 .len = 5,
75 },
76 [SEARCH_MESG] = {
77 .string = "MESG ",
78 .len = 5,
79 },
80 [SEARCH_INDEX] = {
81 .string = "INDEX ",
82 .len = 6,
83 },
84};
85
55static int help(struct sk_buff **pskb, 86static int help(struct sk_buff **pskb,
56 struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) 87 struct ip_conntrack *ct, enum ip_conntrack_info ctinfo)
57{ 88{
89 struct ts_state ts;
58 struct ip_conntrack_expect *exp; 90 struct ip_conntrack_expect *exp;
59 char *data, *data_limit, *tmp; 91 unsigned int dataoff, start, stop, off, i;
60 unsigned int dataoff, i; 92 char pbuf[sizeof("65535")], *tmp;
61 u_int16_t port, len; 93 u_int16_t port, len;
62 int ret = NF_ACCEPT; 94 int ret = NF_ACCEPT;
63 95
@@ -77,29 +109,34 @@ static int help(struct sk_buff **pskb,
77 return NF_ACCEPT; 109 return NF_ACCEPT;
78 } 110 }
79 111
80 spin_lock_bh(&amanda_buffer_lock); 112 memset(&ts, 0, sizeof(ts));
81 skb_copy_bits(*pskb, dataoff, amanda_buffer, (*pskb)->len - dataoff); 113 start = skb_find_text(*pskb, dataoff, (*pskb)->len,
82 data = amanda_buffer; 114 search[SEARCH_CONNECT].ts, &ts);
83 data_limit = amanda_buffer + (*pskb)->len - dataoff; 115 if (start == UINT_MAX)
84 *data_limit = '\0';
85
86 /* Search for the CONNECT string */
87 data = strstr(data, "CONNECT ");
88 if (!data)
89 goto out; 116 goto out;
90 data += strlen("CONNECT "); 117 start += dataoff + search[SEARCH_CONNECT].len;
91 118
92 /* Only search first line. */ 119 memset(&ts, 0, sizeof(ts));
93 if ((tmp = strchr(data, '\n'))) 120 stop = skb_find_text(*pskb, start, (*pskb)->len,
94 *tmp = '\0'; 121 search[SEARCH_NEWLINE].ts, &ts);
122 if (stop == UINT_MAX)
123 goto out;
124 stop += start;
95 125
96 for (i = 0; i < ARRAY_SIZE(conns); i++) { 126 for (i = SEARCH_DATA; i <= SEARCH_INDEX; i++) {
97 char *match = strstr(data, conns[i]); 127 memset(&ts, 0, sizeof(ts));
98 if (!match) 128 off = skb_find_text(*pskb, start, stop, search[i].ts, &ts);
129 if (off == UINT_MAX)
99 continue; 130 continue;
100 tmp = data = match + strlen(conns[i]); 131 off += start + search[i].len;
101 port = simple_strtoul(data, &data, 10); 132
102 len = data - tmp; 133 len = min_t(unsigned int, sizeof(pbuf) - 1, stop - off);
134 if (skb_copy_bits(*pskb, off, pbuf, len))
135 break;
136 pbuf[len] = '\0';
137
138 port = simple_strtoul(pbuf, &tmp, 10);
139 len = tmp - pbuf;
103 if (port == 0 || len > 5) 140 if (port == 0 || len > 5)
104 break; 141 break;
105 142
@@ -125,8 +162,7 @@ static int help(struct sk_buff **pskb,
125 exp->mask.dst.u.tcp.port = 0xFFFF; 162 exp->mask.dst.u.tcp.port = 0xFFFF;
126 163
127 if (ip_nat_amanda_hook) 164 if (ip_nat_amanda_hook)
128 ret = ip_nat_amanda_hook(pskb, ctinfo, 165 ret = ip_nat_amanda_hook(pskb, ctinfo, off - dataoff,
129 tmp - amanda_buffer,
130 len, exp); 166 len, exp);
131 else if (ip_conntrack_expect_related(exp) != 0) 167 else if (ip_conntrack_expect_related(exp) != 0)
132 ret = NF_DROP; 168 ret = NF_DROP;
@@ -134,12 +170,11 @@ static int help(struct sk_buff **pskb,
134 } 170 }
135 171
136out: 172out:
137 spin_unlock_bh(&amanda_buffer_lock);
138 return ret; 173 return ret;
139} 174}
140 175
141static struct ip_conntrack_helper amanda_helper = { 176static struct ip_conntrack_helper amanda_helper = {
142 .max_expected = ARRAY_SIZE(conns), 177 .max_expected = 3,
143 .timeout = 180, 178 .timeout = 180,
144 .me = THIS_MODULE, 179 .me = THIS_MODULE,
145 .help = help, 180 .help = help,
@@ -155,26 +190,36 @@ static struct ip_conntrack_helper amanda_helper = {
155 190
156static void __exit ip_conntrack_amanda_fini(void) 191static void __exit ip_conntrack_amanda_fini(void)
157{ 192{
193 int i;
194
158 ip_conntrack_helper_unregister(&amanda_helper); 195 ip_conntrack_helper_unregister(&amanda_helper);
159 kfree(amanda_buffer); 196 for (i = 0; i < ARRAY_SIZE(search); i++)
197 textsearch_destroy(search[i].ts);
160} 198}
161 199
162static int __init ip_conntrack_amanda_init(void) 200static int __init ip_conntrack_amanda_init(void)
163{ 201{
164 int ret; 202 int ret, i;
165 203
166 amanda_buffer = kmalloc(65536, GFP_KERNEL); 204 ret = -ENOMEM;
167 if (!amanda_buffer) 205 for (i = 0; i < ARRAY_SIZE(search); i++) {
168 return -ENOMEM; 206 search[i].ts = textsearch_prepare(ts_algo, search[i].string,
169 207 search[i].len,
170 ret = ip_conntrack_helper_register(&amanda_helper); 208 GFP_KERNEL, TS_AUTOLOAD);
171 if (ret < 0) { 209 if (search[i].ts == NULL)
172 kfree(amanda_buffer); 210 goto err;
173 return ret;
174 } 211 }
212 ret = ip_conntrack_helper_register(&amanda_helper);
213 if (ret < 0)
214 goto err;
175 return 0; 215 return 0;
176 216
177 217err:
218 for (; i >= 0; i--) {
219 if (search[i].ts)
220 textsearch_destroy(search[i].ts);
221 }
222 return ret;
178} 223}
179 224
180module_init(ip_conntrack_amanda_init); 225module_init(ip_conntrack_amanda_init);
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index a297da7bbef5..7e4cf9a4d15f 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -724,6 +724,9 @@ init_conntrack(struct ip_conntrack_tuple *tuple,
724 /* this is ugly, but there is no other place where to put it */ 724 /* this is ugly, but there is no other place where to put it */
725 conntrack->nat.masq_index = exp->master->nat.masq_index; 725 conntrack->nat.masq_index = exp->master->nat.masq_index;
726#endif 726#endif
727#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
728 conntrack->secmark = exp->master->secmark;
729#endif
727 nf_conntrack_get(&conntrack->master->ct_general); 730 nf_conntrack_get(&conntrack->master->ct_general);
728 CONNTRACK_STAT_INC(expect_new); 731 CONNTRACK_STAT_INC(expect_new);
729 } else { 732 } else {
@@ -1130,6 +1133,12 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct,
1130 1133
1131 write_lock_bh(&ip_conntrack_lock); 1134 write_lock_bh(&ip_conntrack_lock);
1132 1135
1136 /* Only update if this is not a fixed timeout */
1137 if (test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) {
1138 write_unlock_bh(&ip_conntrack_lock);
1139 return;
1140 }
1141
1133 /* If not in hash table, timer will not be active yet */ 1142 /* If not in hash table, timer will not be active yet */
1134 if (!is_confirmed(ct)) { 1143 if (!is_confirmed(ct)) {
1135 ct->timeout.expires = extra_jiffies; 1144 ct->timeout.expires = extra_jiffies;
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c
index 3e542bf28a9d..4dcf526c3944 100644
--- a/net/ipv4/netfilter/ip_conntrack_ftp.c
+++ b/net/ipv4/netfilter/ip_conntrack_ftp.c
@@ -56,37 +56,48 @@ static int try_eprt(const char *, size_t, u_int32_t [], char);
56static int try_epsv_response(const char *, size_t, u_int32_t [], char); 56static int try_epsv_response(const char *, size_t, u_int32_t [], char);
57 57
58static const struct ftp_search { 58static const struct ftp_search {
59 enum ip_conntrack_dir dir;
60 const char *pattern; 59 const char *pattern;
61 size_t plen; 60 size_t plen;
62 char skip; 61 char skip;
63 char term; 62 char term;
64 enum ip_ct_ftp_type ftptype; 63 enum ip_ct_ftp_type ftptype;
65 int (*getnum)(const char *, size_t, u_int32_t[], char); 64 int (*getnum)(const char *, size_t, u_int32_t[], char);
66} search[] = { 65} search[IP_CT_DIR_MAX][2] = {
67 { 66 [IP_CT_DIR_ORIGINAL] = {
68 IP_CT_DIR_ORIGINAL, 67 {
69 "PORT", sizeof("PORT") - 1, ' ', '\r', 68 .pattern = "PORT",
70 IP_CT_FTP_PORT, 69 .plen = sizeof("PORT") - 1,
71 try_rfc959, 70 .skip = ' ',
71 .term = '\r',
72 .ftptype = IP_CT_FTP_PORT,
73 .getnum = try_rfc959,
74 },
75 {
76 .pattern = "EPRT",
77 .plen = sizeof("EPRT") - 1,
78 .skip = ' ',
79 .term = '\r',
80 .ftptype = IP_CT_FTP_EPRT,
81 .getnum = try_eprt,
82 },
72 }, 83 },
73 { 84 [IP_CT_DIR_REPLY] = {
74 IP_CT_DIR_REPLY, 85 {
75 "227 ", sizeof("227 ") - 1, '(', ')', 86 .pattern = "227 ",
76 IP_CT_FTP_PASV, 87 .plen = sizeof("227 ") - 1,
77 try_rfc959, 88 .skip = '(',
78 }, 89 .term = ')',
79 { 90 .ftptype = IP_CT_FTP_PASV,
80 IP_CT_DIR_ORIGINAL, 91 .getnum = try_rfc959,
81 "EPRT", sizeof("EPRT") - 1, ' ', '\r', 92 },
82 IP_CT_FTP_EPRT, 93 {
83 try_eprt, 94 .pattern = "229 ",
84 }, 95 .plen = sizeof("229 ") - 1,
85 { 96 .skip = '(',
86 IP_CT_DIR_REPLY, 97 .term = ')',
87 "229 ", sizeof("229 ") - 1, '(', ')', 98 .ftptype = IP_CT_FTP_EPSV,
88 IP_CT_FTP_EPSV, 99 .getnum = try_epsv_response,
89 try_epsv_response, 100 },
90 }, 101 },
91}; 102};
92 103
@@ -346,17 +357,15 @@ static int help(struct sk_buff **pskb,
346 array[2] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 8) & 0xFF; 357 array[2] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 8) & 0xFF;
347 array[3] = ntohl(ct->tuplehash[dir].tuple.src.ip) & 0xFF; 358 array[3] = ntohl(ct->tuplehash[dir].tuple.src.ip) & 0xFF;
348 359
349 for (i = 0; i < ARRAY_SIZE(search); i++) { 360 for (i = 0; i < ARRAY_SIZE(search[dir]); i++) {
350 if (search[i].dir != dir) continue;
351
352 found = find_pattern(fb_ptr, (*pskb)->len - dataoff, 361 found = find_pattern(fb_ptr, (*pskb)->len - dataoff,
353 search[i].pattern, 362 search[dir][i].pattern,
354 search[i].plen, 363 search[dir][i].plen,
355 search[i].skip, 364 search[dir][i].skip,
356 search[i].term, 365 search[dir][i].term,
357 &matchoff, &matchlen, 366 &matchoff, &matchlen,
358 array, 367 array,
359 search[i].getnum); 368 search[dir][i].getnum);
360 if (found) break; 369 if (found) break;
361 } 370 }
362 if (found == -1) { 371 if (found == -1) {
@@ -366,7 +375,7 @@ static int help(struct sk_buff **pskb,
366 this case. */ 375 this case. */
367 if (net_ratelimit()) 376 if (net_ratelimit())
368 printk("conntrack_ftp: partial %s %u+%u\n", 377 printk("conntrack_ftp: partial %s %u+%u\n",
369 search[i].pattern, 378 search[dir][i].pattern,
370 ntohl(th->seq), datalen); 379 ntohl(th->seq), datalen);
371 ret = NF_DROP; 380 ret = NF_DROP;
372 goto out; 381 goto out;
@@ -426,7 +435,7 @@ static int help(struct sk_buff **pskb,
426 /* Now, NAT might want to mangle the packet, and register the 435 /* Now, NAT might want to mangle the packet, and register the
427 * (possibly changed) expectation itself. */ 436 * (possibly changed) expectation itself. */
428 if (ip_nat_ftp_hook) 437 if (ip_nat_ftp_hook)
429 ret = ip_nat_ftp_hook(pskb, ctinfo, search[i].ftptype, 438 ret = ip_nat_ftp_hook(pskb, ctinfo, search[dir][i].ftptype,
430 matchoff, matchlen, exp, &seq); 439 matchoff, matchlen, exp, &seq);
431 else { 440 else {
432 /* Can't expect this? Best to drop packet now. */ 441 /* Can't expect this? Best to drop packet now. */
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323.c b/net/ipv4/netfilter/ip_conntrack_helper_h323.c
index 518f581d39ec..0665674218c6 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_h323.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_h323.c
@@ -22,6 +22,8 @@
22#include <linux/netfilter_ipv4/ip_conntrack_tuple.h> 22#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
23#include <linux/netfilter_ipv4/ip_conntrack_h323.h> 23#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
24#include <linux/moduleparam.h> 24#include <linux/moduleparam.h>
25#include <linux/ctype.h>
26#include <linux/inet.h>
25 27
26#if 0 28#if 0
27#define DEBUGP printk 29#define DEBUGP printk
@@ -38,6 +40,12 @@ static int gkrouted_only = 1;
38module_param(gkrouted_only, int, 0600); 40module_param(gkrouted_only, int, 0600);
39MODULE_PARM_DESC(gkrouted_only, "only accept calls from gatekeeper"); 41MODULE_PARM_DESC(gkrouted_only, "only accept calls from gatekeeper");
40 42
43static int callforward_filter = 1;
44module_param(callforward_filter, bool, 0600);
45MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations "
46 "if both endpoints are on different sides "
47 "(determined by routing information)");
48
41/* Hooks for NAT */ 49/* Hooks for NAT */
42int (*set_h245_addr_hook) (struct sk_buff ** pskb, 50int (*set_h245_addr_hook) (struct sk_buff ** pskb,
43 unsigned char **data, int dataoff, 51 unsigned char **data, int dataoff,
@@ -77,6 +85,12 @@ int (*nat_h245_hook) (struct sk_buff ** pskb,
77 unsigned char **data, int dataoff, 85 unsigned char **data, int dataoff,
78 TransportAddress * addr, u_int16_t port, 86 TransportAddress * addr, u_int16_t port,
79 struct ip_conntrack_expect * exp); 87 struct ip_conntrack_expect * exp);
88int (*nat_callforwarding_hook) (struct sk_buff ** pskb,
89 struct ip_conntrack * ct,
90 enum ip_conntrack_info ctinfo,
91 unsigned char **data, int dataoff,
92 TransportAddress * addr, u_int16_t port,
93 struct ip_conntrack_expect * exp);
80int (*nat_q931_hook) (struct sk_buff ** pskb, 94int (*nat_q931_hook) (struct sk_buff ** pskb,
81 struct ip_conntrack * ct, 95 struct ip_conntrack * ct,
82 enum ip_conntrack_info ctinfo, 96 enum ip_conntrack_info ctinfo,
@@ -683,6 +697,92 @@ static int expect_h245(struct sk_buff **pskb, struct ip_conntrack *ct,
683 return ret; 697 return ret;
684} 698}
685 699
700/* Forwarding declaration */
701void ip_conntrack_q931_expect(struct ip_conntrack *new,
702 struct ip_conntrack_expect *this);
703
704/****************************************************************************/
705static int expect_callforwarding(struct sk_buff **pskb,
706 struct ip_conntrack *ct,
707 enum ip_conntrack_info ctinfo,
708 unsigned char **data, int dataoff,
709 TransportAddress * addr)
710{
711 int dir = CTINFO2DIR(ctinfo);
712 int ret = 0;
713 u_int32_t ip;
714 u_int16_t port;
715 struct ip_conntrack_expect *exp = NULL;
716
717 /* Read alternativeAddress */
718 if (!get_h225_addr(*data, addr, &ip, &port) || port == 0)
719 return 0;
720
721 /* If the calling party is on the same side of the forward-to party,
722 * we don't need to track the second call */
723 if (callforward_filter) {
724 struct rtable *rt1, *rt2;
725 struct flowi fl1 = {
726 .fl4_dst = ip,
727 };
728 struct flowi fl2 = {
729 .fl4_dst = ct->tuplehash[!dir].tuple.src.ip,
730 };
731
732 if (ip_route_output_key(&rt1, &fl1) == 0) {
733 if (ip_route_output_key(&rt2, &fl2) == 0) {
734 if (rt1->rt_gateway == rt2->rt_gateway &&
735 rt1->u.dst.dev == rt2->u.dst.dev)
736 ret = 1;
737 dst_release(&rt2->u.dst);
738 }
739 dst_release(&rt1->u.dst);
740 }
741 if (ret) {
742 DEBUGP("ip_ct_q931: Call Forwarding not tracked\n");
743 return 0;
744 }
745 }
746
747 /* Create expect for the second call leg */
748 if ((exp = ip_conntrack_expect_alloc(ct)) == NULL)
749 return -1;
750 exp->tuple.src.ip = ct->tuplehash[!dir].tuple.src.ip;
751 exp->tuple.src.u.tcp.port = 0;
752 exp->tuple.dst.ip = ip;
753 exp->tuple.dst.u.tcp.port = htons(port);
754 exp->tuple.dst.protonum = IPPROTO_TCP;
755 exp->mask.src.ip = 0xFFFFFFFF;
756 exp->mask.src.u.tcp.port = 0;
757 exp->mask.dst.ip = 0xFFFFFFFF;
758 exp->mask.dst.u.tcp.port = 0xFFFF;
759 exp->mask.dst.protonum = 0xFF;
760 exp->flags = 0;
761
762 if (ct->tuplehash[dir].tuple.src.ip !=
763 ct->tuplehash[!dir].tuple.dst.ip && nat_callforwarding_hook) {
764 /* Need NAT */
765 ret = nat_callforwarding_hook(pskb, ct, ctinfo, data, dataoff,
766 addr, port, exp);
767 } else { /* Conntrack only */
768 exp->expectfn = ip_conntrack_q931_expect;
769
770 if (ip_conntrack_expect_related(exp) == 0) {
771 DEBUGP("ip_ct_q931: expect Call Forwarding "
772 "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n",
773 NIPQUAD(exp->tuple.src.ip),
774 ntohs(exp->tuple.src.u.tcp.port),
775 NIPQUAD(exp->tuple.dst.ip),
776 ntohs(exp->tuple.dst.u.tcp.port));
777 } else
778 ret = -1;
779 }
780
781 ip_conntrack_expect_put(exp);
782
783 return ret;
784}
785
686/****************************************************************************/ 786/****************************************************************************/
687static int process_setup(struct sk_buff **pskb, struct ip_conntrack *ct, 787static int process_setup(struct sk_buff **pskb, struct ip_conntrack *ct,
688 enum ip_conntrack_info ctinfo, 788 enum ip_conntrack_info ctinfo,
@@ -878,6 +978,15 @@ static int process_facility(struct sk_buff **pskb, struct ip_conntrack *ct,
878 978
879 DEBUGP("ip_ct_q931: Facility\n"); 979 DEBUGP("ip_ct_q931: Facility\n");
880 980
981 if (facility->reason.choice == eFacilityReason_callForwarded) {
982 if (facility->options & eFacility_UUIE_alternativeAddress)
983 return expect_callforwarding(pskb, ct, ctinfo, data,
984 dataoff,
985 &facility->
986 alternativeAddress);
987 return 0;
988 }
989
881 if (facility->options & eFacility_UUIE_h245Address) { 990 if (facility->options & eFacility_UUIE_h245Address) {
882 ret = expect_h245(pskb, ct, ctinfo, data, dataoff, 991 ret = expect_h245(pskb, ct, ctinfo, data, dataoff,
883 &facility->h245Address); 992 &facility->h245Address);
@@ -1677,7 +1786,6 @@ static int __init init(void)
1677 fini(); 1786 fini();
1678 return ret; 1787 return ret;
1679 } 1788 }
1680
1681 DEBUGP("ip_ct_h323: init success\n"); 1789 DEBUGP("ip_ct_h323: init success\n");
1682 return 0; 1790 return 0;
1683} 1791}
@@ -1696,6 +1804,7 @@ EXPORT_SYMBOL_GPL(set_ras_addr_hook);
1696EXPORT_SYMBOL_GPL(nat_rtp_rtcp_hook); 1804EXPORT_SYMBOL_GPL(nat_rtp_rtcp_hook);
1697EXPORT_SYMBOL_GPL(nat_t120_hook); 1805EXPORT_SYMBOL_GPL(nat_t120_hook);
1698EXPORT_SYMBOL_GPL(nat_h245_hook); 1806EXPORT_SYMBOL_GPL(nat_h245_hook);
1807EXPORT_SYMBOL_GPL(nat_callforwarding_hook);
1699EXPORT_SYMBOL_GPL(nat_q931_hook); 1808EXPORT_SYMBOL_GPL(nat_q931_hook);
1700 1809
1701MODULE_AUTHOR("Jing Min Zhao <zhaojingmin@users.sourceforge.net>"); 1810MODULE_AUTHOR("Jing Min Zhao <zhaojingmin@users.sourceforge.net>");
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323_types.c b/net/ipv4/netfilter/ip_conntrack_helper_h323_types.c
index 022c47b9f6c9..4b359618bedd 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_h323_types.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_h323_types.c
@@ -1,4 +1,4 @@
1/* Generated by Jing Min Zhao's ASN.1 parser, Mar 15 2006 1/* Generated by Jing Min Zhao's ASN.1 parser, Apr 20 2006
2 * 2 *
3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net> 3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net>
4 * 4 *
@@ -1069,8 +1069,8 @@ static field_t _Facility_UUIE_fastStart[] = { /* SEQUENCE OF */
1069 1069
1070static field_t _Facility_UUIE[] = { /* SEQUENCE */ 1070static field_t _Facility_UUIE[] = { /* SEQUENCE */
1071 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1071 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1072 {FNAME("alternativeAddress") CHOICE, 3, 7, 7, SKIP | EXT | OPT, 0, 1072 {FNAME("alternativeAddress") CHOICE, 3, 7, 7, DECODE | EXT | OPT,
1073 _TransportAddress}, 1073 offsetof(Facility_UUIE, alternativeAddress), _TransportAddress},
1074 {FNAME("alternativeAliasAddress") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, 1074 {FNAME("alternativeAliasAddress") SEQOF, SEMI, 0, 0, SKIP | OPT, 0,
1075 _Facility_UUIE_alternativeAliasAddress}, 1075 _Facility_UUIE_alternativeAliasAddress},
1076 {FNAME("conferenceID") OCTSTR, FIXD, 16, 0, SKIP | OPT, 0, NULL}, 1076 {FNAME("conferenceID") OCTSTR, FIXD, 16, 0, SKIP | OPT, 0, NULL},
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c
index 01bd7cab9367..33891bb1fde4 100644
--- a/net/ipv4/netfilter/ip_conntrack_netlink.c
+++ b/net/ipv4/netfilter/ip_conntrack_netlink.c
@@ -399,38 +399,54 @@ nfattr_failure:
399static int ctnetlink_done(struct netlink_callback *cb) 399static int ctnetlink_done(struct netlink_callback *cb)
400{ 400{
401 DEBUGP("entered %s\n", __FUNCTION__); 401 DEBUGP("entered %s\n", __FUNCTION__);
402 if (cb->args[1])
403 ip_conntrack_put((struct ip_conntrack *)cb->args[1]);
402 return 0; 404 return 0;
403} 405}
404 406
405static int 407static int
406ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) 408ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
407{ 409{
408 struct ip_conntrack *ct = NULL; 410 struct ip_conntrack *ct, *last;
409 struct ip_conntrack_tuple_hash *h; 411 struct ip_conntrack_tuple_hash *h;
410 struct list_head *i; 412 struct list_head *i;
411 u_int32_t *id = (u_int32_t *) &cb->args[1];
412 413
413 DEBUGP("entered %s, last bucket=%lu id=%u\n", __FUNCTION__, 414 DEBUGP("entered %s, last bucket=%lu id=%u\n", __FUNCTION__,
414 cb->args[0], *id); 415 cb->args[0], *id);
415 416
416 read_lock_bh(&ip_conntrack_lock); 417 read_lock_bh(&ip_conntrack_lock);
417 for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++, *id = 0) { 418 for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++) {
419restart:
420 last = (struct ip_conntrack *)cb->args[1];
418 list_for_each_prev(i, &ip_conntrack_hash[cb->args[0]]) { 421 list_for_each_prev(i, &ip_conntrack_hash[cb->args[0]]) {
419 h = (struct ip_conntrack_tuple_hash *) i; 422 h = (struct ip_conntrack_tuple_hash *) i;
420 if (DIRECTION(h) != IP_CT_DIR_ORIGINAL) 423 if (DIRECTION(h) != IP_CT_DIR_ORIGINAL)
421 continue; 424 continue;
422 ct = tuplehash_to_ctrack(h); 425 ct = tuplehash_to_ctrack(h);
423 if (ct->id <= *id) 426 if (last != NULL) {
424 continue; 427 if (ct == last) {
428 ip_conntrack_put(last);
429 cb->args[1] = 0;
430 last = NULL;
431 } else
432 continue;
433 }
425 if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, 434 if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid,
426 cb->nlh->nlmsg_seq, 435 cb->nlh->nlmsg_seq,
427 IPCTNL_MSG_CT_NEW, 436 IPCTNL_MSG_CT_NEW,
428 1, ct) < 0) 437 1, ct) < 0) {
438 nf_conntrack_get(&ct->ct_general);
439 cb->args[1] = (unsigned long)ct;
429 goto out; 440 goto out;
430 *id = ct->id; 441 }
442 }
443 if (last != NULL) {
444 ip_conntrack_put(last);
445 cb->args[1] = 0;
446 goto restart;
431 } 447 }
432 } 448 }
433out: 449out:
434 read_unlock_bh(&ip_conntrack_lock); 450 read_unlock_bh(&ip_conntrack_lock);
435 451
436 DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id); 452 DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id);
@@ -629,7 +645,7 @@ static const size_t cta_min_nat[CTA_NAT_MAX] = {
629}; 645};
630 646
631static inline int 647static inline int
632ctnetlink_parse_nat(struct nfattr *cda[], 648ctnetlink_parse_nat(struct nfattr *nat,
633 const struct ip_conntrack *ct, struct ip_nat_range *range) 649 const struct ip_conntrack *ct, struct ip_nat_range *range)
634{ 650{
635 struct nfattr *tb[CTA_NAT_MAX]; 651 struct nfattr *tb[CTA_NAT_MAX];
@@ -639,7 +655,7 @@ ctnetlink_parse_nat(struct nfattr *cda[],
639 655
640 memset(range, 0, sizeof(*range)); 656 memset(range, 0, sizeof(*range));
641 657
642 nfattr_parse_nested(tb, CTA_NAT_MAX, cda[CTA_NAT-1]); 658 nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
643 659
644 if (nfattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat)) 660 if (nfattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat))
645 return -EINVAL; 661 return -EINVAL;
@@ -854,39 +870,30 @@ ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[])
854 /* ASSURED bit can only be set */ 870 /* ASSURED bit can only be set */
855 return -EINVAL; 871 return -EINVAL;
856 872
857 if (cda[CTA_NAT-1]) { 873 if (cda[CTA_NAT_SRC-1] || cda[CTA_NAT_DST-1]) {
858#ifndef CONFIG_IP_NF_NAT_NEEDED 874#ifndef CONFIG_IP_NF_NAT_NEEDED
859 return -EINVAL; 875 return -EINVAL;
860#else 876#else
861 unsigned int hooknum;
862 struct ip_nat_range range; 877 struct ip_nat_range range;
863 878
864 if (ctnetlink_parse_nat(cda, ct, &range) < 0) 879 if (cda[CTA_NAT_DST-1]) {
865 return -EINVAL; 880 if (ctnetlink_parse_nat(cda[CTA_NAT_DST-1], ct,
866 881 &range) < 0)
867 DEBUGP("NAT: %u.%u.%u.%u-%u.%u.%u.%u:%u-%u\n", 882 return -EINVAL;
868 NIPQUAD(range.min_ip), NIPQUAD(range.max_ip), 883 if (ip_nat_initialized(ct,
869 htons(range.min.all), htons(range.max.all)); 884 HOOK2MANIP(NF_IP_PRE_ROUTING)))
870 885 return -EEXIST;
871 /* This is tricky but it works. ip_nat_setup_info needs the 886 ip_nat_setup_info(ct, &range, NF_IP_PRE_ROUTING);
872 * hook number as parameter, so let's do the correct 887 }
873 * conversion and run away */ 888 if (cda[CTA_NAT_SRC-1]) {
874 if (status & IPS_SRC_NAT_DONE) 889 if (ctnetlink_parse_nat(cda[CTA_NAT_SRC-1], ct,
875 hooknum = NF_IP_POST_ROUTING; /* IP_NAT_MANIP_SRC */ 890 &range) < 0)
876 else if (status & IPS_DST_NAT_DONE) 891 return -EINVAL;
877 hooknum = NF_IP_PRE_ROUTING; /* IP_NAT_MANIP_DST */ 892 if (ip_nat_initialized(ct,
878 else 893 HOOK2MANIP(NF_IP_POST_ROUTING)))
879 return -EINVAL; /* Missing NAT flags */ 894 return -EEXIST;
880 895 ip_nat_setup_info(ct, &range, NF_IP_POST_ROUTING);
881 DEBUGP("NAT status: %lu\n", 896 }
882 status & (IPS_NAT_MASK | IPS_NAT_DONE_MASK));
883
884 if (ip_nat_initialized(ct, HOOK2MANIP(hooknum)))
885 return -EEXIST;
886 ip_nat_setup_info(ct, &range, hooknum);
887
888 DEBUGP("NAT status after setup_info: %lu\n",
889 ct->status & (IPS_NAT_MASK | IPS_NAT_DONE_MASK));
890#endif 897#endif
891 } 898 }
892 899
@@ -1106,7 +1113,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1106 /* implicit 'else' */ 1113 /* implicit 'else' */
1107 1114
1108 /* we only allow nat config for new conntracks */ 1115 /* we only allow nat config for new conntracks */
1109 if (cda[CTA_NAT-1]) { 1116 if (cda[CTA_NAT_SRC-1] || cda[CTA_NAT_DST-1]) {
1110 err = -EINVAL; 1117 err = -EINVAL;
1111 goto out_unlock; 1118 goto out_unlock;
1112 } 1119 }
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_gre.c b/net/ipv4/netfilter/ip_conntrack_proto_gre.c
index 56794797d55b..21ee124c0463 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_gre.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_gre.c
@@ -77,10 +77,10 @@ static inline int gre_key_cmpfn(const struct ip_ct_gre_keymap *km,
77} 77}
78 78
79/* look up the source key for a given tuple */ 79/* look up the source key for a given tuple */
80static u_int32_t gre_keymap_lookup(struct ip_conntrack_tuple *t) 80static __be16 gre_keymap_lookup(struct ip_conntrack_tuple *t)
81{ 81{
82 struct ip_ct_gre_keymap *km; 82 struct ip_ct_gre_keymap *km;
83 u_int32_t key = 0; 83 __be16 key = 0;
84 84
85 read_lock_bh(&ip_ct_gre_lock); 85 read_lock_bh(&ip_ct_gre_lock);
86 km = LIST_FIND(&gre_keymap_list, gre_key_cmpfn, 86 km = LIST_FIND(&gre_keymap_list, gre_key_cmpfn,
@@ -190,7 +190,7 @@ static int gre_pkt_to_tuple(const struct sk_buff *skb,
190 struct ip_conntrack_tuple *tuple) 190 struct ip_conntrack_tuple *tuple)
191{ 191{
192 struct gre_hdr_pptp _pgrehdr, *pgrehdr; 192 struct gre_hdr_pptp _pgrehdr, *pgrehdr;
193 u_int32_t srckey; 193 __be16 srckey;
194 struct gre_hdr _grehdr, *grehdr; 194 struct gre_hdr _grehdr, *grehdr;
195 195
196 /* first only delinearize old RFC1701 GRE header */ 196 /* first only delinearize old RFC1701 GRE header */
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
index d8b14a9010a6..23f1c504586d 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
@@ -224,7 +224,7 @@ 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 (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
228 nf_ip_checksum(skb, hooknum, skb->nh.iph->ihl * 4, 0)) { 228 nf_ip_checksum(skb, hooknum, skb->nh.iph->ihl * 4, 0)) {
229 if (LOG_INVALID(IPPROTO_ICMP)) 229 if (LOG_INVALID(IPPROTO_ICMP))
230 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, 230 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
index 062b252b58ad..c5c2ce5cdeb8 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
@@ -870,7 +870,7 @@ 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 (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
874 nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_TCP)) { 874 nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_TCP)) {
875 if (LOG_INVALID(IPPROTO_TCP)) 875 if (LOG_INVALID(IPPROTO_TCP))
876 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, 876 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_udp.c b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
index 70899868783b..9b2c16b4d2ff 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_udp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
@@ -120,7 +120,7 @@ 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 (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
124 nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) { 124 nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) {
125 if (LOG_INVALID(IPPROTO_UDP)) 125 if (LOG_INVALID(IPPROTO_UDP))
126 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, 126 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
diff --git a/net/ipv4/netfilter/ip_conntrack_sip.c b/net/ipv4/netfilter/ip_conntrack_sip.c
new file mode 100644
index 000000000000..fc87ce0da40d
--- /dev/null
+++ b/net/ipv4/netfilter/ip_conntrack_sip.c
@@ -0,0 +1,471 @@
1/* SIP extension for IP connection tracking.
2 *
3 * (C) 2005 by Christian Hentschel <chentschel@arnet.com.ar>
4 * based on RR's ip_conntrack_ftp.c and other modules.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/config.h>
12#include <linux/module.h>
13#include <linux/ctype.h>
14#include <linux/skbuff.h>
15#include <linux/in.h>
16#include <linux/ip.h>
17#include <linux/udp.h>
18
19#include <linux/netfilter.h>
20#include <linux/netfilter_ipv4.h>
21#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
22#include <linux/netfilter_ipv4/ip_conntrack_sip.h>
23
24#if 0
25#define DEBUGP printk
26#else
27#define DEBUGP(format, args...)
28#endif
29
30MODULE_LICENSE("GPL");
31MODULE_AUTHOR("Christian Hentschel <chentschel@arnet.com.ar>");
32MODULE_DESCRIPTION("SIP connection tracking helper");
33
34#define MAX_PORTS 8
35static unsigned short ports[MAX_PORTS];
36static int ports_c;
37module_param_array(ports, ushort, &ports_c, 0400);
38MODULE_PARM_DESC(ports, "port numbers of sip servers");
39
40static unsigned int sip_timeout = SIP_TIMEOUT;
41module_param(sip_timeout, uint, 0600);
42MODULE_PARM_DESC(sip_timeout, "timeout for the master SIP session");
43
44unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
45 enum ip_conntrack_info ctinfo,
46 struct ip_conntrack *ct,
47 const char **dptr);
48EXPORT_SYMBOL_GPL(ip_nat_sip_hook);
49
50unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
51 enum ip_conntrack_info ctinfo,
52 struct ip_conntrack_expect *exp,
53 const char *dptr);
54EXPORT_SYMBOL_GPL(ip_nat_sdp_hook);
55
56int ct_sip_get_info(const char *dptr, size_t dlen,
57 unsigned int *matchoff,
58 unsigned int *matchlen,
59 struct sip_header_nfo *hnfo);
60EXPORT_SYMBOL_GPL(ct_sip_get_info);
61
62
63static int digits_len(const char *dptr, const char *limit, int *shift);
64static int epaddr_len(const char *dptr, const char *limit, int *shift);
65static int skp_digits_len(const char *dptr, const char *limit, int *shift);
66static int skp_epaddr_len(const char *dptr, const char *limit, int *shift);
67
68struct sip_header_nfo ct_sip_hdrs[] = {
69 { /* Via header */
70 .lname = "Via:",
71 .lnlen = sizeof("Via:") - 1,
72 .sname = "\r\nv:",
73 .snlen = sizeof("\r\nv:") - 1, /* rfc3261 "\r\n" */
74 .ln_str = "UDP ",
75 .ln_strlen = sizeof("UDP ") - 1,
76 .match_len = epaddr_len,
77 },
78 { /* Contact header */
79 .lname = "Contact:",
80 .lnlen = sizeof("Contact:") - 1,
81 .sname = "\r\nm:",
82 .snlen = sizeof("\r\nm:") - 1,
83 .ln_str = "sip:",
84 .ln_strlen = sizeof("sip:") - 1,
85 .match_len = skp_epaddr_len
86 },
87 { /* Content length header */
88 .lname = "Content-Length:",
89 .lnlen = sizeof("Content-Length:") - 1,
90 .sname = "\r\nl:",
91 .snlen = sizeof("\r\nl:") - 1,
92 .ln_str = ":",
93 .ln_strlen = sizeof(":") - 1,
94 .match_len = skp_digits_len
95 },
96 { /* SDP media info */
97 .lname = "\nm=",
98 .lnlen = sizeof("\nm=") - 1,
99 .sname = "\rm=",
100 .snlen = sizeof("\rm=") - 1,
101 .ln_str = "audio ",
102 .ln_strlen = sizeof("audio ") - 1,
103 .match_len = digits_len
104 },
105 { /* SDP owner address*/
106 .lname = "\no=",
107 .lnlen = sizeof("\no=") - 1,
108 .sname = "\ro=",
109 .snlen = sizeof("\ro=") - 1,
110 .ln_str = "IN IP4 ",
111 .ln_strlen = sizeof("IN IP4 ") - 1,
112 .match_len = epaddr_len
113 },
114 { /* SDP connection info */
115 .lname = "\nc=",
116 .lnlen = sizeof("\nc=") - 1,
117 .sname = "\rc=",
118 .snlen = sizeof("\rc=") - 1,
119 .ln_str = "IN IP4 ",
120 .ln_strlen = sizeof("IN IP4 ") - 1,
121 .match_len = epaddr_len
122 },
123 { /* Requests headers */
124 .lname = "sip:",
125 .lnlen = sizeof("sip:") - 1,
126 .sname = "sip:",
127 .snlen = sizeof("sip:") - 1, /* yes, i know.. ;) */
128 .ln_str = "@",
129 .ln_strlen = sizeof("@") - 1,
130 .match_len = epaddr_len
131 },
132 { /* SDP version header */
133 .lname = "\nv=",
134 .lnlen = sizeof("\nv=") - 1,
135 .sname = "\rv=",
136 .snlen = sizeof("\rv=") - 1,
137 .ln_str = "=",
138 .ln_strlen = sizeof("=") - 1,
139 .match_len = digits_len
140 }
141};
142EXPORT_SYMBOL_GPL(ct_sip_hdrs);
143
144/* get line lenght until first CR or LF seen. */
145int ct_sip_lnlen(const char *line, const char *limit)
146{
147 const char *k = line;
148
149 while ((line <= limit) && (*line == '\r' || *line == '\n'))
150 line++;
151
152 while (line <= limit) {
153 if (*line == '\r' || *line == '\n')
154 break;
155 line++;
156 }
157 return line - k;
158}
159EXPORT_SYMBOL_GPL(ct_sip_lnlen);
160
161/* Linear string search, case sensitive. */
162const char *ct_sip_search(const char *needle, const char *haystack,
163 size_t needle_len, size_t haystack_len)
164{
165 const char *limit = haystack + (haystack_len - needle_len);
166
167 while (haystack <= limit) {
168 if (memcmp(haystack, needle, needle_len) == 0)
169 return haystack;
170 haystack++;
171 }
172 return NULL;
173}
174EXPORT_SYMBOL_GPL(ct_sip_search);
175
176static int digits_len(const char *dptr, const char *limit, int *shift)
177{
178 int len = 0;
179 while (dptr <= limit && isdigit(*dptr)) {
180 dptr++;
181 len++;
182 }
183 return len;
184}
185
186/* get digits lenght, skiping blank spaces. */
187static int skp_digits_len(const char *dptr, const char *limit, int *shift)
188{
189 for (; dptr <= limit && *dptr == ' '; dptr++)
190 (*shift)++;
191
192 return digits_len(dptr, limit, shift);
193}
194
195/* Simple ipaddr parser.. */
196static int parse_ipaddr(const char *cp, const char **endp,
197 u_int32_t *ipaddr, const char *limit)
198{
199 unsigned long int val;
200 int i, digit = 0;
201
202 for (i = 0, *ipaddr = 0; cp <= limit && i < 4; i++) {
203 digit = 0;
204 if (!isdigit(*cp))
205 break;
206
207 val = simple_strtoul(cp, (char **)&cp, 10);
208 if (val > 0xFF)
209 return -1;
210
211 ((u_int8_t *)ipaddr)[i] = val;
212 digit = 1;
213
214 if (*cp != '.')
215 break;
216 cp++;
217 }
218 if (!digit)
219 return -1;
220
221 if (endp)
222 *endp = cp;
223
224 return 0;
225}
226
227/* skip ip address. returns it lenght. */
228static int epaddr_len(const char *dptr, const char *limit, int *shift)
229{
230 const char *aux = dptr;
231 u_int32_t ip;
232
233 if (parse_ipaddr(dptr, &dptr, &ip, limit) < 0) {
234 DEBUGP("ip: %s parse failed.!\n", dptr);
235 return 0;
236 }
237
238 /* Port number */
239 if (*dptr == ':') {
240 dptr++;
241 dptr += digits_len(dptr, limit, shift);
242 }
243 return dptr - aux;
244}
245
246/* get address length, skiping user info. */
247static int skp_epaddr_len(const char *dptr, const char *limit, int *shift)
248{
249 int s = *shift;
250
251 for (; dptr <= limit && *dptr != '@'; dptr++)
252 (*shift)++;
253
254 if (*dptr == '@') {
255 dptr++;
256 (*shift)++;
257 } else
258 *shift = s;
259
260 return epaddr_len(dptr, limit, shift);
261}
262
263/* Returns 0 if not found, -1 error parsing. */
264int ct_sip_get_info(const char *dptr, size_t dlen,
265 unsigned int *matchoff,
266 unsigned int *matchlen,
267 struct sip_header_nfo *hnfo)
268{
269 const char *limit, *aux, *k = dptr;
270 int shift = 0;
271
272 limit = dptr + (dlen - hnfo->lnlen);
273
274 while (dptr <= limit) {
275 if ((strncmp(dptr, hnfo->lname, hnfo->lnlen) != 0) &&
276 (strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
277 dptr++;
278 continue;
279 }
280 aux = ct_sip_search(hnfo->ln_str, dptr, hnfo->ln_strlen,
281 ct_sip_lnlen(dptr, limit));
282 if (!aux) {
283 DEBUGP("'%s' not found in '%s'.\n", hnfo->ln_str,
284 hnfo->lname);
285 return -1;
286 }
287 aux += hnfo->ln_strlen;
288
289 *matchlen = hnfo->match_len(aux, limit, &shift);
290 if (!*matchlen)
291 return -1;
292
293 *matchoff = (aux - k) + shift;
294
295 DEBUGP("%s match succeeded! - len: %u\n", hnfo->lname,
296 *matchlen);
297 return 1;
298 }
299 DEBUGP("%s header not found.\n", hnfo->lname);
300 return 0;
301}
302
303static int set_expected_rtp(struct sk_buff **pskb,
304 struct ip_conntrack *ct,
305 enum ip_conntrack_info ctinfo,
306 u_int32_t ipaddr, u_int16_t port,
307 const char *dptr)
308{
309 struct ip_conntrack_expect *exp;
310 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
311 int ret;
312
313 exp = ip_conntrack_expect_alloc(ct);
314 if (exp == NULL)
315 return NF_DROP;
316
317 exp->tuple.src.ip = ct->tuplehash[!dir].tuple.src.ip;
318 exp->tuple.src.u.udp.port = 0;
319 exp->tuple.dst.ip = ipaddr;
320 exp->tuple.dst.u.udp.port = htons(port);
321 exp->tuple.dst.protonum = IPPROTO_UDP;
322
323 exp->mask.src.ip = 0xFFFFFFFF;
324 exp->mask.src.u.udp.port = 0;
325 exp->mask.dst.ip = 0xFFFFFFFF;
326 exp->mask.dst.u.udp.port = 0xFFFF;
327 exp->mask.dst.protonum = 0xFF;
328
329 exp->expectfn = NULL;
330 exp->flags = 0;
331
332 if (ip_nat_sdp_hook)
333 ret = ip_nat_sdp_hook(pskb, ctinfo, exp, dptr);
334 else {
335 if (ip_conntrack_expect_related(exp) != 0)
336 ret = NF_DROP;
337 else
338 ret = NF_ACCEPT;
339 }
340 ip_conntrack_expect_put(exp);
341
342 return ret;
343}
344
345static int sip_help(struct sk_buff **pskb,
346 struct ip_conntrack *ct,
347 enum ip_conntrack_info ctinfo)
348{
349 unsigned int dataoff, datalen;
350 const char *dptr;
351 int ret = NF_ACCEPT;
352 int matchoff, matchlen;
353 u_int32_t ipaddr;
354 u_int16_t port;
355
356 /* No Data ? */
357 dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr);
358 if (dataoff >= (*pskb)->len) {
359 DEBUGP("skb->len = %u\n", (*pskb)->len);
360 return NF_ACCEPT;
361 }
362
363 ip_ct_refresh(ct, *pskb, sip_timeout * HZ);
364
365 if (!skb_is_nonlinear(*pskb))
366 dptr = (*pskb)->data + dataoff;
367 else {
368 DEBUGP("Copy of skbuff not supported yet.\n");
369 goto out;
370 }
371
372 if (ip_nat_sip_hook) {
373 if (!ip_nat_sip_hook(pskb, ctinfo, ct, &dptr)) {
374 ret = NF_DROP;
375 goto out;
376 }
377 }
378
379 /* After this point NAT, could have mangled skb, so
380 we need to recalculate payload lenght. */
381 datalen = (*pskb)->len - dataoff;
382
383 if (datalen < (sizeof("SIP/2.0 200") - 1))
384 goto out;
385
386 /* RTP info only in some SDP pkts */
387 if (memcmp(dptr, "INVITE", sizeof("INVITE") - 1) != 0 &&
388 memcmp(dptr, "SIP/2.0 200", sizeof("SIP/2.0 200") - 1) != 0) {
389 goto out;
390 }
391 /* Get ip and port address from SDP packet. */
392 if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen,
393 &ct_sip_hdrs[POS_CONNECTION]) > 0) {
394
395 /* We'll drop only if there are parse problems. */
396 if (parse_ipaddr(dptr + matchoff, NULL, &ipaddr,
397 dptr + datalen) < 0) {
398 ret = NF_DROP;
399 goto out;
400 }
401 if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen,
402 &ct_sip_hdrs[POS_MEDIA]) > 0) {
403
404 port = simple_strtoul(dptr + matchoff, NULL, 10);
405 if (port < 1024) {
406 ret = NF_DROP;
407 goto out;
408 }
409 ret = set_expected_rtp(pskb, ct, ctinfo,
410 ipaddr, port, dptr);
411 }
412 }
413out:
414 return ret;
415}
416
417static struct ip_conntrack_helper sip[MAX_PORTS];
418static char sip_names[MAX_PORTS][10];
419
420static void fini(void)
421{
422 int i;
423 for (i = 0; i < ports_c; i++) {
424 DEBUGP("unregistering helper for port %d\n", ports[i]);
425 ip_conntrack_helper_unregister(&sip[i]);
426 }
427}
428
429static int __init init(void)
430{
431 int i, ret;
432 char *tmpname;
433
434 if (ports_c == 0)
435 ports[ports_c++] = SIP_PORT;
436
437 for (i = 0; i < ports_c; i++) {
438 /* Create helper structure */
439 memset(&sip[i], 0, sizeof(struct ip_conntrack_helper));
440
441 sip[i].tuple.dst.protonum = IPPROTO_UDP;
442 sip[i].tuple.src.u.udp.port = htons(ports[i]);
443 sip[i].mask.src.u.udp.port = 0xFFFF;
444 sip[i].mask.dst.protonum = 0xFF;
445 sip[i].max_expected = 1;
446 sip[i].timeout = 3 * 60; /* 3 minutes */
447 sip[i].me = THIS_MODULE;
448 sip[i].help = sip_help;
449
450 tmpname = &sip_names[i][0];
451 if (ports[i] == SIP_PORT)
452 sprintf(tmpname, "sip");
453 else
454 sprintf(tmpname, "sip-%d", i);
455 sip[i].name = tmpname;
456
457 DEBUGP("port #%d: %d\n", i, ports[i]);
458
459 ret = ip_conntrack_helper_register(&sip[i]);
460 if (ret) {
461 printk("ERROR registering helper for port %d\n",
462 ports[i]);
463 fini();
464 return ret;
465 }
466 }
467 return 0;
468}
469
470module_init(init);
471module_exit(fini);
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
index 929d61f7be91..88445aac3f28 100644
--- a/net/ipv4/netfilter/ip_conntrack_standalone.c
+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c
@@ -189,6 +189,11 @@ static int ct_seq_show(struct seq_file *s, void *v)
189 return -ENOSPC; 189 return -ENOSPC;
190#endif 190#endif
191 191
192#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
193 if (seq_printf(s, "secmark=%u ", conntrack->secmark))
194 return -ENOSPC;
195#endif
196
192 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use))) 197 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use)))
193 return -ENOSPC; 198 return -ENOSPC;
194 199
@@ -417,7 +422,7 @@ static unsigned int ip_conntrack_help(unsigned int hooknum,
417 422
418 /* This is where we call the helper: as the packet goes out. */ 423 /* This is where we call the helper: as the packet goes out. */
419 ct = ip_conntrack_get(*pskb, &ctinfo); 424 ct = ip_conntrack_get(*pskb, &ctinfo);
420 if (ct && ct->helper) { 425 if (ct && ct->helper && ctinfo != IP_CT_RELATED + IP_CT_IS_REPLY) {
421 unsigned int ret; 426 unsigned int ret;
422 ret = ct->helper->help(pskb, ct, ctinfo); 427 ret = ct->helper->help(pskb, ct, ctinfo);
423 if (ret != NF_ACCEPT) 428 if (ret != NF_ACCEPT)
@@ -564,6 +569,8 @@ extern unsigned int ip_ct_generic_timeout;
564static int log_invalid_proto_min = 0; 569static int log_invalid_proto_min = 0;
565static int log_invalid_proto_max = 255; 570static int log_invalid_proto_max = 255;
566 571
572int ip_conntrack_checksum = 1;
573
567static struct ctl_table_header *ip_ct_sysctl_header; 574static struct ctl_table_header *ip_ct_sysctl_header;
568 575
569static ctl_table ip_ct_sysctl_table[] = { 576static ctl_table ip_ct_sysctl_table[] = {
@@ -592,6 +599,14 @@ static ctl_table ip_ct_sysctl_table[] = {
592 .proc_handler = &proc_dointvec, 599 .proc_handler = &proc_dointvec,
593 }, 600 },
594 { 601 {
602 .ctl_name = NET_IPV4_NF_CONNTRACK_CHECKSUM,
603 .procname = "ip_conntrack_checksum",
604 .data = &ip_conntrack_checksum,
605 .maxlen = sizeof(int),
606 .mode = 0644,
607 .proc_handler = &proc_dointvec,
608 },
609 {
595 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, 610 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,
596 .procname = "ip_conntrack_tcp_timeout_syn_sent", 611 .procname = "ip_conntrack_tcp_timeout_syn_sent",
597 .data = &ip_ct_tcp_timeout_syn_sent, 612 .data = &ip_ct_tcp_timeout_syn_sent,
@@ -946,6 +961,7 @@ EXPORT_SYMBOL_GPL(__ip_conntrack_helper_find_byname);
946EXPORT_SYMBOL_GPL(ip_conntrack_proto_find_get); 961EXPORT_SYMBOL_GPL(ip_conntrack_proto_find_get);
947EXPORT_SYMBOL_GPL(ip_conntrack_proto_put); 962EXPORT_SYMBOL_GPL(ip_conntrack_proto_put);
948EXPORT_SYMBOL_GPL(__ip_conntrack_proto_find); 963EXPORT_SYMBOL_GPL(__ip_conntrack_proto_find);
964EXPORT_SYMBOL_GPL(ip_conntrack_checksum);
949#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ 965#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \
950 defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) 966 defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE)
951EXPORT_SYMBOL_GPL(ip_ct_port_tuple_to_nfattr); 967EXPORT_SYMBOL_GPL(ip_ct_port_tuple_to_nfattr);
diff --git a/net/ipv4/netfilter/ip_nat_helper_h323.c b/net/ipv4/netfilter/ip_nat_helper_h323.c
index d45663d137a7..419b878fb467 100644
--- a/net/ipv4/netfilter/ip_nat_helper_h323.c
+++ b/net/ipv4/netfilter/ip_nat_helper_h323.c
@@ -487,6 +487,80 @@ static int nat_q931(struct sk_buff **pskb, struct ip_conntrack *ct,
487} 487}
488 488
489/****************************************************************************/ 489/****************************************************************************/
490static void ip_nat_callforwarding_expect(struct ip_conntrack *new,
491 struct ip_conntrack_expect *this)
492{
493 struct ip_nat_range range;
494
495 /* This must be a fresh one. */
496 BUG_ON(new->status & IPS_NAT_DONE_MASK);
497
498 /* Change src to where master sends to */
499 range.flags = IP_NAT_RANGE_MAP_IPS;
500 range.min_ip = range.max_ip = new->tuplehash[!this->dir].tuple.src.ip;
501
502 /* hook doesn't matter, but it has to do source manip */
503 ip_nat_setup_info(new, &range, NF_IP_POST_ROUTING);
504
505 /* For DST manip, map port here to where it's expected. */
506 range.flags = (IP_NAT_RANGE_MAP_IPS | IP_NAT_RANGE_PROTO_SPECIFIED);
507 range.min = range.max = this->saved_proto;
508 range.min_ip = range.max_ip = this->saved_ip;
509
510 /* hook doesn't matter, but it has to do destination manip */
511 ip_nat_setup_info(new, &range, NF_IP_PRE_ROUTING);
512
513 ip_conntrack_q931_expect(new, this);
514}
515
516/****************************************************************************/
517static int nat_callforwarding(struct sk_buff **pskb, struct ip_conntrack *ct,
518 enum ip_conntrack_info ctinfo,
519 unsigned char **data, int dataoff,
520 TransportAddress * addr, u_int16_t port,
521 struct ip_conntrack_expect *exp)
522{
523 int dir = CTINFO2DIR(ctinfo);
524 u_int16_t nated_port;
525
526 /* Set expectations for NAT */
527 exp->saved_ip = exp->tuple.dst.ip;
528 exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip;
529 exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port;
530 exp->expectfn = ip_nat_callforwarding_expect;
531 exp->dir = !dir;
532
533 /* Try to get same port: if not, try to change it. */
534 for (nated_port = port; nated_port != 0; nated_port++) {
535 exp->tuple.dst.u.tcp.port = htons(nated_port);
536 if (ip_conntrack_expect_related(exp) == 0)
537 break;
538 }
539
540 if (nated_port == 0) { /* No port available */
541 if (net_ratelimit())
542 printk("ip_nat_q931: out of TCP ports\n");
543 return 0;
544 }
545
546 /* Modify signal */
547 if (!set_h225_addr(pskb, data, dataoff, addr,
548 ct->tuplehash[!dir].tuple.dst.ip,
549 nated_port) == 0) {
550 ip_conntrack_unexpect_related(exp);
551 return -1;
552 }
553
554 /* Success */
555 DEBUGP("ip_nat_q931: expect Call Forwarding "
556 "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n",
557 NIPQUAD(exp->tuple.src.ip), ntohs(exp->tuple.src.u.tcp.port),
558 NIPQUAD(exp->tuple.dst.ip), ntohs(exp->tuple.dst.u.tcp.port));
559
560 return 0;
561}
562
563/****************************************************************************/
490static int __init init(void) 564static int __init init(void)
491{ 565{
492 BUG_ON(set_h245_addr_hook != NULL); 566 BUG_ON(set_h245_addr_hook != NULL);
@@ -496,6 +570,7 @@ static int __init init(void)
496 BUG_ON(nat_rtp_rtcp_hook != NULL); 570 BUG_ON(nat_rtp_rtcp_hook != NULL);
497 BUG_ON(nat_t120_hook != NULL); 571 BUG_ON(nat_t120_hook != NULL);
498 BUG_ON(nat_h245_hook != NULL); 572 BUG_ON(nat_h245_hook != NULL);
573 BUG_ON(nat_callforwarding_hook != NULL);
499 BUG_ON(nat_q931_hook != NULL); 574 BUG_ON(nat_q931_hook != NULL);
500 575
501 set_h245_addr_hook = set_h245_addr; 576 set_h245_addr_hook = set_h245_addr;
@@ -505,6 +580,7 @@ static int __init init(void)
505 nat_rtp_rtcp_hook = nat_rtp_rtcp; 580 nat_rtp_rtcp_hook = nat_rtp_rtcp;
506 nat_t120_hook = nat_t120; 581 nat_t120_hook = nat_t120;
507 nat_h245_hook = nat_h245; 582 nat_h245_hook = nat_h245;
583 nat_callforwarding_hook = nat_callforwarding;
508 nat_q931_hook = nat_q931; 584 nat_q931_hook = nat_q931;
509 585
510 DEBUGP("ip_nat_h323: init success\n"); 586 DEBUGP("ip_nat_h323: init success\n");
@@ -521,6 +597,7 @@ static void __exit fini(void)
521 nat_rtp_rtcp_hook = NULL; 597 nat_rtp_rtcp_hook = NULL;
522 nat_t120_hook = NULL; 598 nat_t120_hook = NULL;
523 nat_h245_hook = NULL; 599 nat_h245_hook = NULL;
600 nat_callforwarding_hook = NULL;
524 nat_q931_hook = NULL; 601 nat_q931_hook = NULL;
525 synchronize_net(); 602 synchronize_net();
526} 603}
diff --git a/net/ipv4/netfilter/ip_nat_sip.c b/net/ipv4/netfilter/ip_nat_sip.c
new file mode 100644
index 000000000000..6ffba63adca2
--- /dev/null
+++ b/net/ipv4/netfilter/ip_nat_sip.c
@@ -0,0 +1,249 @@
1/* SIP extension for UDP NAT alteration.
2 *
3 * (C) 2005 by Christian Hentschel <chentschel@arnet.com.ar>
4 * based on RR's ip_nat_ftp.c and other modules.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/module.h>
12#include <linux/skbuff.h>
13#include <linux/ip.h>
14#include <linux/udp.h>
15
16#include <linux/netfilter_ipv4.h>
17#include <linux/netfilter_ipv4/ip_nat.h>
18#include <linux/netfilter_ipv4/ip_nat_helper.h>
19#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
20#include <linux/netfilter_ipv4/ip_conntrack_sip.h>
21
22MODULE_LICENSE("GPL");
23MODULE_AUTHOR("Christian Hentschel <chentschel@arnet.com.ar>");
24MODULE_DESCRIPTION("SIP NAT helper");
25
26#if 0
27#define DEBUGP printk
28#else
29#define DEBUGP(format, args...)
30#endif
31
32extern struct sip_header_nfo ct_sip_hdrs[];
33
34static unsigned int mangle_sip_packet(struct sk_buff **pskb,
35 enum ip_conntrack_info ctinfo,
36 struct ip_conntrack *ct,
37 const char **dptr, size_t dlen,
38 char *buffer, int bufflen,
39 struct sip_header_nfo *hnfo)
40{
41 unsigned int matchlen, matchoff;
42
43 if (ct_sip_get_info(*dptr, dlen, &matchoff, &matchlen, hnfo) <= 0)
44 return 0;
45
46 if (!ip_nat_mangle_udp_packet(pskb, ct, ctinfo,
47 matchoff, matchlen, buffer, bufflen))
48 return 0;
49
50 /* We need to reload this. Thanks Patrick. */
51 *dptr = (*pskb)->data + (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr);
52 return 1;
53}
54
55static unsigned int ip_nat_sip(struct sk_buff **pskb,
56 enum ip_conntrack_info ctinfo,
57 struct ip_conntrack *ct,
58 const char **dptr)
59{
60 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
61 char buffer[sizeof("nnn.nnn.nnn.nnn:nnnnn")];
62 unsigned int bufflen, dataoff;
63 u_int32_t ip;
64 u_int16_t port;
65
66 dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr);
67
68 ip = ct->tuplehash[!dir].tuple.dst.ip;
69 port = ct->tuplehash[!dir].tuple.dst.u.udp.port;
70 bufflen = sprintf(buffer, "%u.%u.%u.%u:%u", NIPQUAD(ip), ntohs(port));
71
72 /* short packet ? */
73 if (((*pskb)->len - dataoff) < (sizeof("SIP/2.0") - 1))
74 return 0;
75
76 /* Basic rules: requests and responses. */
77 if (memcmp(*dptr, "SIP/2.0", sizeof("SIP/2.0") - 1) == 0) {
78 const char *aux;
79
80 if ((ctinfo) < IP_CT_IS_REPLY) {
81 mangle_sip_packet(pskb, ctinfo, ct, dptr,
82 (*pskb)->len - dataoff,
83 buffer, bufflen,
84 &ct_sip_hdrs[POS_CONTACT]);
85 return 1;
86 }
87
88 if (!mangle_sip_packet(pskb, ctinfo, ct, dptr,
89 (*pskb)->len - dataoff,
90 buffer, bufflen, &ct_sip_hdrs[POS_VIA]))
91 return 0;
92
93 /* This search should ignore case, but later.. */
94 aux = ct_sip_search("CSeq:", *dptr, sizeof("CSeq:") - 1,
95 (*pskb)->len - dataoff);
96 if (!aux)
97 return 0;
98
99 if (!ct_sip_search("REGISTER", aux, sizeof("REGISTER"),
100 ct_sip_lnlen(aux, *dptr + (*pskb)->len - dataoff)))
101 return 1;
102
103 return mangle_sip_packet(pskb, ctinfo, ct, dptr,
104 (*pskb)->len - dataoff,
105 buffer, bufflen,
106 &ct_sip_hdrs[POS_CONTACT]);
107 }
108 if ((ctinfo) < IP_CT_IS_REPLY) {
109 if (!mangle_sip_packet(pskb, ctinfo, ct, dptr,
110 (*pskb)->len - dataoff,
111 buffer, bufflen, &ct_sip_hdrs[POS_VIA]))
112 return 0;
113
114 /* Mangle Contact if exists only. - watch udp_nat_mangle()! */
115 mangle_sip_packet(pskb, ctinfo, ct, dptr, (*pskb)->len - dataoff,
116 buffer, bufflen, &ct_sip_hdrs[POS_CONTACT]);
117 return 1;
118 }
119 /* This mangle requests headers. */
120 return mangle_sip_packet(pskb, ctinfo, ct, dptr,
121 ct_sip_lnlen(*dptr,
122 *dptr + (*pskb)->len - dataoff),
123 buffer, bufflen, &ct_sip_hdrs[POS_REQ_HEADER]);
124}
125
126static int mangle_content_len(struct sk_buff **pskb,
127 enum ip_conntrack_info ctinfo,
128 struct ip_conntrack *ct,
129 const char *dptr)
130{
131 unsigned int dataoff, matchoff, matchlen;
132 char buffer[sizeof("65536")];
133 int bufflen;
134
135 dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr);
136
137 /* Get actual SDP lenght */
138 if (ct_sip_get_info(dptr, (*pskb)->len - dataoff, &matchoff,
139 &matchlen, &ct_sip_hdrs[POS_SDP_HEADER]) > 0) {
140
141 /* since ct_sip_get_info() give us a pointer passing 'v='
142 we need to add 2 bytes in this count. */
143 int c_len = (*pskb)->len - dataoff - matchoff + 2;
144
145 /* Now, update SDP lenght */
146 if (ct_sip_get_info(dptr, (*pskb)->len - dataoff, &matchoff,
147 &matchlen, &ct_sip_hdrs[POS_CONTENT]) > 0) {
148
149 bufflen = sprintf(buffer, "%u", c_len);
150
151 return ip_nat_mangle_udp_packet(pskb, ct, ctinfo,
152 matchoff, matchlen,
153 buffer, bufflen);
154 }
155 }
156 return 0;
157}
158
159static unsigned int mangle_sdp(struct sk_buff **pskb,
160 enum ip_conntrack_info ctinfo,
161 struct ip_conntrack *ct,
162 u_int32_t newip, u_int16_t port,
163 const char *dptr)
164{
165 char buffer[sizeof("nnn.nnn.nnn.nnn")];
166 unsigned int dataoff, bufflen;
167
168 dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr);
169
170 /* Mangle owner and contact info. */
171 bufflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(newip));
172 if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff,
173 buffer, bufflen, &ct_sip_hdrs[POS_OWNER]))
174 return 0;
175
176 if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff,
177 buffer, bufflen, &ct_sip_hdrs[POS_CONNECTION]))
178 return 0;
179
180 /* Mangle media port. */
181 bufflen = sprintf(buffer, "%u", port);
182 if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff,
183 buffer, bufflen, &ct_sip_hdrs[POS_MEDIA]))
184 return 0;
185
186 return mangle_content_len(pskb, ctinfo, ct, dptr);
187}
188
189/* So, this packet has hit the connection tracking matching code.
190 Mangle it, and change the expectation to match the new version. */
191static unsigned int ip_nat_sdp(struct sk_buff **pskb,
192 enum ip_conntrack_info ctinfo,
193 struct ip_conntrack_expect *exp,
194 const char *dptr)
195{
196 struct ip_conntrack *ct = exp->master;
197 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
198 u_int32_t newip;
199 u_int16_t port;
200
201 DEBUGP("ip_nat_sdp():\n");
202
203 /* Connection will come from reply */
204 newip = ct->tuplehash[!dir].tuple.dst.ip;
205
206 exp->tuple.dst.ip = newip;
207 exp->saved_proto.udp.port = exp->tuple.dst.u.udp.port;
208 exp->dir = !dir;
209
210 /* When you see the packet, we need to NAT it the same as the
211 this one. */
212 exp->expectfn = ip_nat_follow_master;
213
214 /* Try to get same port: if not, try to change it. */
215 for (port = ntohs(exp->saved_proto.udp.port); port != 0; port++) {
216 exp->tuple.dst.u.udp.port = htons(port);
217 if (ip_conntrack_expect_related(exp) == 0)
218 break;
219 }
220
221 if (port == 0)
222 return NF_DROP;
223
224 if (!mangle_sdp(pskb, ctinfo, ct, newip, port, dptr)) {
225 ip_conntrack_unexpect_related(exp);
226 return NF_DROP;
227 }
228 return NF_ACCEPT;
229}
230
231static void __exit fini(void)
232{
233 ip_nat_sip_hook = NULL;
234 ip_nat_sdp_hook = NULL;
235 /* Make sure noone calls it, meanwhile. */
236 synchronize_net();
237}
238
239static int __init init(void)
240{
241 BUG_ON(ip_nat_sip_hook);
242 BUG_ON(ip_nat_sdp_hook);
243 ip_nat_sip_hook = ip_nat_sip;
244 ip_nat_sdp_hook = ip_nat_sdp;
245 return 0;
246}
247
248module_init(init);
249module_exit(fini);
diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c
index c33244263b90..d20d557f915a 100644
--- a/net/ipv4/netfilter/ip_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c
@@ -1348,4 +1348,4 @@ static void __exit ip_nat_snmp_basic_fini(void)
1348module_init(ip_nat_snmp_basic_init); 1348module_init(ip_nat_snmp_basic_init);
1349module_exit(ip_nat_snmp_basic_fini); 1349module_exit(ip_nat_snmp_basic_fini);
1350 1350
1351module_param(debug, bool, 0600); 1351module_param(debug, int, 0600);
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index aad9d28c8d71..dbc83c5d7aa6 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -241,25 +241,17 @@ clusterip_hashfn(struct sk_buff *skb, struct clusterip_config *config)
241 struct iphdr *iph = skb->nh.iph; 241 struct iphdr *iph = skb->nh.iph;
242 unsigned long hashval; 242 unsigned long hashval;
243 u_int16_t sport, dport; 243 u_int16_t sport, dport;
244 struct tcphdr *th; 244 u_int16_t *ports;
245 struct udphdr *uh;
246 struct icmphdr *ih;
247 245
248 switch (iph->protocol) { 246 switch (iph->protocol) {
249 case IPPROTO_TCP: 247 case IPPROTO_TCP:
250 th = (void *)iph+iph->ihl*4;
251 sport = ntohs(th->source);
252 dport = ntohs(th->dest);
253 break;
254 case IPPROTO_UDP: 248 case IPPROTO_UDP:
255 uh = (void *)iph+iph->ihl*4; 249 case IPPROTO_SCTP:
256 sport = ntohs(uh->source); 250 case IPPROTO_DCCP:
257 dport = ntohs(uh->dest);
258 break;
259 case IPPROTO_ICMP: 251 case IPPROTO_ICMP:
260 ih = (void *)iph+iph->ihl*4; 252 ports = (void *)iph+iph->ihl*4;
261 sport = ntohs(ih->un.echo.id); 253 sport = ports[0];
262 dport = (ih->type<<8)|ih->code; 254 dport = ports[1];
263 break; 255 break;
264 default: 256 default:
265 if (net_ratelimit()) { 257 if (net_ratelimit()) {
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
index 0bba3c2bb786..431a3ce6f7b7 100644
--- a/net/ipv4/netfilter/ipt_REJECT.c
+++ b/net/ipv4/netfilter/ipt_REJECT.c
@@ -147,6 +147,7 @@ static void send_reset(struct sk_buff *oldskb, int hook)
147 /* This packet will not be the same as the other: clear nf fields */ 147 /* This packet will not be the same as the other: clear nf fields */
148 nf_reset(nskb); 148 nf_reset(nskb);
149 nskb->nfmark = 0; 149 nskb->nfmark = 0;
150 skb_init_secmark(nskb);
150 151
151 tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl); 152 tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl);
152 153
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c
index 7c6836c4646e..92980ab8ce48 100644
--- a/net/ipv4/netfilter/ipt_hashlimit.c
+++ b/net/ipv4/netfilter/ipt_hashlimit.c
@@ -28,9 +28,6 @@
28#include <linux/jhash.h> 28#include <linux/jhash.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/vmalloc.h> 30#include <linux/vmalloc.h>
31#include <linux/tcp.h>
32#include <linux/udp.h>
33#include <linux/sctp.h>
34#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
35#include <linux/seq_file.h> 32#include <linux/seq_file.h>
36#include <linux/list.h> 33#include <linux/list.h>
@@ -83,6 +80,7 @@ struct ipt_hashlimit_htable {
83 /* used internally */ 80 /* used internally */
84 spinlock_t lock; /* lock for list_head */ 81 spinlock_t lock; /* lock for list_head */
85 u_int32_t rnd; /* random seed for hash */ 82 u_int32_t rnd; /* random seed for hash */
83 int rnd_initialized;
86 struct timer_list timer; /* timer for gc */ 84 struct timer_list timer; /* timer for gc */
87 atomic_t count; /* number entries in table */ 85 atomic_t count; /* number entries in table */
88 86
@@ -137,8 +135,10 @@ __dsthash_alloc_init(struct ipt_hashlimit_htable *ht, struct dsthash_dst *dst)
137 135
138 /* initialize hash with random val at the time we allocate 136 /* initialize hash with random val at the time we allocate
139 * the first hashtable entry */ 137 * the first hashtable entry */
140 if (!ht->rnd) 138 if (!ht->rnd_initialized) {
141 get_random_bytes(&ht->rnd, 4); 139 get_random_bytes(&ht->rnd, 4);
140 ht->rnd_initialized = 1;
141 }
142 142
143 if (ht->cfg.max && 143 if (ht->cfg.max &&
144 atomic_read(&ht->count) >= ht->cfg.max) { 144 atomic_read(&ht->count) >= ht->cfg.max) {
@@ -217,7 +217,7 @@ static int htable_create(struct ipt_hashlimit_info *minfo)
217 217
218 atomic_set(&hinfo->count, 0); 218 atomic_set(&hinfo->count, 0);
219 atomic_set(&hinfo->use, 1); 219 atomic_set(&hinfo->use, 1);
220 hinfo->rnd = 0; 220 hinfo->rnd_initialized = 0;
221 spin_lock_init(&hinfo->lock); 221 spin_lock_init(&hinfo->lock);
222 hinfo->pde = create_proc_entry(minfo->name, 0, hashlimit_procdir); 222 hinfo->pde = create_proc_entry(minfo->name, 0, hashlimit_procdir);
223 if (!hinfo->pde) { 223 if (!hinfo->pde) {
@@ -381,49 +381,6 @@ static inline void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now)
381 dh->rateinfo.credit = dh->rateinfo.credit_cap; 381 dh->rateinfo.credit = dh->rateinfo.credit_cap;
382} 382}
383 383
384static inline int get_ports(const struct sk_buff *skb, int offset,
385 u16 ports[2])
386{
387 union {
388 struct tcphdr th;
389 struct udphdr uh;
390 sctp_sctphdr_t sctph;
391 } hdr_u, *ptr_u;
392
393 /* Must not be a fragment. */
394 if (offset)
395 return 1;
396
397 /* Must be big enough to read ports (both UDP and TCP have
398 them at the start). */
399 ptr_u = skb_header_pointer(skb, skb->nh.iph->ihl*4, 8, &hdr_u);
400 if (!ptr_u)
401 return 1;
402
403 switch (skb->nh.iph->protocol) {
404 case IPPROTO_TCP:
405 ports[0] = ptr_u->th.source;
406 ports[1] = ptr_u->th.dest;
407 break;
408 case IPPROTO_UDP:
409 ports[0] = ptr_u->uh.source;
410 ports[1] = ptr_u->uh.dest;
411 break;
412 case IPPROTO_SCTP:
413 ports[0] = ptr_u->sctph.source;
414 ports[1] = ptr_u->sctph.dest;
415 break;
416 default:
417 /* all other protocols don't supprot per-port hash
418 * buckets */
419 ports[0] = ports[1] = 0;
420 break;
421 }
422
423 return 0;
424}
425
426
427static int 384static int
428hashlimit_match(const struct sk_buff *skb, 385hashlimit_match(const struct sk_buff *skb,
429 const struct net_device *in, 386 const struct net_device *in,
@@ -449,8 +406,22 @@ hashlimit_match(const struct sk_buff *skb,
449 dst.src_ip = skb->nh.iph->saddr; 406 dst.src_ip = skb->nh.iph->saddr;
450 if (hinfo->cfg.mode & IPT_HASHLIMIT_HASH_DPT 407 if (hinfo->cfg.mode & IPT_HASHLIMIT_HASH_DPT
451 ||hinfo->cfg.mode & IPT_HASHLIMIT_HASH_SPT) { 408 ||hinfo->cfg.mode & IPT_HASHLIMIT_HASH_SPT) {
452 u_int16_t ports[2]; 409 u_int16_t _ports[2], *ports;
453 if (get_ports(skb, offset, ports)) { 410
411 switch (skb->nh.iph->protocol) {
412 case IPPROTO_TCP:
413 case IPPROTO_UDP:
414 case IPPROTO_SCTP:
415 case IPPROTO_DCCP:
416 ports = skb_header_pointer(skb, skb->nh.iph->ihl*4,
417 sizeof(_ports), &_ports);
418 break;
419 default:
420 _ports[0] = _ports[1] = 0;
421 ports = _ports;
422 break;
423 }
424 if (!ports) {
454 /* We've been asked to examine this packet, and we 425 /* We've been asked to examine this packet, and we
455 can't. Hence, no choice but to drop. */ 426 can't. Hence, no choice but to drop. */
456 *hotdrop = 1; 427 *hotdrop = 1;
@@ -561,7 +532,7 @@ static void
561hashlimit_destroy(const struct xt_match *match, void *matchinfo, 532hashlimit_destroy(const struct xt_match *match, void *matchinfo,
562 unsigned int matchsize) 533 unsigned int matchsize)
563{ 534{
564 struct ipt_hashlimit_info *r = (struct ipt_hashlimit_info *) matchinfo; 535 struct ipt_hashlimit_info *r = matchinfo;
565 536
566 htable_put(r->hinfo); 537 htable_put(r->hinfo);
567} 538}
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index b847ee409efb..61a2139f9cfd 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -1,1007 +1,499 @@
1/* Kernel module to check if the source address has been seen recently. */ 1/*
2/* Copyright 2002-2003, Stephen Frost, 2.5.x port by laforge@netfilter.org */ 2 * Copyright (c) 2006 Patrick McHardy <kaber@trash.net>
3/* Author: Stephen Frost <sfrost@snowman.net> */ 3 *
4/* Project Page: http://snowman.net/projects/ipt_recent/ */ 4 * This program is free software; you can redistribute it and/or modify
5/* This software is distributed under the terms of the GPL, Version 2 */ 5 * it under the terms of the GNU General Public License version 2 as
6/* This copyright does not cover user programs that use kernel services 6 * published by the Free Software Foundation.
7 * by normal system calls. */ 7 *
8 8 * This is a replacement of the old ipt_recent module, which carried the
9#include <linux/module.h> 9 * following copyright notice:
10#include <linux/skbuff.h> 10 *
11 * Author: Stephen Frost <sfrost@snowman.net>
12 * Copyright 2002-2003, Stephen Frost, 2.5.x port by laforge@netfilter.org
13 */
14#include <linux/init.h>
15#include <linux/moduleparam.h>
11#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
12#include <linux/spinlock.h> 17#include <linux/seq_file.h>
13#include <linux/interrupt.h> 18#include <linux/string.h>
14#include <asm/uaccess.h>
15#include <linux/ctype.h> 19#include <linux/ctype.h>
16#include <linux/ip.h> 20#include <linux/list.h>
17#include <linux/vmalloc.h> 21#include <linux/random.h>
18#include <linux/moduleparam.h> 22#include <linux/jhash.h>
23#include <linux/bitops.h>
24#include <linux/skbuff.h>
25#include <linux/inet.h>
19 26
20#include <linux/netfilter_ipv4/ip_tables.h> 27#include <linux/netfilter_ipv4/ip_tables.h>
21#include <linux/netfilter_ipv4/ipt_recent.h> 28#include <linux/netfilter_ipv4/ipt_recent.h>
22 29
23#undef DEBUG 30MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
24#define HASH_LOG 9 31MODULE_DESCRIPTION("IP tables recently seen matching module");
32MODULE_LICENSE("GPL");
25 33
26/* Defaults, these can be overridden on the module command-line. */
27static unsigned int ip_list_tot = 100; 34static unsigned int ip_list_tot = 100;
28static unsigned int ip_pkt_list_tot = 20; 35static unsigned int ip_pkt_list_tot = 20;
29static unsigned int ip_list_hash_size = 0; 36static unsigned int ip_list_hash_size = 0;
30static unsigned int ip_list_perms = 0644; 37static unsigned int ip_list_perms = 0644;
31#ifdef DEBUG
32static int debug = 1;
33#endif
34
35static char version[] =
36KERN_INFO RECENT_NAME " " RECENT_VER ": Stephen Frost <sfrost@snowman.net>. http://snowman.net/projects/ipt_recent/\n";
37
38MODULE_AUTHOR("Stephen Frost <sfrost@snowman.net>");
39MODULE_DESCRIPTION("IP tables recently seen matching module " RECENT_VER);
40MODULE_LICENSE("GPL");
41module_param(ip_list_tot, uint, 0400); 38module_param(ip_list_tot, uint, 0400);
42module_param(ip_pkt_list_tot, uint, 0400); 39module_param(ip_pkt_list_tot, uint, 0400);
43module_param(ip_list_hash_size, uint, 0400); 40module_param(ip_list_hash_size, uint, 0400);
44module_param(ip_list_perms, uint, 0400); 41module_param(ip_list_perms, uint, 0400);
45#ifdef DEBUG 42MODULE_PARM_DESC(ip_list_tot, "number of IPs to remember per list");
46module_param(debug, bool, 0600); 43MODULE_PARM_DESC(ip_pkt_list_tot, "number of packets per IP to remember (max. 255)");
47MODULE_PARM_DESC(debug,"enable debugging output"); 44MODULE_PARM_DESC(ip_list_hash_size, "size of hash table used to look up IPs");
48#endif 45MODULE_PARM_DESC(ip_list_perms, "permissions on /proc/net/ipt_recent/* files");
49MODULE_PARM_DESC(ip_list_tot,"number of IPs to remember per list"); 46
50MODULE_PARM_DESC(ip_pkt_list_tot,"number of packets per IP to remember"); 47
51MODULE_PARM_DESC(ip_list_hash_size,"size of hash table used to look up IPs"); 48struct recent_entry {
52MODULE_PARM_DESC(ip_list_perms,"permissions on /proc/net/ipt_recent/* files"); 49 struct list_head list;
53 50 struct list_head lru_list;
54/* Structure of our list of recently seen addresses. */ 51 u_int32_t addr;
55struct recent_ip_list { 52 u_int8_t ttl;
56 u_int32_t addr; 53 u_int8_t index;
57 u_int8_t ttl; 54 u_int16_t nstamps;
58 unsigned long last_seen; 55 unsigned long stamps[0];
59 unsigned long *last_pkts;
60 u_int32_t oldest_pkt;
61 u_int32_t hash_entry;
62 u_int32_t time_pos;
63};
64
65struct time_info_list {
66 u_int32_t position;
67 u_int32_t time;
68}; 56};
69 57
70/* Structure of our linked list of tables of recent lists. */ 58struct recent_table {
71struct recent_ip_tables { 59 struct list_head list;
72 char name[IPT_RECENT_NAME_LEN]; 60 char name[IPT_RECENT_NAME_LEN];
73 int count;
74 int time_pos;
75 struct recent_ip_list *table;
76 struct recent_ip_tables *next;
77 spinlock_t list_lock;
78 int *hash_table;
79 struct time_info_list *time_info;
80#ifdef CONFIG_PROC_FS 61#ifdef CONFIG_PROC_FS
81 struct proc_dir_entry *status_proc; 62 struct proc_dir_entry *proc;
82#endif /* CONFIG_PROC_FS */ 63#endif
64 unsigned int refcnt;
65 unsigned int entries;
66 struct list_head lru_list;
67 struct list_head iphash[0];
83}; 68};
84 69
85/* Our current list of addresses we have recently seen. 70static LIST_HEAD(tables);
86 * Only added to on a --set, and only updated on --set || --update
87 */
88static struct recent_ip_tables *r_tables = NULL;
89
90/* We protect r_list with this spinlock so two processors are not modifying
91 * the list at the same time.
92 */
93static DEFINE_SPINLOCK(recent_lock); 71static DEFINE_SPINLOCK(recent_lock);
72static DEFINE_MUTEX(recent_mutex);
94 73
95#ifdef CONFIG_PROC_FS 74#ifdef CONFIG_PROC_FS
96/* Our /proc/net/ipt_recent entry */ 75static struct proc_dir_entry *proc_dir;
97static struct proc_dir_entry *proc_net_ipt_recent = NULL; 76static struct file_operations recent_fops;
98#endif
99
100/* Function declaration for later. */
101static int
102match(const struct sk_buff *skb,
103 const struct net_device *in,
104 const struct net_device *out,
105 const struct xt_match *match,
106 const void *matchinfo,
107 int offset,
108 unsigned int protoff,
109 int *hotdrop);
110
111/* Function to hash a given address into the hash table of table_size size */
112static int hash_func(unsigned int addr, int table_size)
113{
114 int result = 0;
115 unsigned int value = addr;
116 do { result ^= value; } while((value >>= HASH_LOG));
117
118#ifdef DEBUG
119 if(debug) printk(KERN_INFO RECENT_NAME ": %d = hash_func(%u,%d)\n",
120 result & (table_size - 1),
121 addr,
122 table_size);
123#endif 77#endif
124 78
125 return(result & (table_size - 1)); 79static u_int32_t hash_rnd;
126} 80static int hash_rnd_initted;
127 81
128#ifdef CONFIG_PROC_FS 82static unsigned int recent_entry_hash(u_int32_t addr)
129/* This is the function which produces the output for our /proc output
130 * interface which lists each IP address, the last seen time and the
131 * other recent times the address was seen.
132 */
133
134static int ip_recent_get_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
135{ 83{
136 int len = 0, count, last_len = 0, pkt_count; 84 if (!hash_rnd_initted) {
137 off_t pos = 0; 85 get_random_bytes(&hash_rnd, 4);
138 off_t begin = 0; 86 hash_rnd_initted = 1;
139 struct recent_ip_tables *curr_table;
140
141 curr_table = (struct recent_ip_tables*) data;
142
143 spin_lock_bh(&curr_table->list_lock);
144 for(count = 0; count < ip_list_tot; count++) {
145 if(!curr_table->table[count].addr) continue;
146 last_len = len;
147 len += sprintf(buffer+len,"src=%u.%u.%u.%u ",NIPQUAD(curr_table->table[count].addr));
148 len += sprintf(buffer+len,"ttl: %u ",curr_table->table[count].ttl);
149 len += sprintf(buffer+len,"last_seen: %lu ",curr_table->table[count].last_seen);
150 len += sprintf(buffer+len,"oldest_pkt: %u ",curr_table->table[count].oldest_pkt);
151 len += sprintf(buffer+len,"last_pkts: %lu",curr_table->table[count].last_pkts[0]);
152 for(pkt_count = 1; pkt_count < ip_pkt_list_tot; pkt_count++) {
153 if(!curr_table->table[count].last_pkts[pkt_count]) break;
154 len += sprintf(buffer+len,", %lu",curr_table->table[count].last_pkts[pkt_count]);
155 }
156 len += sprintf(buffer+len,"\n");
157 pos = begin + len;
158 if(pos < offset) { len = 0; begin = pos; }
159 if(pos > offset + length) { len = last_len; break; }
160 } 87 }
161 88 return jhash_1word(addr, hash_rnd) & (ip_list_hash_size - 1);
162 *start = buffer + (offset - begin);
163 len -= (offset - begin);
164 if(len > length) len = length;
165
166 spin_unlock_bh(&curr_table->list_lock);
167 return len;
168} 89}
169 90
170/* ip_recent_ctrl provides an interface for users to modify the table 91static struct recent_entry *
171 * directly. This allows adding entries, removing entries, and 92recent_entry_lookup(const struct recent_table *table, u_int32_t addr, u_int8_t ttl)
172 * flushing the entire table.
173 * This is done by opening up the appropriate table for writing and
174 * sending one of:
175 * xx.xx.xx.xx -- Add entry to table with current time
176 * +xx.xx.xx.xx -- Add entry to table with current time
177 * -xx.xx.xx.xx -- Remove entry from table
178 * clear -- Flush table, remove all entries
179 */
180
181static int ip_recent_ctrl(struct file *file, const char __user *input, unsigned long size, void *data)
182{ 93{
183 static const u_int32_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff }; 94 struct recent_entry *e;
184 u_int32_t val; 95 unsigned int h;
185 int base, used = 0; 96
186 char c, *cp; 97 h = recent_entry_hash(addr);
187 union iaddr { 98 list_for_each_entry(e, &table->iphash[h], list)
188 uint8_t bytes[4]; 99 if (e->addr == addr && (ttl == e->ttl || !ttl || !e->ttl))
189 uint32_t word; 100 return e;
190 } res; 101 return NULL;
191 uint8_t *pp = res.bytes; 102}
192 int digit;
193
194 char buffer[20];
195 int len, check_set = 0, count;
196 u_int32_t addr = 0;
197 struct sk_buff *skb;
198 struct ipt_recent_info *info;
199 struct recent_ip_tables *curr_table;
200
201 curr_table = (struct recent_ip_tables*) data;
202
203 if(size > 20) len = 20; else len = size;
204
205 if(copy_from_user(buffer,input,len)) return -EFAULT;
206
207 if(len < 20) buffer[len] = '\0';
208
209#ifdef DEBUG
210 if(debug) printk(KERN_INFO RECENT_NAME ": ip_recent_ctrl len: %d, input: `%.20s'\n",len,buffer);
211#endif
212 103
213 cp = buffer; 104static void recent_entry_remove(struct recent_table *t, struct recent_entry *e)
214 while(isspace(*cp)) { cp++; used++; if(used >= len-5) return used; } 105{
106 list_del(&e->list);
107 list_del(&e->lru_list);
108 kfree(e);
109 t->entries--;
110}
215 111
216 /* Check if we are asked to flush the entire table */ 112static struct recent_entry *
217 if(!memcmp(cp,"clear",5)) { 113recent_entry_init(struct recent_table *t, u_int32_t addr, u_int8_t ttl)
218 used += 5; 114{
219 spin_lock_bh(&curr_table->list_lock); 115 struct recent_entry *e;
220 curr_table->time_pos = 0;
221 for(count = 0; count < ip_list_hash_size; count++) {
222 curr_table->hash_table[count] = -1;
223 }
224 for(count = 0; count < ip_list_tot; count++) {
225 curr_table->table[count].last_seen = 0;
226 curr_table->table[count].addr = 0;
227 curr_table->table[count].ttl = 0;
228 memset(curr_table->table[count].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long));
229 curr_table->table[count].oldest_pkt = 0;
230 curr_table->table[count].time_pos = 0;
231 curr_table->time_info[count].position = count;
232 curr_table->time_info[count].time = 0;
233 }
234 spin_unlock_bh(&curr_table->list_lock);
235 return used;
236 }
237 116
238 check_set = IPT_RECENT_SET; 117 if (t->entries >= ip_list_tot) {
239 switch(*cp) { 118 e = list_entry(t->lru_list.next, struct recent_entry, lru_list);
240 case '+': check_set = IPT_RECENT_SET; cp++; used++; break; 119 recent_entry_remove(t, e);
241 case '-': check_set = IPT_RECENT_REMOVE; cp++; used++; break;
242 default: if(!isdigit(*cp)) return (used+1); break;
243 } 120 }
121 e = kmalloc(sizeof(*e) + sizeof(e->stamps[0]) * ip_pkt_list_tot,
122 GFP_ATOMIC);
123 if (e == NULL)
124 return NULL;
125 e->addr = addr;
126 e->ttl = ttl;
127 e->stamps[0] = jiffies;
128 e->nstamps = 1;
129 e->index = 1;
130 list_add_tail(&e->list, &t->iphash[recent_entry_hash(addr)]);
131 list_add_tail(&e->lru_list, &t->lru_list);
132 t->entries++;
133 return e;
134}
244 135
245#ifdef DEBUG 136static void recent_entry_update(struct recent_table *t, struct recent_entry *e)
246 if(debug) printk(KERN_INFO RECENT_NAME ": ip_recent_ctrl cp: `%c', check_set: %d\n",*cp,check_set); 137{
247#endif 138 e->stamps[e->index++] = jiffies;
248 /* Get addr (effectively inet_aton()) */ 139 if (e->index > e->nstamps)
249 /* Shamelessly stolen from libc, a function in the kernel for doing 140 e->nstamps = e->index;
250 * this would, of course, be greatly preferred, but our options appear 141 e->index %= ip_pkt_list_tot;
251 * to be rather limited, so we will just do it ourselves here. 142 list_move_tail(&e->lru_list, &t->lru_list);
252 */ 143}
253 res.word = 0;
254
255 c = *cp;
256 for(;;) {
257 if(!isdigit(c)) return used;
258 val = 0; base = 10; digit = 0;
259 if(c == '0') {
260 c = *++cp;
261 if(c == 'x' || c == 'X') base = 16, c = *++cp;
262 else { base = 8; digit = 1; }
263 }
264 for(;;) {
265 if(isascii(c) && isdigit(c)) {
266 if(base == 8 && (c == '8' || c == '0')) return used;
267 val = (val * base) + (c - '0');
268 c = *++cp;
269 digit = 1;
270 } else if(base == 16 && isascii(c) && isxdigit(c)) {
271 val = (val << 4) | (c + 10 - (islower(c) ? 'a' : 'A'));
272 c = *++cp;
273 digit = 1;
274 } else break;
275 }
276 if(c == '.') {
277 if(pp > res.bytes + 2 || val > 0xff) return used;
278 *pp++ = val;
279 c = *++cp;
280 } else break;
281 }
282 used = cp - buffer;
283 if(c != '\0' && (!isascii(c) || !isspace(c))) return used;
284 if(c == '\n') used++;
285 if(!digit) return used;
286 144
287 if(val > max[pp - res.bytes]) return used; 145static struct recent_table *recent_table_lookup(const char *name)
288 addr = res.word | htonl(val); 146{
147 struct recent_table *t;
289 148
290 if(!addr && check_set == IPT_RECENT_SET) return used; 149 list_for_each_entry(t, &tables, list)
150 if (!strcmp(t->name, name))
151 return t;
152 return NULL;
153}
291 154
292#ifdef DEBUG 155static void recent_table_flush(struct recent_table *t)
293 if(debug) printk(KERN_INFO RECENT_NAME ": ip_recent_ctrl c: %c, addr: %u used: %d\n",c,addr,used); 156{
294#endif 157 struct recent_entry *e, *next;
158 unsigned int i;
295 159
296 /* Set up and just call match */ 160 for (i = 0; i < ip_list_hash_size; i++) {
297 info = kmalloc(sizeof(struct ipt_recent_info),GFP_KERNEL); 161 list_for_each_entry_safe(e, next, &t->iphash[i], list)
298 if(!info) { return -ENOMEM; } 162 recent_entry_remove(t, e);
299 info->seconds = 0;
300 info->hit_count = 0;
301 info->check_set = check_set;
302 info->invert = 0;
303 info->side = IPT_RECENT_SOURCE;
304 strncpy(info->name,curr_table->name,IPT_RECENT_NAME_LEN);
305 info->name[IPT_RECENT_NAME_LEN-1] = '\0';
306
307 skb = kmalloc(sizeof(struct sk_buff),GFP_KERNEL);
308 if (!skb) {
309 used = -ENOMEM;
310 goto out_free_info;
311 }
312 skb->nh.iph = kmalloc(sizeof(struct iphdr),GFP_KERNEL);
313 if (!skb->nh.iph) {
314 used = -ENOMEM;
315 goto out_free_skb;
316 } 163 }
317
318 skb->nh.iph->saddr = addr;
319 skb->nh.iph->daddr = 0;
320 /* Clear ttl since we have no way of knowing it */
321 skb->nh.iph->ttl = 0;
322 match(skb,NULL,NULL,NULL,info,0,0,NULL);
323
324 kfree(skb->nh.iph);
325out_free_skb:
326 kfree(skb);
327out_free_info:
328 kfree(info);
329
330#ifdef DEBUG
331 if(debug) printk(KERN_INFO RECENT_NAME ": Leaving ip_recent_ctrl addr: %u used: %d\n",addr,used);
332#endif
333 return used;
334} 164}
335 165
336#endif /* CONFIG_PROC_FS */
337
338/* 'match' is our primary function, called by the kernel whenever a rule is
339 * hit with our module as an option to it.
340 * What this function does depends on what was specifically asked of it by
341 * the user:
342 * --set -- Add or update last seen time of the source address of the packet
343 * -- matchinfo->check_set == IPT_RECENT_SET
344 * --rcheck -- Just check if the source address is in the list
345 * -- matchinfo->check_set == IPT_RECENT_CHECK
346 * --update -- If the source address is in the list, update last_seen
347 * -- matchinfo->check_set == IPT_RECENT_UPDATE
348 * --remove -- If the source address is in the list, remove it
349 * -- matchinfo->check_set == IPT_RECENT_REMOVE
350 * --seconds -- Option to --rcheck/--update, only match if last_seen within seconds
351 * -- matchinfo->seconds
352 * --hitcount -- Option to --rcheck/--update, only match if seen hitcount times
353 * -- matchinfo->hit_count
354 * --seconds and --hitcount can be combined
355 */
356static int 166static int
357match(const struct sk_buff *skb, 167ipt_recent_match(const struct sk_buff *skb,
358 const struct net_device *in, 168 const struct net_device *in, const struct net_device *out,
359 const struct net_device *out, 169 const struct xt_match *match, const void *matchinfo,
360 const struct xt_match *match, 170 int offset, unsigned int protoff, int *hotdrop)
361 const void *matchinfo,
362 int offset,
363 unsigned int protoff,
364 int *hotdrop)
365{ 171{
366 int pkt_count, hits_found, ans;
367 unsigned long now;
368 const struct ipt_recent_info *info = matchinfo; 172 const struct ipt_recent_info *info = matchinfo;
369 u_int32_t addr = 0, time_temp; 173 struct recent_table *t;
370 u_int8_t ttl = skb->nh.iph->ttl; 174 struct recent_entry *e;
371 int *hash_table; 175 u_int32_t addr;
372 int orig_hash_result, hash_result, temp, location = 0, time_loc, end_collision_chain = -1; 176 u_int8_t ttl;
373 struct time_info_list *time_info; 177 int ret = info->invert;
374 struct recent_ip_tables *curr_table;
375 struct recent_ip_tables *last_table;
376 struct recent_ip_list *r_list;
377
378#ifdef DEBUG
379 if(debug) printk(KERN_INFO RECENT_NAME ": match() called\n");
380#endif
381
382 /* Default is false ^ info->invert */
383 ans = info->invert;
384 178
385#ifdef DEBUG 179 if (info->side == IPT_RECENT_DEST)
386 if(debug) printk(KERN_INFO RECENT_NAME ": match(): name = '%s'\n",info->name); 180 addr = skb->nh.iph->daddr;
387#endif 181 else
182 addr = skb->nh.iph->saddr;
388 183
389 /* if out != NULL then routing has been done and TTL changed. 184 ttl = skb->nh.iph->ttl;
390 * We change it back here internally for match what came in before routing. */ 185 /* use TTL as seen before forwarding */
391 if(out) ttl++; 186 if (out && !skb->sk)
187 ttl++;
392 188
393 /* Find the right table */
394 spin_lock_bh(&recent_lock); 189 spin_lock_bh(&recent_lock);
395 curr_table = r_tables; 190 t = recent_table_lookup(info->name);
396 while( (last_table = curr_table) && strncmp(info->name,curr_table->name,IPT_RECENT_NAME_LEN) && (curr_table = curr_table->next) ); 191 e = recent_entry_lookup(t, addr,
397 192 info->check_set & IPT_RECENT_TTL ? ttl : 0);
398#ifdef DEBUG 193 if (e == NULL) {
399 if(debug) printk(KERN_INFO RECENT_NAME ": match(): table found('%s')\n",info->name); 194 if (!(info->check_set & IPT_RECENT_SET))
400#endif 195 goto out;
401 196 e = recent_entry_init(t, addr, ttl);
402 spin_unlock_bh(&recent_lock); 197 if (e == NULL)
403 198 *hotdrop = 1;
404 /* Table with this name not found, match impossible */ 199 ret ^= 1;
405 if(!curr_table) { return ans; } 200 goto out;
406
407 /* Make sure no one is changing the list while we work with it */
408 spin_lock_bh(&curr_table->list_lock);
409
410 r_list = curr_table->table;
411 if(info->side == IPT_RECENT_DEST) addr = skb->nh.iph->daddr; else addr = skb->nh.iph->saddr;
412
413 if(!addr) {
414#ifdef DEBUG
415 if(debug) printk(KERN_INFO RECENT_NAME ": match() address (%u) invalid, leaving.\n",addr);
416#endif
417 spin_unlock_bh(&curr_table->list_lock);
418 return ans;
419 }
420
421#ifdef DEBUG
422 if(debug) printk(KERN_INFO RECENT_NAME ": match(): checking table, addr: %u, ttl: %u, orig_ttl: %u\n",addr,ttl,skb->nh.iph->ttl);
423#endif
424
425 /* Get jiffies now in case they changed while we were waiting for a lock */
426 now = jiffies;
427 hash_table = curr_table->hash_table;
428 time_info = curr_table->time_info;
429
430 orig_hash_result = hash_result = hash_func(addr,ip_list_hash_size);
431 /* Hash entry at this result used */
432 /* Check for TTL match if requested. If TTL is zero then a match would never
433 * happen, so match regardless of existing TTL in that case. Zero means the
434 * entry was added via the /proc interface anyway, so we will just use the
435 * first TTL we get for that IP address. */
436 if(info->check_set & IPT_RECENT_TTL) {
437 while(hash_table[hash_result] != -1 && !(r_list[hash_table[hash_result]].addr == addr &&
438 (!r_list[hash_table[hash_result]].ttl || r_list[hash_table[hash_result]].ttl == ttl))) {
439 /* Collision in hash table */
440 hash_result = (hash_result + 1) % ip_list_hash_size;
441 }
442 } else {
443 while(hash_table[hash_result] != -1 && r_list[hash_table[hash_result]].addr != addr) {
444 /* Collision in hash table */
445 hash_result = (hash_result + 1) % ip_list_hash_size;
446 }
447 }
448
449 if(hash_table[hash_result] == -1 && !(info->check_set & IPT_RECENT_SET)) {
450 /* IP not in list and not asked to SET */
451 spin_unlock_bh(&curr_table->list_lock);
452 return ans;
453 }
454
455 /* Check if we need to handle the collision, do not need to on REMOVE */
456 if(orig_hash_result != hash_result && !(info->check_set & IPT_RECENT_REMOVE)) {
457#ifdef DEBUG
458 if(debug) printk(KERN_INFO RECENT_NAME ": match(): Collision in hash table. (or: %d,hr: %d,oa: %u,ha: %u)\n",
459 orig_hash_result,
460 hash_result,
461 r_list[hash_table[orig_hash_result]].addr,
462 addr);
463#endif
464
465 /* We had a collision.
466 * orig_hash_result is where we started, hash_result is where we ended up.
467 * So, swap them because we are likely to see the same guy again sooner */
468#ifdef DEBUG
469 if(debug) {
470 printk(KERN_INFO RECENT_NAME ": match(): Collision; hash_table[orig_hash_result] = %d\n",hash_table[orig_hash_result]);
471 printk(KERN_INFO RECENT_NAME ": match(): Collision; r_list[hash_table[orig_hash_result]].hash_entry = %d\n",
472 r_list[hash_table[orig_hash_result]].hash_entry);
473 }
474#endif
475
476 r_list[hash_table[orig_hash_result]].hash_entry = hash_result;
477
478
479 temp = hash_table[orig_hash_result];
480#ifdef DEBUG
481 if(debug) printk(KERN_INFO RECENT_NAME ": match(): Collision; hash_table[hash_result] = %d\n",hash_table[hash_result]);
482#endif
483 hash_table[orig_hash_result] = hash_table[hash_result];
484 hash_table[hash_result] = temp;
485 temp = hash_result;
486 hash_result = orig_hash_result;
487 orig_hash_result = temp;
488 time_info[r_list[hash_table[orig_hash_result]].time_pos].position = hash_table[orig_hash_result];
489 if(hash_table[hash_result] != -1) {
490 r_list[hash_table[hash_result]].hash_entry = hash_result;
491 time_info[r_list[hash_table[hash_result]].time_pos].position = hash_table[hash_result];
492 }
493
494#ifdef DEBUG
495 if(debug) printk(KERN_INFO RECENT_NAME ": match(): Collision handled.\n");
496#endif
497 } 201 }
498 202
499 if(hash_table[hash_result] == -1) { 203 if (info->check_set & IPT_RECENT_SET)
500#ifdef DEBUG 204 ret ^= 1;
501 if(debug) printk(KERN_INFO RECENT_NAME ": match(): New table entry. (hr: %d,ha: %u)\n", 205 else if (info->check_set & IPT_RECENT_REMOVE) {
502 hash_result, addr); 206 recent_entry_remove(t, e);
503#endif 207 ret ^= 1;
504 208 } else if (info->check_set & (IPT_RECENT_CHECK | IPT_RECENT_UPDATE)) {
505 /* New item found and IPT_RECENT_SET, so we need to add it */ 209 unsigned long t = jiffies - info->seconds * HZ;
506 location = time_info[curr_table->time_pos].position; 210 unsigned int i, hits = 0;
507 hash_table[r_list[location].hash_entry] = -1; 211
508 hash_table[hash_result] = location; 212 for (i = 0; i < e->nstamps; i++) {
509 memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long)); 213 if (info->seconds && time_after(t, e->stamps[i]))
510 r_list[location].time_pos = curr_table->time_pos; 214 continue;
511 r_list[location].addr = addr; 215 if (++hits >= info->hit_count) {
512 r_list[location].ttl = ttl; 216 ret ^= 1;
513 r_list[location].last_seen = now; 217 break;
514 r_list[location].oldest_pkt = 1;
515 r_list[location].last_pkts[0] = now;
516 r_list[location].hash_entry = hash_result;
517 time_info[curr_table->time_pos].time = r_list[location].last_seen;
518 curr_table->time_pos = (curr_table->time_pos + 1) % ip_list_tot;
519
520 ans = !info->invert;
521 } else {
522#ifdef DEBUG
523 if(debug) printk(KERN_INFO RECENT_NAME ": match(): Existing table entry. (hr: %d,ha: %u)\n",
524 hash_result,
525 addr);
526#endif
527
528 /* Existing item found */
529 location = hash_table[hash_result];
530 /* We have a match on address, now to make sure it meets all requirements for a
531 * full match. */
532 if(info->check_set & IPT_RECENT_CHECK || info->check_set & IPT_RECENT_UPDATE) {
533 if(!info->seconds && !info->hit_count) ans = !info->invert; else ans = info->invert;
534 if(info->seconds && !info->hit_count) {
535 if(time_before_eq(now,r_list[location].last_seen+info->seconds*HZ)) ans = !info->invert; else ans = info->invert;
536 }
537 if(info->seconds && info->hit_count) {
538 for(pkt_count = 0, hits_found = 0; pkt_count < ip_pkt_list_tot; pkt_count++) {
539 if(r_list[location].last_pkts[pkt_count] == 0) break;
540 if(time_before_eq(now,r_list[location].last_pkts[pkt_count]+info->seconds*HZ)) hits_found++;
541 }
542 if(hits_found >= info->hit_count) ans = !info->invert; else ans = info->invert;
543 }
544 if(info->hit_count && !info->seconds) {
545 for(pkt_count = 0, hits_found = 0; pkt_count < ip_pkt_list_tot; pkt_count++) {
546 if(r_list[location].last_pkts[pkt_count] == 0) break;
547 hits_found++;
548 }
549 if(hits_found >= info->hit_count) ans = !info->invert; else ans = info->invert;
550 } 218 }
551 } 219 }
552#ifdef DEBUG
553 if(debug) {
554 if(ans)
555 printk(KERN_INFO RECENT_NAME ": match(): match addr: %u\n",addr);
556 else
557 printk(KERN_INFO RECENT_NAME ": match(): no match addr: %u\n",addr);
558 }
559#endif
560
561 /* If and only if we have been asked to SET, or to UPDATE (on match) do we add the
562 * current timestamp to the last_seen. */
563 if((info->check_set & IPT_RECENT_SET && (ans = !info->invert)) || (info->check_set & IPT_RECENT_UPDATE && ans)) {
564#ifdef DEBUG
565 if(debug) printk(KERN_INFO RECENT_NAME ": match(): SET or UPDATE; updating time info.\n");
566#endif
567 /* Have to update our time info */
568 time_loc = r_list[location].time_pos;
569 time_info[time_loc].time = now;
570 time_info[time_loc].position = location;
571 while((time_info[(time_loc+1) % ip_list_tot].time < time_info[time_loc].time) && ((time_loc+1) % ip_list_tot) != curr_table->time_pos) {
572 time_temp = time_info[time_loc].time;
573 time_info[time_loc].time = time_info[(time_loc+1)%ip_list_tot].time;
574 time_info[(time_loc+1)%ip_list_tot].time = time_temp;
575 time_temp = time_info[time_loc].position;
576 time_info[time_loc].position = time_info[(time_loc+1)%ip_list_tot].position;
577 time_info[(time_loc+1)%ip_list_tot].position = time_temp;
578 r_list[time_info[time_loc].position].time_pos = time_loc;
579 r_list[time_info[(time_loc+1)%ip_list_tot].position].time_pos = (time_loc+1)%ip_list_tot;
580 time_loc = (time_loc+1) % ip_list_tot;
581 }
582 r_list[location].time_pos = time_loc;
583 r_list[location].ttl = ttl;
584 r_list[location].last_pkts[r_list[location].oldest_pkt] = now;
585 r_list[location].oldest_pkt = ++r_list[location].oldest_pkt % ip_pkt_list_tot;
586 r_list[location].last_seen = now;
587 }
588 /* If we have been asked to remove the entry from the list, just set it to 0 */
589 if(info->check_set & IPT_RECENT_REMOVE) {
590#ifdef DEBUG
591 if(debug) printk(KERN_INFO RECENT_NAME ": match(): REMOVE; clearing entry (or: %d, hr: %d).\n",orig_hash_result,hash_result);
592#endif
593 /* Check if this is part of a collision chain */
594 while(hash_table[(orig_hash_result+1) % ip_list_hash_size] != -1) {
595 orig_hash_result++;
596 if(hash_func(r_list[hash_table[orig_hash_result]].addr,ip_list_hash_size) == hash_result) {
597 /* Found collision chain, how deep does this rabbit hole go? */
598#ifdef DEBUG
599 if(debug) printk(KERN_INFO RECENT_NAME ": match(): REMOVE; found collision chain.\n");
600#endif
601 end_collision_chain = orig_hash_result;
602 }
603 }
604 if(end_collision_chain != -1) {
605#ifdef DEBUG
606 if(debug) printk(KERN_INFO RECENT_NAME ": match(): REMOVE; part of collision chain, moving to end.\n");
607#endif
608 /* Part of a collision chain, swap it with the end of the chain
609 * before removing. */
610 r_list[hash_table[end_collision_chain]].hash_entry = hash_result;
611 temp = hash_table[end_collision_chain];
612 hash_table[end_collision_chain] = hash_table[hash_result];
613 hash_table[hash_result] = temp;
614 time_info[r_list[hash_table[hash_result]].time_pos].position = hash_table[hash_result];
615 hash_result = end_collision_chain;
616 r_list[hash_table[hash_result]].hash_entry = hash_result;
617 time_info[r_list[hash_table[hash_result]].time_pos].position = hash_table[hash_result];
618 }
619 location = hash_table[hash_result];
620 hash_table[r_list[location].hash_entry] = -1;
621 time_loc = r_list[location].time_pos;
622 time_info[time_loc].time = 0;
623 time_info[time_loc].position = location;
624 while((time_info[(time_loc+1) % ip_list_tot].time < time_info[time_loc].time) && ((time_loc+1) % ip_list_tot) != curr_table->time_pos) {
625 time_temp = time_info[time_loc].time;
626 time_info[time_loc].time = time_info[(time_loc+1)%ip_list_tot].time;
627 time_info[(time_loc+1)%ip_list_tot].time = time_temp;
628 time_temp = time_info[time_loc].position;
629 time_info[time_loc].position = time_info[(time_loc+1)%ip_list_tot].position;
630 time_info[(time_loc+1)%ip_list_tot].position = time_temp;
631 r_list[time_info[time_loc].position].time_pos = time_loc;
632 r_list[time_info[(time_loc+1)%ip_list_tot].position].time_pos = (time_loc+1)%ip_list_tot;
633 time_loc = (time_loc+1) % ip_list_tot;
634 }
635 r_list[location].time_pos = time_loc;
636 r_list[location].last_seen = 0;
637 r_list[location].addr = 0;
638 r_list[location].ttl = 0;
639 memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long));
640 r_list[location].oldest_pkt = 0;
641 ans = !info->invert;
642 }
643 spin_unlock_bh(&curr_table->list_lock);
644 return ans;
645 } 220 }
646 221
647 spin_unlock_bh(&curr_table->list_lock); 222 if (info->check_set & IPT_RECENT_SET ||
648#ifdef DEBUG 223 (info->check_set & IPT_RECENT_UPDATE && ret)) {
649 if(debug) printk(KERN_INFO RECENT_NAME ": match() left.\n"); 224 recent_entry_update(t, e);
650#endif 225 e->ttl = ttl;
651 return ans; 226 }
227out:
228 spin_unlock_bh(&recent_lock);
229 return ret;
652} 230}
653 231
654/* This function is to verify that the rule given during the userspace iptables
655 * command is correct.
656 * If the command is valid then we check if the table name referred to by the
657 * rule exists, if not it is created.
658 */
659static int 232static int
660checkentry(const char *tablename, 233ipt_recent_checkentry(const char *tablename, const void *ip,
661 const void *ip, 234 const struct xt_match *match, void *matchinfo,
662 const struct xt_match *match, 235 unsigned int matchsize, unsigned int hook_mask)
663 void *matchinfo,
664 unsigned int matchsize,
665 unsigned int hook_mask)
666{ 236{
667 int flag = 0, c;
668 unsigned long *hold;
669 const struct ipt_recent_info *info = matchinfo; 237 const struct ipt_recent_info *info = matchinfo;
670 struct recent_ip_tables *curr_table, *find_table, *last_table; 238 struct recent_table *t;
671 239 unsigned i;
672#ifdef DEBUG 240 int ret = 0;
673 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry() entered.\n");
674#endif
675
676 /* seconds and hit_count only valid for CHECK/UPDATE */
677 if(info->check_set & IPT_RECENT_SET) { flag++; if(info->seconds || info->hit_count) return 0; }
678 if(info->check_set & IPT_RECENT_REMOVE) { flag++; if(info->seconds || info->hit_count) return 0; }
679 if(info->check_set & IPT_RECENT_CHECK) flag++;
680 if(info->check_set & IPT_RECENT_UPDATE) flag++;
681
682 /* One and only one of these should ever be set */
683 if(flag != 1) return 0;
684
685 /* Name must be set to something */
686 if(!info->name || !info->name[0]) return 0;
687 241
688 /* Things look good, create a list for this if it does not exist */ 242 if (hweight8(info->check_set &
689 /* Lock the linked list while we play with it */ 243 (IPT_RECENT_SET | IPT_RECENT_REMOVE |
690 spin_lock_bh(&recent_lock); 244 IPT_RECENT_CHECK | IPT_RECENT_UPDATE)) != 1)
691 245 return 0;
692 /* Look for an entry with this name already created */ 246 if ((info->check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE)) &&
693 /* Finds the end of the list and the entry before the end if current name does not exist */ 247 (info->seconds || info->hit_count))
694 find_table = r_tables; 248 return 0;
695 while( (last_table = find_table) && strncmp(info->name,find_table->name,IPT_RECENT_NAME_LEN) && (find_table = find_table->next) ); 249 if (info->name[0] == '\0' ||
250 strnlen(info->name, IPT_RECENT_NAME_LEN) == IPT_RECENT_NAME_LEN)
251 return 0;
696 252
697 /* If a table already exists just increment the count on that table and return */ 253 mutex_lock(&recent_mutex);
698 if(find_table) { 254 t = recent_table_lookup(info->name);
699#ifdef DEBUG 255 if (t != NULL) {
700 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: table found (%s), incrementing count.\n",info->name); 256 t->refcnt++;
701#endif 257 ret = 1;
702 find_table->count++; 258 goto out;
703 spin_unlock_bh(&recent_lock);
704 return 1;
705 } 259 }
706 260
707 spin_unlock_bh(&recent_lock); 261 t = kzalloc(sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size,
708 262 GFP_KERNEL);
709 /* Table with this name not found */ 263 if (t == NULL)
710 /* Allocate memory for new linked list item */ 264 goto out;
711 265 t->refcnt = 1;
712#ifdef DEBUG 266 strcpy(t->name, info->name);
713 if(debug) { 267 INIT_LIST_HEAD(&t->lru_list);
714 printk(KERN_INFO RECENT_NAME ": checkentry: no table found (%s)\n",info->name); 268 for (i = 0; i < ip_list_hash_size; i++)
715 printk(KERN_INFO RECENT_NAME ": checkentry: Allocationg %d for link-list entry.\n",sizeof(struct recent_ip_tables)); 269 INIT_LIST_HEAD(&t->iphash[i]);
270#ifdef CONFIG_PROC_FS
271 t->proc = create_proc_entry(t->name, ip_list_perms, proc_dir);
272 if (t->proc == NULL) {
273 kfree(t);
274 goto out;
716 } 275 }
276 t->proc->proc_fops = &recent_fops;
277 t->proc->data = t;
717#endif 278#endif
279 spin_lock_bh(&recent_lock);
280 list_add_tail(&t->list, &tables);
281 spin_unlock_bh(&recent_lock);
282 ret = 1;
283out:
284 mutex_unlock(&recent_mutex);
285 return ret;
286}
718 287
719 curr_table = vmalloc(sizeof(struct recent_ip_tables)); 288static void
720 if(curr_table == NULL) return 0; 289ipt_recent_destroy(const struct xt_match *match, void *matchinfo,
721 290 unsigned int matchsize)
722 spin_lock_init(&curr_table->list_lock); 291{
723 curr_table->next = NULL; 292 const struct ipt_recent_info *info = matchinfo;
724 curr_table->count = 1; 293 struct recent_table *t;
725 curr_table->time_pos = 0;
726 strncpy(curr_table->name,info->name,IPT_RECENT_NAME_LEN);
727 curr_table->name[IPT_RECENT_NAME_LEN-1] = '\0';
728
729 /* Allocate memory for this table and the list of packets in each entry. */
730#ifdef DEBUG
731 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: Allocating %d for table (%s).\n",
732 sizeof(struct recent_ip_list)*ip_list_tot,
733 info->name);
734#endif
735
736 curr_table->table = vmalloc(sizeof(struct recent_ip_list)*ip_list_tot);
737 if(curr_table->table == NULL) { vfree(curr_table); return 0; }
738 memset(curr_table->table,0,sizeof(struct recent_ip_list)*ip_list_tot);
739#ifdef DEBUG
740 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: Allocating %d for pkt_list.\n",
741 sizeof(unsigned long)*ip_pkt_list_tot*ip_list_tot);
742#endif
743
744 hold = vmalloc(sizeof(unsigned long)*ip_pkt_list_tot*ip_list_tot);
745#ifdef DEBUG
746 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: After pkt_list allocation.\n");
747#endif
748 if(hold == NULL) {
749 printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for pkt_list.\n");
750 vfree(curr_table->table);
751 vfree(curr_table);
752 return 0;
753 }
754 for(c = 0; c < ip_list_tot; c++) {
755 curr_table->table[c].last_pkts = hold + c*ip_pkt_list_tot;
756 }
757 294
758 /* Allocate memory for the hash table */ 295 mutex_lock(&recent_mutex);
759#ifdef DEBUG 296 t = recent_table_lookup(info->name);
760 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: Allocating %d for hash_table.\n", 297 if (--t->refcnt == 0) {
761 sizeof(int)*ip_list_hash_size); 298 spin_lock_bh(&recent_lock);
299 list_del(&t->list);
300 spin_unlock_bh(&recent_lock);
301 recent_table_flush(t);
302#ifdef CONFIG_PROC_FS
303 remove_proc_entry(t->name, proc_dir);
762#endif 304#endif
763 305 kfree(t);
764 curr_table->hash_table = vmalloc(sizeof(int)*ip_list_hash_size);
765 if(!curr_table->hash_table) {
766 printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for hash_table.\n");
767 vfree(hold);
768 vfree(curr_table->table);
769 vfree(curr_table);
770 return 0;
771 }
772
773 for(c = 0; c < ip_list_hash_size; c++) {
774 curr_table->hash_table[c] = -1;
775 } 306 }
307 mutex_unlock(&recent_mutex);
308}
776 309
777 /* Allocate memory for the time info */ 310#ifdef CONFIG_PROC_FS
778#ifdef DEBUG 311struct recent_iter_state {
779 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: Allocating %d for time_info.\n", 312 struct recent_table *table;
780 sizeof(struct time_info_list)*ip_list_tot); 313 unsigned int bucket;
781#endif 314};
782 315
783 curr_table->time_info = vmalloc(sizeof(struct time_info_list)*ip_list_tot); 316static void *recent_seq_start(struct seq_file *seq, loff_t *pos)
784 if(!curr_table->time_info) { 317{
785 printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for time_info.\n"); 318 struct recent_iter_state *st = seq->private;
786 vfree(curr_table->hash_table); 319 struct recent_table *t = st->table;
787 vfree(hold); 320 struct recent_entry *e;
788 vfree(curr_table->table); 321 loff_t p = *pos;
789 vfree(curr_table);
790 return 0;
791 }
792 for(c = 0; c < ip_list_tot; c++) {
793 curr_table->time_info[c].position = c;
794 curr_table->time_info[c].time = 0;
795 }
796 322
797 /* Put the new table in place */
798 spin_lock_bh(&recent_lock); 323 spin_lock_bh(&recent_lock);
799 find_table = r_tables;
800 while( (last_table = find_table) && strncmp(info->name,find_table->name,IPT_RECENT_NAME_LEN) && (find_table = find_table->next) );
801
802 /* If a table already exists just increment the count on that table and return */
803 if(find_table) {
804 find_table->count++;
805 spin_unlock_bh(&recent_lock);
806#ifdef DEBUG
807 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: table found (%s), created by other process.\n",info->name);
808#endif
809 vfree(curr_table->time_info);
810 vfree(curr_table->hash_table);
811 vfree(hold);
812 vfree(curr_table->table);
813 vfree(curr_table);
814 return 1;
815 }
816 if(!last_table) r_tables = curr_table; else last_table->next = curr_table;
817
818 spin_unlock_bh(&recent_lock);
819 324
820#ifdef CONFIG_PROC_FS 325 for (st->bucket = 0; st->bucket < ip_list_hash_size; st->bucket++) {
821 /* Create our proc 'status' entry. */ 326 list_for_each_entry(e, &t->iphash[st->bucket], list) {
822 curr_table->status_proc = create_proc_entry(curr_table->name, ip_list_perms, proc_net_ipt_recent); 327 if (p-- == 0)
823 if (!curr_table->status_proc) { 328 return e;
824 vfree(hold);
825 printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for /proc entry.\n");
826 /* Destroy the created table */
827 spin_lock_bh(&recent_lock);
828 last_table = NULL;
829 curr_table = r_tables;
830 if(!curr_table) {
831#ifdef DEBUG
832 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry() create_proc failed, no tables.\n");
833#endif
834 spin_unlock_bh(&recent_lock);
835 return 0;
836 }
837 while( strncmp(info->name,curr_table->name,IPT_RECENT_NAME_LEN) && (last_table = curr_table) && (curr_table = curr_table->next) );
838 if(!curr_table) {
839#ifdef DEBUG
840 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry() create_proc failed, table already destroyed.\n");
841#endif
842 spin_unlock_bh(&recent_lock);
843 return 0;
844 } 329 }
845 if(last_table) last_table->next = curr_table->next; else r_tables = curr_table->next;
846 spin_unlock_bh(&recent_lock);
847 vfree(curr_table->time_info);
848 vfree(curr_table->hash_table);
849 vfree(curr_table->table);
850 vfree(curr_table);
851 return 0;
852 } 330 }
853 331 return NULL;
854 curr_table->status_proc->owner = THIS_MODULE; 332}
855 curr_table->status_proc->data = curr_table;
856 wmb();
857 curr_table->status_proc->read_proc = ip_recent_get_info;
858 curr_table->status_proc->write_proc = ip_recent_ctrl;
859#endif /* CONFIG_PROC_FS */
860
861#ifdef DEBUG
862 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry() left.\n");
863#endif
864 333
865 return 1; 334static void *recent_seq_next(struct seq_file *seq, void *v, loff_t *pos)
335{
336 struct recent_iter_state *st = seq->private;
337 struct recent_table *t = st->table;
338 struct recent_entry *e = v;
339 struct list_head *head = e->list.next;
340
341 while (head == &t->iphash[st->bucket]) {
342 if (++st->bucket >= ip_list_hash_size)
343 return NULL;
344 head = t->iphash[st->bucket].next;
345 }
346 (*pos)++;
347 return list_entry(head, struct recent_entry, list);
866} 348}
867 349
868/* This function is called in the event that a rule matching this module is 350static void recent_seq_stop(struct seq_file *s, void *v)
869 * removed.
870 * When this happens we need to check if there are no other rules matching
871 * the table given. If that is the case then we remove the table and clean
872 * up its memory.
873 */
874static void
875destroy(const struct xt_match *match, void *matchinfo, unsigned int matchsize)
876{ 351{
877 const struct ipt_recent_info *info = matchinfo; 352 spin_unlock_bh(&recent_lock);
878 struct recent_ip_tables *curr_table, *last_table; 353}
879 354
880#ifdef DEBUG 355static int recent_seq_show(struct seq_file *seq, void *v)
881 if(debug) printk(KERN_INFO RECENT_NAME ": destroy() entered.\n"); 356{
882#endif 357 struct recent_entry *e = v;
358 unsigned int i;
359
360 i = (e->index - 1) % ip_pkt_list_tot;
361 seq_printf(seq, "src=%u.%u.%u.%u ttl: %u last_seen: %lu oldest_pkt: %u",
362 NIPQUAD(e->addr), e->ttl, e->stamps[i], e->index);
363 for (i = 0; i < e->nstamps; i++)
364 seq_printf(seq, "%s %lu", i ? "," : "", e->stamps[i]);
365 seq_printf(seq, "\n");
366 return 0;
367}
883 368
884 if(matchsize != IPT_ALIGN(sizeof(struct ipt_recent_info))) return; 369static struct seq_operations recent_seq_ops = {
370 .start = recent_seq_start,
371 .next = recent_seq_next,
372 .stop = recent_seq_stop,
373 .show = recent_seq_show,
374};
885 375
886 /* Lock the linked list while we play with it */ 376static int recent_seq_open(struct inode *inode, struct file *file)
887 spin_lock_bh(&recent_lock); 377{
378 struct proc_dir_entry *pde = PDE(inode);
379 struct seq_file *seq;
380 struct recent_iter_state *st;
381 int ret;
382
383 st = kzalloc(sizeof(*st), GFP_KERNEL);
384 if (st == NULL)
385 return -ENOMEM;
386 ret = seq_open(file, &recent_seq_ops);
387 if (ret)
388 kfree(st);
389 st->table = pde->data;
390 seq = file->private_data;
391 seq->private = st;
392 return ret;
393}
888 394
889 /* Look for an entry with this name already created */ 395static ssize_t recent_proc_write(struct file *file, const char __user *input,
890 /* Finds the end of the list and the entry before the end if current name does not exist */ 396 size_t size, loff_t *loff)
891 last_table = NULL; 397{
892 curr_table = r_tables; 398 struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
893 if(!curr_table) { 399 struct recent_table *t = pde->data;
894#ifdef DEBUG 400 struct recent_entry *e;
895 if(debug) printk(KERN_INFO RECENT_NAME ": destroy() No tables found, leaving.\n"); 401 char buf[sizeof("+255.255.255.255")], *c = buf;
896#endif 402 u_int32_t addr;
403 int add;
404
405 if (size > sizeof(buf))
406 size = sizeof(buf);
407 if (copy_from_user(buf, input, size))
408 return -EFAULT;
409 while (isspace(*c))
410 c++;
411
412 if (size - (c - buf) < 5)
413 return c - buf;
414 if (!strncmp(c, "clear", 5)) {
415 c += 5;
416 spin_lock_bh(&recent_lock);
417 recent_table_flush(t);
897 spin_unlock_bh(&recent_lock); 418 spin_unlock_bh(&recent_lock);
898 return; 419 return c - buf;
899 } 420 }
900 while( strncmp(info->name,curr_table->name,IPT_RECENT_NAME_LEN) && (last_table = curr_table) && (curr_table = curr_table->next) );
901 421
902 /* If a table does not exist then do nothing and return */ 422 switch (*c) {
903 if(!curr_table) { 423 case '-':
904#ifdef DEBUG 424 add = 0;
905 if(debug) printk(KERN_INFO RECENT_NAME ": destroy() table not found, leaving.\n"); 425 c++;
906#endif 426 break;
907 spin_unlock_bh(&recent_lock); 427 case '+':
908 return; 428 c++;
429 default:
430 add = 1;
431 break;
909 } 432 }
433 addr = in_aton(c);
910 434
911 curr_table->count--; 435 spin_lock_bh(&recent_lock);
912 436 e = recent_entry_lookup(t, addr, 0);
913 /* If count is still non-zero then there are still rules referenceing it so we do nothing */ 437 if (e == NULL) {
914 if(curr_table->count) { 438 if (add)
915#ifdef DEBUG 439 recent_entry_init(t, addr, 0);
916 if(debug) printk(KERN_INFO RECENT_NAME ": destroy() table found, non-zero count, leaving.\n"); 440 } else {
917#endif 441 if (add)
918 spin_unlock_bh(&recent_lock); 442 recent_entry_update(t, e);
919 return; 443 else
444 recent_entry_remove(t, e);
920 } 445 }
921
922#ifdef DEBUG
923 if(debug) printk(KERN_INFO RECENT_NAME ": destroy() table found, zero count, removing.\n");
924#endif
925
926 /* Count must be zero so we remove this table from the list */
927 if(last_table) last_table->next = curr_table->next; else r_tables = curr_table->next;
928
929 spin_unlock_bh(&recent_lock); 446 spin_unlock_bh(&recent_lock);
447 return size;
448}
930 449
931 /* lock to make sure any late-runners still using this after we removed it from 450static struct file_operations recent_fops = {
932 * the list finish up then remove everything */ 451 .open = recent_seq_open,
933 spin_lock_bh(&curr_table->list_lock); 452 .read = seq_read,
934 spin_unlock_bh(&curr_table->list_lock); 453 .write = recent_proc_write,
935 454 .release = seq_release_private,
936#ifdef CONFIG_PROC_FS 455 .owner = THIS_MODULE,
937 if(curr_table->status_proc) remove_proc_entry(curr_table->name,proc_net_ipt_recent); 456};
938#endif /* CONFIG_PROC_FS */ 457#endif /* CONFIG_PROC_FS */
939 vfree(curr_table->table[0].last_pkts);
940 vfree(curr_table->table);
941 vfree(curr_table->hash_table);
942 vfree(curr_table->time_info);
943 vfree(curr_table);
944
945#ifdef DEBUG
946 if(debug) printk(KERN_INFO RECENT_NAME ": destroy() left.\n");
947#endif
948 458
949 return;
950}
951
952/* This is the structure we pass to ipt_register to register our
953 * module with iptables.
954 */
955static struct ipt_match recent_match = { 459static struct ipt_match recent_match = {
956 .name = "recent", 460 .name = "recent",
957 .match = match, 461 .match = ipt_recent_match,
958 .matchsize = sizeof(struct ipt_recent_info), 462 .matchsize = sizeof(struct ipt_recent_info),
959 .checkentry = checkentry, 463 .checkentry = ipt_recent_checkentry,
960 .destroy = destroy, 464 .destroy = ipt_recent_destroy,
961 .me = THIS_MODULE 465 .me = THIS_MODULE,
962}; 466};
963 467
964/* Kernel module initialization. */
965static int __init ipt_recent_init(void) 468static int __init ipt_recent_init(void)
966{ 469{
967 int err, count; 470 int err;
968 471
969 printk(version); 472 if (!ip_list_tot || !ip_pkt_list_tot || ip_pkt_list_tot > 255)
970#ifdef CONFIG_PROC_FS 473 return -EINVAL;
971 proc_net_ipt_recent = proc_mkdir("ipt_recent",proc_net); 474 ip_list_hash_size = 1 << fls(ip_list_tot);
972 if(!proc_net_ipt_recent) return -ENOMEM;
973#endif
974
975 if(ip_list_hash_size && ip_list_hash_size <= ip_list_tot) {
976 printk(KERN_WARNING RECENT_NAME ": ip_list_hash_size too small, resetting to default.\n");
977 ip_list_hash_size = 0;
978 }
979
980 if(!ip_list_hash_size) {
981 ip_list_hash_size = ip_list_tot*3;
982 count = 2*2;
983 while(ip_list_hash_size > count) count = count*2;
984 ip_list_hash_size = count;
985 }
986
987#ifdef DEBUG
988 if(debug) printk(KERN_INFO RECENT_NAME ": ip_list_hash_size: %d\n",ip_list_hash_size);
989#endif
990 475
991 err = ipt_register_match(&recent_match); 476 err = ipt_register_match(&recent_match);
477#ifdef CONFIG_PROC_FS
992 if (err) 478 if (err)
993 remove_proc_entry("ipt_recent", proc_net); 479 return err;
480 proc_dir = proc_mkdir("ipt_recent", proc_net);
481 if (proc_dir == NULL) {
482 ipt_unregister_match(&recent_match);
483 err = -ENOMEM;
484 }
485#endif
994 return err; 486 return err;
995} 487}
996 488
997/* Kernel module destruction. */ 489static void __exit ipt_recent_exit(void)
998static void __exit ipt_recent_fini(void)
999{ 490{
491 BUG_ON(!list_empty(&tables));
1000 ipt_unregister_match(&recent_match); 492 ipt_unregister_match(&recent_match);
1001 493#ifdef CONFIG_PROC_FS
1002 remove_proc_entry("ipt_recent",proc_net); 494 remove_proc_entry("ipt_recent", proc_net);
495#endif
1003} 496}
1004 497
1005/* Register our module with the kernel. */
1006module_init(ipt_recent_init); 498module_init(ipt_recent_init);
1007module_exit(ipt_recent_fini); 499module_exit(ipt_recent_exit);
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 77d974443c7b..8cc8e1b36778 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -145,7 +145,7 @@ static unsigned int ipv4_conntrack_help(unsigned int hooknum,
145 145
146 /* This is where we call the helper: as the packet goes out. */ 146 /* This is where we call the helper: as the packet goes out. */
147 ct = nf_ct_get(*pskb, &ctinfo); 147 ct = nf_ct_get(*pskb, &ctinfo);
148 if (!ct) 148 if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)
149 return NF_ACCEPT; 149 return NF_ACCEPT;
150 150
151 help = nfct_help(ct); 151 help = nfct_help(ct);
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index 4b0d361cc6e6..663a73ee3f2f 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -235,7 +235,7 @@ 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 (nf_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
239 nf_ip_checksum(skb, hooknum, dataoff, 0)) { 239 nf_ip_checksum(skb, hooknum, dataoff, 0)) {
240 if (LOG_INVALID(IPPROTO_ICMP)) 240 if (LOG_INVALID(IPPROTO_ICMP))
241 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, 241 nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index fc2562415555..bd221ec3f81e 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -103,7 +103,7 @@ static void raw_v4_unhash(struct sock *sk)
103} 103}
104 104
105struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, 105struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
106 unsigned long raddr, unsigned long laddr, 106 __be32 raddr, __be32 laddr,
107 int dif) 107 int dif)
108{ 108{
109 struct hlist_node *node; 109 struct hlist_node *node;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 6b6c3adfcf00..ce4cd5f35511 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -182,14 +182,6 @@ ctl_table ipv4_table[] = {
182 .strategy = &ipv4_doint_and_flush_strategy, 182 .strategy = &ipv4_doint_and_flush_strategy,
183 }, 183 },
184 { 184 {
185 .ctl_name = NET_IPV4_AUTOCONFIG,
186 .procname = "ip_autoconfig",
187 .data = &ipv4_config.autoconfig,
188 .maxlen = sizeof(int),
189 .mode = 0644,
190 .proc_handler = &proc_dointvec
191 },
192 {
193 .ctl_name = NET_IPV4_NO_PMTU_DISC, 185 .ctl_name = NET_IPV4_NO_PMTU_DISC,
194 .procname = "ip_no_pmtu_disc", 186 .procname = "ip_no_pmtu_disc",
195 .data = &ipv4_config.no_pmtu_disc, 187 .data = &ipv4_config.no_pmtu_disc,
@@ -688,6 +680,24 @@ ctl_table ipv4_table[] = {
688 .mode = 0644, 680 .mode = 0644,
689 .proc_handler = &proc_dointvec 681 .proc_handler = &proc_dointvec
690 }, 682 },
683#ifdef CONFIG_NET_DMA
684 {
685 .ctl_name = NET_TCP_DMA_COPYBREAK,
686 .procname = "tcp_dma_copybreak",
687 .data = &sysctl_tcp_dma_copybreak,
688 .maxlen = sizeof(int),
689 .mode = 0644,
690 .proc_handler = &proc_dointvec
691 },
692#endif
693 {
694 .ctl_name = NET_TCP_SLOW_START_AFTER_IDLE,
695 .procname = "tcp_slow_start_after_idle",
696 .data = &sysctl_tcp_slow_start_after_idle,
697 .maxlen = sizeof(int),
698 .mode = 0644,
699 .proc_handler = &proc_dointvec
700 },
691 { .ctl_name = 0 } 701 { .ctl_name = 0 }
692}; 702};
693 703
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e2b7b8055037..74998f250071 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -263,7 +263,7 @@
263#include <net/tcp.h> 263#include <net/tcp.h>
264#include <net/xfrm.h> 264#include <net/xfrm.h>
265#include <net/ip.h> 265#include <net/ip.h>
266 266#include <net/netdma.h>
267 267
268#include <asm/uaccess.h> 268#include <asm/uaccess.h>
269#include <asm/ioctls.h> 269#include <asm/ioctls.h>
@@ -622,14 +622,10 @@ ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset,
622 ssize_t res; 622 ssize_t res;
623 struct sock *sk = sock->sk; 623 struct sock *sk = sock->sk;
624 624
625#define TCP_ZC_CSUM_FLAGS (NETIF_F_IP_CSUM | NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
626
627 if (!(sk->sk_route_caps & NETIF_F_SG) || 625 if (!(sk->sk_route_caps & NETIF_F_SG) ||
628 !(sk->sk_route_caps & TCP_ZC_CSUM_FLAGS)) 626 !(sk->sk_route_caps & NETIF_F_ALL_CSUM))
629 return sock_no_sendpage(sock, page, offset, size, flags); 627 return sock_no_sendpage(sock, page, offset, size, flags);
630 628
631#undef TCP_ZC_CSUM_FLAGS
632
633 lock_sock(sk); 629 lock_sock(sk);
634 TCP_CHECK_TIMER(sk); 630 TCP_CHECK_TIMER(sk);
635 res = do_tcp_sendpages(sk, &page, offset, size, flags); 631 res = do_tcp_sendpages(sk, &page, offset, size, flags);
@@ -726,9 +722,7 @@ new_segment:
726 /* 722 /*
727 * Check whether we can use HW checksum. 723 * Check whether we can use HW checksum.
728 */ 724 */
729 if (sk->sk_route_caps & 725 if (sk->sk_route_caps & NETIF_F_ALL_CSUM)
730 (NETIF_F_IP_CSUM | NETIF_F_NO_CSUM |
731 NETIF_F_HW_CSUM))
732 skb->ip_summed = CHECKSUM_HW; 726 skb->ip_summed = CHECKSUM_HW;
733 727
734 skb_entail(sk, tp, skb); 728 skb_entail(sk, tp, skb);
@@ -937,7 +931,7 @@ static int tcp_recv_urg(struct sock *sk, long timeo,
937 * calculation of whether or not we must ACK for the sake of 931 * calculation of whether or not we must ACK for the sake of
938 * a window update. 932 * a window update.
939 */ 933 */
940static void cleanup_rbuf(struct sock *sk, int copied) 934void tcp_cleanup_rbuf(struct sock *sk, int copied)
941{ 935{
942 struct tcp_sock *tp = tcp_sk(sk); 936 struct tcp_sock *tp = tcp_sk(sk);
943 int time_to_ack = 0; 937 int time_to_ack = 0;
@@ -1072,11 +1066,11 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1072 break; 1066 break;
1073 } 1067 }
1074 if (skb->h.th->fin) { 1068 if (skb->h.th->fin) {
1075 sk_eat_skb(sk, skb); 1069 sk_eat_skb(sk, skb, 0);
1076 ++seq; 1070 ++seq;
1077 break; 1071 break;
1078 } 1072 }
1079 sk_eat_skb(sk, skb); 1073 sk_eat_skb(sk, skb, 0);
1080 if (!desc->count) 1074 if (!desc->count)
1081 break; 1075 break;
1082 } 1076 }
@@ -1086,7 +1080,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1086 1080
1087 /* Clean up data we have read: This will do ACK frames. */ 1081 /* Clean up data we have read: This will do ACK frames. */
1088 if (copied) 1082 if (copied)
1089 cleanup_rbuf(sk, copied); 1083 tcp_cleanup_rbuf(sk, copied);
1090 return copied; 1084 return copied;
1091} 1085}
1092 1086
@@ -1110,6 +1104,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1110 int target; /* Read at least this many bytes */ 1104 int target; /* Read at least this many bytes */
1111 long timeo; 1105 long timeo;
1112 struct task_struct *user_recv = NULL; 1106 struct task_struct *user_recv = NULL;
1107 int copied_early = 0;
1113 1108
1114 lock_sock(sk); 1109 lock_sock(sk);
1115 1110
@@ -1133,6 +1128,17 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1133 1128
1134 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); 1129 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
1135 1130
1131#ifdef CONFIG_NET_DMA
1132 tp->ucopy.dma_chan = NULL;
1133 preempt_disable();
1134 if ((len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
1135 !sysctl_tcp_low_latency && __get_cpu_var(softnet_data.net_dma)) {
1136 preempt_enable_no_resched();
1137 tp->ucopy.pinned_list = dma_pin_iovec_pages(msg->msg_iov, len);
1138 } else
1139 preempt_enable_no_resched();
1140#endif
1141
1136 do { 1142 do {
1137 struct sk_buff *skb; 1143 struct sk_buff *skb;
1138 u32 offset; 1144 u32 offset;
@@ -1220,7 +1226,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1220 } 1226 }
1221 } 1227 }
1222 1228
1223 cleanup_rbuf(sk, copied); 1229 tcp_cleanup_rbuf(sk, copied);
1224 1230
1225 if (!sysctl_tcp_low_latency && tp->ucopy.task == user_recv) { 1231 if (!sysctl_tcp_low_latency && tp->ucopy.task == user_recv) {
1226 /* Install new reader */ 1232 /* Install new reader */
@@ -1274,6 +1280,10 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1274 } else 1280 } else
1275 sk_wait_data(sk, &timeo); 1281 sk_wait_data(sk, &timeo);
1276 1282
1283#ifdef CONFIG_NET_DMA
1284 tp->ucopy.wakeup = 0;
1285#endif
1286
1277 if (user_recv) { 1287 if (user_recv) {
1278 int chunk; 1288 int chunk;
1279 1289
@@ -1329,13 +1339,39 @@ do_prequeue:
1329 } 1339 }
1330 1340
1331 if (!(flags & MSG_TRUNC)) { 1341 if (!(flags & MSG_TRUNC)) {
1332 err = skb_copy_datagram_iovec(skb, offset, 1342#ifdef CONFIG_NET_DMA
1333 msg->msg_iov, used); 1343 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
1334 if (err) { 1344 tp->ucopy.dma_chan = get_softnet_dma();
1335 /* Exception. Bailout! */ 1345
1336 if (!copied) 1346 if (tp->ucopy.dma_chan) {
1337 copied = -EFAULT; 1347 tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec(
1338 break; 1348 tp->ucopy.dma_chan, skb, offset,
1349 msg->msg_iov, used,
1350 tp->ucopy.pinned_list);
1351
1352 if (tp->ucopy.dma_cookie < 0) {
1353
1354 printk(KERN_ALERT "dma_cookie < 0\n");
1355
1356 /* Exception. Bailout! */
1357 if (!copied)
1358 copied = -EFAULT;
1359 break;
1360 }
1361 if ((offset + used) == skb->len)
1362 copied_early = 1;
1363
1364 } else
1365#endif
1366 {
1367 err = skb_copy_datagram_iovec(skb, offset,
1368 msg->msg_iov, used);
1369 if (err) {
1370 /* Exception. Bailout! */
1371 if (!copied)
1372 copied = -EFAULT;
1373 break;
1374 }
1339 } 1375 }
1340 } 1376 }
1341 1377
@@ -1355,15 +1391,19 @@ skip_copy:
1355 1391
1356 if (skb->h.th->fin) 1392 if (skb->h.th->fin)
1357 goto found_fin_ok; 1393 goto found_fin_ok;
1358 if (!(flags & MSG_PEEK)) 1394 if (!(flags & MSG_PEEK)) {
1359 sk_eat_skb(sk, skb); 1395 sk_eat_skb(sk, skb, copied_early);
1396 copied_early = 0;
1397 }
1360 continue; 1398 continue;
1361 1399
1362 found_fin_ok: 1400 found_fin_ok:
1363 /* Process the FIN. */ 1401 /* Process the FIN. */
1364 ++*seq; 1402 ++*seq;
1365 if (!(flags & MSG_PEEK)) 1403 if (!(flags & MSG_PEEK)) {
1366 sk_eat_skb(sk, skb); 1404 sk_eat_skb(sk, skb, copied_early);
1405 copied_early = 0;
1406 }
1367 break; 1407 break;
1368 } while (len > 0); 1408 } while (len > 0);
1369 1409
@@ -1386,12 +1426,42 @@ skip_copy:
1386 tp->ucopy.len = 0; 1426 tp->ucopy.len = 0;
1387 } 1427 }
1388 1428
1429#ifdef CONFIG_NET_DMA
1430 if (tp->ucopy.dma_chan) {
1431 struct sk_buff *skb;
1432 dma_cookie_t done, used;
1433
1434 dma_async_memcpy_issue_pending(tp->ucopy.dma_chan);
1435
1436 while (dma_async_memcpy_complete(tp->ucopy.dma_chan,
1437 tp->ucopy.dma_cookie, &done,
1438 &used) == DMA_IN_PROGRESS) {
1439 /* do partial cleanup of sk_async_wait_queue */
1440 while ((skb = skb_peek(&sk->sk_async_wait_queue)) &&
1441 (dma_async_is_complete(skb->dma_cookie, done,
1442 used) == DMA_SUCCESS)) {
1443 __skb_dequeue(&sk->sk_async_wait_queue);
1444 kfree_skb(skb);
1445 }
1446 }
1447
1448 /* Safe to free early-copied skbs now */
1449 __skb_queue_purge(&sk->sk_async_wait_queue);
1450 dma_chan_put(tp->ucopy.dma_chan);
1451 tp->ucopy.dma_chan = NULL;
1452 }
1453 if (tp->ucopy.pinned_list) {
1454 dma_unpin_iovec_pages(tp->ucopy.pinned_list);
1455 tp->ucopy.pinned_list = NULL;
1456 }
1457#endif
1458
1389 /* According to UNIX98, msg_name/msg_namelen are ignored 1459 /* According to UNIX98, msg_name/msg_namelen are ignored
1390 * on connected socket. I was just happy when found this 8) --ANK 1460 * on connected socket. I was just happy when found this 8) --ANK
1391 */ 1461 */
1392 1462
1393 /* Clean up data we have read: This will do ACK frames. */ 1463 /* Clean up data we have read: This will do ACK frames. */
1394 cleanup_rbuf(sk, copied); 1464 tcp_cleanup_rbuf(sk, copied);
1395 1465
1396 TCP_CHECK_TIMER(sk); 1466 TCP_CHECK_TIMER(sk);
1397 release_sock(sk); 1467 release_sock(sk);
@@ -1658,6 +1728,9 @@ int tcp_disconnect(struct sock *sk, int flags)
1658 __skb_queue_purge(&sk->sk_receive_queue); 1728 __skb_queue_purge(&sk->sk_receive_queue);
1659 sk_stream_writequeue_purge(sk); 1729 sk_stream_writequeue_purge(sk);
1660 __skb_queue_purge(&tp->out_of_order_queue); 1730 __skb_queue_purge(&tp->out_of_order_queue);
1731#ifdef CONFIG_NET_DMA
1732 __skb_queue_purge(&sk->sk_async_wait_queue);
1733#endif
1661 1734
1662 inet->dport = 0; 1735 inet->dport = 0;
1663 1736
@@ -1858,7 +1931,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
1858 (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT) && 1931 (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT) &&
1859 inet_csk_ack_scheduled(sk)) { 1932 inet_csk_ack_scheduled(sk)) {
1860 icsk->icsk_ack.pending |= ICSK_ACK_PUSHED; 1933 icsk->icsk_ack.pending |= ICSK_ACK_PUSHED;
1861 cleanup_rbuf(sk, 1); 1934 tcp_cleanup_rbuf(sk, 1);
1862 if (!(val & 1)) 1935 if (!(val & 1))
1863 icsk->icsk_ack.pingpong = 1; 1936 icsk->icsk_ack.pingpong = 1;
1864 } 1937 }
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c
index 035f2092d73a..b2d9021ad22b 100644
--- a/net/ipv4/tcp_bic.c
+++ b/net/ipv4/tcp_bic.c
@@ -198,12 +198,6 @@ static u32 bictcp_undo_cwnd(struct sock *sk)
198 return max(tp->snd_cwnd, ca->last_max_cwnd); 198 return max(tp->snd_cwnd, ca->last_max_cwnd);
199} 199}
200 200
201static u32 bictcp_min_cwnd(struct sock *sk)
202{
203 const struct tcp_sock *tp = tcp_sk(sk);
204 return tp->snd_ssthresh;
205}
206
207static void bictcp_state(struct sock *sk, u8 new_state) 201static void bictcp_state(struct sock *sk, u8 new_state)
208{ 202{
209 if (new_state == TCP_CA_Loss) 203 if (new_state == TCP_CA_Loss)
@@ -231,7 +225,6 @@ static struct tcp_congestion_ops bictcp = {
231 .cong_avoid = bictcp_cong_avoid, 225 .cong_avoid = bictcp_cong_avoid,
232 .set_state = bictcp_state, 226 .set_state = bictcp_state,
233 .undo_cwnd = bictcp_undo_cwnd, 227 .undo_cwnd = bictcp_undo_cwnd,
234 .min_cwnd = bictcp_min_cwnd,
235 .pkts_acked = bictcp_acked, 228 .pkts_acked = bictcp_acked,
236 .owner = THIS_MODULE, 229 .owner = THIS_MODULE,
237 .name = "bic", 230 .name = "bic",
diff --git a/net/ipv4/tcp_compound.c b/net/ipv4/tcp_compound.c
new file mode 100644
index 000000000000..bc54f7e9aea9
--- /dev/null
+++ b/net/ipv4/tcp_compound.c
@@ -0,0 +1,448 @@
1/*
2 * TCP Vegas congestion control
3 *
4 * This is based on the congestion detection/avoidance scheme described in
5 * Lawrence S. Brakmo and Larry L. Peterson.
6 * "TCP Vegas: End to end congestion avoidance on a global internet."
7 * IEEE Journal on Selected Areas in Communication, 13(8):1465--1480,
8 * October 1995. Available from:
9 * ftp://ftp.cs.arizona.edu/xkernel/Papers/jsac.ps
10 *
11 * See http://www.cs.arizona.edu/xkernel/ for their implementation.
12 * The main aspects that distinguish this implementation from the
13 * Arizona Vegas implementation are:
14 * o We do not change the loss detection or recovery mechanisms of
15 * Linux in any way. Linux already recovers from losses quite well,
16 * using fine-grained timers, NewReno, and FACK.
17 * o To avoid the performance penalty imposed by increasing cwnd
18 * only every-other RTT during slow start, we increase during
19 * every RTT during slow start, just like Reno.
20 * o Largely to allow continuous cwnd growth during slow start,
21 * we use the rate at which ACKs come back as the "actual"
22 * rate, rather than the rate at which data is sent.
23 * o To speed convergence to the right rate, we set the cwnd
24 * to achieve the right ("actual") rate when we exit slow start.
25 * o To filter out the noise caused by delayed ACKs, we use the
26 * minimum RTT sample observed during the last RTT to calculate
27 * the actual rate.
28 * o When the sender re-starts from idle, it waits until it has
29 * received ACKs for an entire flight of new data before making
30 * a cwnd adjustment decision. The original Vegas implementation
31 * assumed senders never went idle.
32 *
33 *
34 * TCP Compound based on TCP Vegas
35 *
36 * further details can be found here:
37 * ftp://ftp.research.microsoft.com/pub/tr/TR-2005-86.pdf
38 */
39
40#include <linux/config.h>
41#include <linux/mm.h>
42#include <linux/module.h>
43#include <linux/skbuff.h>
44#include <linux/inet_diag.h>
45
46#include <net/tcp.h>
47
48/* Default values of the Vegas variables, in fixed-point representation
49 * with V_PARAM_SHIFT bits to the right of the binary point.
50 */
51#define V_PARAM_SHIFT 1
52
53#define TCP_COMPOUND_ALPHA 3U
54#define TCP_COMPOUND_BETA 1U
55#define TCP_COMPOUND_GAMMA 30
56#define TCP_COMPOUND_ZETA 1
57
58/* TCP compound variables */
59struct compound {
60 u32 beg_snd_nxt; /* right edge during last RTT */
61 u32 beg_snd_una; /* left edge during last RTT */
62 u32 beg_snd_cwnd; /* saves the size of the cwnd */
63 u8 doing_vegas_now; /* if true, do vegas for this RTT */
64 u16 cntRTT; /* # of RTTs measured within last RTT */
65 u32 minRTT; /* min of RTTs measured within last RTT (in usec) */
66 u32 baseRTT; /* the min of all Vegas RTT measurements seen (in usec) */
67
68 u32 cwnd;
69 u32 dwnd;
70};
71
72/* There are several situations when we must "re-start" Vegas:
73 *
74 * o when a connection is established
75 * o after an RTO
76 * o after fast recovery
77 * o when we send a packet and there is no outstanding
78 * unacknowledged data (restarting an idle connection)
79 *
80 * In these circumstances we cannot do a Vegas calculation at the
81 * end of the first RTT, because any calculation we do is using
82 * stale info -- both the saved cwnd and congestion feedback are
83 * stale.
84 *
85 * Instead we must wait until the completion of an RTT during
86 * which we actually receive ACKs.
87 */
88static inline void vegas_enable(struct sock *sk)
89{
90 const struct tcp_sock *tp = tcp_sk(sk);
91 struct compound *vegas = inet_csk_ca(sk);
92
93 /* Begin taking Vegas samples next time we send something. */
94 vegas->doing_vegas_now = 1;
95
96 /* Set the beginning of the next send window. */
97 vegas->beg_snd_nxt = tp->snd_nxt;
98
99 vegas->cntRTT = 0;
100 vegas->minRTT = 0x7fffffff;
101}
102
103/* Stop taking Vegas samples for now. */
104static inline void vegas_disable(struct sock *sk)
105{
106 struct compound *vegas = inet_csk_ca(sk);
107
108 vegas->doing_vegas_now = 0;
109}
110
111static void tcp_compound_init(struct sock *sk)
112{
113 struct compound *vegas = inet_csk_ca(sk);
114 const struct tcp_sock *tp = tcp_sk(sk);
115
116 vegas->baseRTT = 0x7fffffff;
117 vegas_enable(sk);
118
119 vegas->dwnd = 0;
120 vegas->cwnd = tp->snd_cwnd;
121}
122
123/* Do RTT sampling needed for Vegas.
124 * Basically we:
125 * o min-filter RTT samples from within an RTT to get the current
126 * propagation delay + queuing delay (we are min-filtering to try to
127 * avoid the effects of delayed ACKs)
128 * o min-filter RTT samples from a much longer window (forever for now)
129 * to find the propagation delay (baseRTT)
130 */
131static void tcp_compound_rtt_calc(struct sock *sk, u32 usrtt)
132{
133 struct compound *vegas = inet_csk_ca(sk);
134 u32 vrtt = usrtt + 1; /* Never allow zero rtt or baseRTT */
135
136 /* Filter to find propagation delay: */
137 if (vrtt < vegas->baseRTT)
138 vegas->baseRTT = vrtt;
139
140 /* Find the min RTT during the last RTT to find
141 * the current prop. delay + queuing delay:
142 */
143
144 vegas->minRTT = min(vegas->minRTT, vrtt);
145 vegas->cntRTT++;
146}
147
148static void tcp_compound_state(struct sock *sk, u8 ca_state)
149{
150
151 if (ca_state == TCP_CA_Open)
152 vegas_enable(sk);
153 else
154 vegas_disable(sk);
155}
156
157
158/* 64bit divisor, dividend and result. dynamic precision */
159static inline u64 div64_64(u64 dividend, u64 divisor)
160{
161 u32 d = divisor;
162
163 if (divisor > 0xffffffffULL) {
164 unsigned int shift = fls(divisor >> 32);
165
166 d = divisor >> shift;
167 dividend >>= shift;
168 }
169
170 /* avoid 64 bit division if possible */
171 if (dividend >> 32)
172 do_div(dividend, d);
173 else
174 dividend = (u32) dividend / d;
175
176 return dividend;
177}
178
179/* calculate the quartic root of "a" using Newton-Raphson */
180static u32 qroot(u64 a)
181{
182 u32 x, x1;
183
184 /* Initial estimate is based on:
185 * qrt(x) = exp(log(x) / 4)
186 */
187 x = 1u << (fls64(a) >> 2);
188
189 /*
190 * Iteration based on:
191 * 3
192 * x = ( 3 * x + a / x ) / 4
193 * k+1 k k
194 */
195 do {
196 u64 x3 = x;
197
198 x1 = x;
199 x3 *= x;
200 x3 *= x;
201
202 x = (3 * x + (u32) div64_64(a, x3)) / 4;
203 } while (abs(x1 - x) > 1);
204
205 return x;
206}
207
208
209/*
210 * If the connection is idle and we are restarting,
211 * then we don't want to do any Vegas calculations
212 * until we get fresh RTT samples. So when we
213 * restart, we reset our Vegas state to a clean
214 * slate. After we get acks for this flight of
215 * packets, _then_ we can make Vegas calculations
216 * again.
217 */
218static void tcp_compound_cwnd_event(struct sock *sk, enum tcp_ca_event event)
219{
220 if (event == CA_EVENT_CWND_RESTART || event == CA_EVENT_TX_START)
221 tcp_compound_init(sk);
222}
223
224static void tcp_compound_cong_avoid(struct sock *sk, u32 ack,
225 u32 seq_rtt, u32 in_flight, int flag)
226{
227 struct tcp_sock *tp = tcp_sk(sk);
228 struct compound *vegas = inet_csk_ca(sk);
229 u8 inc = 0;
230
231 if (vegas->cwnd + vegas->dwnd > tp->snd_cwnd) {
232 if (vegas->cwnd > tp->snd_cwnd || vegas->dwnd > tp->snd_cwnd) {
233 vegas->cwnd = tp->snd_cwnd;
234 vegas->dwnd = 0;
235 } else
236 vegas->cwnd = tp->snd_cwnd - vegas->dwnd;
237
238 }
239
240 if (!tcp_is_cwnd_limited(sk, in_flight))
241 return;
242
243 if (vegas->cwnd <= tp->snd_ssthresh)
244 inc = 1;
245 else if (tp->snd_cwnd_cnt < tp->snd_cwnd)
246 tp->snd_cwnd_cnt++;
247
248 if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
249 inc = 1;
250 tp->snd_cwnd_cnt = 0;
251 }
252
253 if (inc && tp->snd_cwnd < tp->snd_cwnd_clamp)
254 vegas->cwnd++;
255
256 /* The key players are v_beg_snd_una and v_beg_snd_nxt.
257 *
258 * These are so named because they represent the approximate values
259 * of snd_una and snd_nxt at the beginning of the current RTT. More
260 * precisely, they represent the amount of data sent during the RTT.
261 * At the end of the RTT, when we receive an ACK for v_beg_snd_nxt,
262 * we will calculate that (v_beg_snd_nxt - v_beg_snd_una) outstanding
263 * bytes of data have been ACKed during the course of the RTT, giving
264 * an "actual" rate of:
265 *
266 * (v_beg_snd_nxt - v_beg_snd_una) / (rtt duration)
267 *
268 * Unfortunately, v_beg_snd_una is not exactly equal to snd_una,
269 * because delayed ACKs can cover more than one segment, so they
270 * don't line up nicely with the boundaries of RTTs.
271 *
272 * Another unfortunate fact of life is that delayed ACKs delay the
273 * advance of the left edge of our send window, so that the number
274 * of bytes we send in an RTT is often less than our cwnd will allow.
275 * So we keep track of our cwnd separately, in v_beg_snd_cwnd.
276 */
277
278 if (after(ack, vegas->beg_snd_nxt)) {
279 /* Do the Vegas once-per-RTT cwnd adjustment. */
280 u32 old_wnd, old_snd_cwnd;
281
282 /* Here old_wnd is essentially the window of data that was
283 * sent during the previous RTT, and has all
284 * been acknowledged in the course of the RTT that ended
285 * with the ACK we just received. Likewise, old_snd_cwnd
286 * is the cwnd during the previous RTT.
287 */
288 if (!tp->mss_cache)
289 return;
290
291 old_wnd = (vegas->beg_snd_nxt - vegas->beg_snd_una) /
292 tp->mss_cache;
293 old_snd_cwnd = vegas->beg_snd_cwnd;
294
295 /* Save the extent of the current window so we can use this
296 * at the end of the next RTT.
297 */
298 vegas->beg_snd_una = vegas->beg_snd_nxt;
299 vegas->beg_snd_nxt = tp->snd_nxt;
300 vegas->beg_snd_cwnd = tp->snd_cwnd;
301
302 /* We do the Vegas calculations only if we got enough RTT
303 * samples that we can be reasonably sure that we got
304 * at least one RTT sample that wasn't from a delayed ACK.
305 * If we only had 2 samples total,
306 * then that means we're getting only 1 ACK per RTT, which
307 * means they're almost certainly delayed ACKs.
308 * If we have 3 samples, we should be OK.
309 */
310
311 if (vegas->cntRTT > 2) {
312 u32 rtt, target_cwnd, diff;
313 u32 brtt, dwnd;
314
315 /* We have enough RTT samples, so, using the Vegas
316 * algorithm, we determine if we should increase or
317 * decrease cwnd, and by how much.
318 */
319
320 /* Pluck out the RTT we are using for the Vegas
321 * calculations. This is the min RTT seen during the
322 * last RTT. Taking the min filters out the effects
323 * of delayed ACKs, at the cost of noticing congestion
324 * a bit later.
325 */
326 rtt = vegas->minRTT;
327
328 /* Calculate the cwnd we should have, if we weren't
329 * going too fast.
330 *
331 * This is:
332 * (actual rate in segments) * baseRTT
333 * We keep it as a fixed point number with
334 * V_PARAM_SHIFT bits to the right of the binary point.
335 */
336 if (!rtt)
337 return;
338
339 brtt = vegas->baseRTT;
340 target_cwnd = ((old_wnd * brtt)
341 << V_PARAM_SHIFT) / rtt;
342
343 /* Calculate the difference between the window we had,
344 * and the window we would like to have. This quantity
345 * is the "Diff" from the Arizona Vegas papers.
346 *
347 * Again, this is a fixed point number with
348 * V_PARAM_SHIFT bits to the right of the binary
349 * point.
350 */
351
352 diff = (old_wnd << V_PARAM_SHIFT) - target_cwnd;
353
354 dwnd = vegas->dwnd;
355
356 if (diff < (TCP_COMPOUND_GAMMA << V_PARAM_SHIFT)) {
357 u64 v;
358 u32 x;
359
360 /*
361 * The TCP Compound paper describes the choice
362 * of "k" determines the agressiveness,
363 * ie. slope of the response function.
364 *
365 * For same value as HSTCP would be 0.8
366 * but for computaional reasons, both the
367 * original authors and this implementation
368 * use 0.75.
369 */
370 v = old_wnd;
371 x = qroot(v * v * v) >> TCP_COMPOUND_ALPHA;
372 if (x > 1)
373 dwnd = x - 1;
374 else
375 dwnd = 0;
376
377 dwnd += vegas->dwnd;
378
379 } else if ((dwnd << V_PARAM_SHIFT) <
380 (diff * TCP_COMPOUND_BETA))
381 dwnd = 0;
382 else
383 dwnd =
384 ((dwnd << V_PARAM_SHIFT) -
385 (diff *
386 TCP_COMPOUND_BETA)) >> V_PARAM_SHIFT;
387
388 vegas->dwnd = dwnd;
389
390 }
391
392 /* Wipe the slate clean for the next RTT. */
393 vegas->cntRTT = 0;
394 vegas->minRTT = 0x7fffffff;
395 }
396
397 tp->snd_cwnd = vegas->cwnd + vegas->dwnd;
398}
399
400/* Extract info for Tcp socket info provided via netlink. */
401static void tcp_compound_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
402{
403 const struct compound *ca = inet_csk_ca(sk);
404 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
405 struct tcpvegas_info *info;
406
407 info = RTA_DATA(__RTA_PUT(skb, INET_DIAG_VEGASINFO,
408 sizeof(*info)));
409
410 info->tcpv_enabled = ca->doing_vegas_now;
411 info->tcpv_rttcnt = ca->cntRTT;
412 info->tcpv_rtt = ca->baseRTT;
413 info->tcpv_minrtt = ca->minRTT;
414 rtattr_failure:;
415 }
416}
417
418static struct tcp_congestion_ops tcp_compound = {
419 .init = tcp_compound_init,
420 .ssthresh = tcp_reno_ssthresh,
421 .cong_avoid = tcp_compound_cong_avoid,
422 .rtt_sample = tcp_compound_rtt_calc,
423 .set_state = tcp_compound_state,
424 .cwnd_event = tcp_compound_cwnd_event,
425 .get_info = tcp_compound_get_info,
426
427 .owner = THIS_MODULE,
428 .name = "compound",
429};
430
431static int __init tcp_compound_register(void)
432{
433 BUG_ON(sizeof(struct compound) > ICSK_CA_PRIV_SIZE);
434 tcp_register_congestion_control(&tcp_compound);
435 return 0;
436}
437
438static void __exit tcp_compound_unregister(void)
439{
440 tcp_unregister_congestion_control(&tcp_compound);
441}
442
443module_init(tcp_compound_register);
444module_exit(tcp_compound_unregister);
445
446MODULE_AUTHOR("Angelo P. Castellani, Stephen Hemminger");
447MODULE_LICENSE("GPL");
448MODULE_DESCRIPTION("TCP Compound");
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 91c2f41c7f58..857eefc52aab 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -38,7 +38,7 @@ int tcp_register_congestion_control(struct tcp_congestion_ops *ca)
38 int ret = 0; 38 int ret = 0;
39 39
40 /* all algorithms must implement ssthresh and cong_avoid ops */ 40 /* all algorithms must implement ssthresh and cong_avoid ops */
41 if (!ca->ssthresh || !ca->cong_avoid || !ca->min_cwnd) { 41 if (!ca->ssthresh || !ca->cong_avoid) {
42 printk(KERN_ERR "TCP %s does not implement required ops\n", 42 printk(KERN_ERR "TCP %s does not implement required ops\n",
43 ca->name); 43 ca->name);
44 return -EINVAL; 44 return -EINVAL;
@@ -251,8 +251,8 @@ u32 tcp_reno_ssthresh(struct sock *sk)
251} 251}
252EXPORT_SYMBOL_GPL(tcp_reno_ssthresh); 252EXPORT_SYMBOL_GPL(tcp_reno_ssthresh);
253 253
254/* Lower bound on congestion window. */ 254/* Lower bound on congestion window with halving. */
255u32 tcp_reno_min_cwnd(struct sock *sk) 255u32 tcp_reno_min_cwnd(const struct sock *sk)
256{ 256{
257 const struct tcp_sock *tp = tcp_sk(sk); 257 const struct tcp_sock *tp = tcp_sk(sk);
258 return tp->snd_ssthresh/2; 258 return tp->snd_ssthresh/2;
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
index 31a4986dfbf7..78b7a6b9e4de 100644
--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -325,11 +325,6 @@ static u32 bictcp_undo_cwnd(struct sock *sk)
325 return max(tcp_sk(sk)->snd_cwnd, ca->last_max_cwnd); 325 return max(tcp_sk(sk)->snd_cwnd, ca->last_max_cwnd);
326} 326}
327 327
328static u32 bictcp_min_cwnd(struct sock *sk)
329{
330 return tcp_sk(sk)->snd_ssthresh;
331}
332
333static void bictcp_state(struct sock *sk, u8 new_state) 328static void bictcp_state(struct sock *sk, u8 new_state)
334{ 329{
335 if (new_state == TCP_CA_Loss) 330 if (new_state == TCP_CA_Loss)
@@ -357,7 +352,6 @@ static struct tcp_congestion_ops cubictcp = {
357 .cong_avoid = bictcp_cong_avoid, 352 .cong_avoid = bictcp_cong_avoid,
358 .set_state = bictcp_state, 353 .set_state = bictcp_state,
359 .undo_cwnd = bictcp_undo_cwnd, 354 .undo_cwnd = bictcp_undo_cwnd,
360 .min_cwnd = bictcp_min_cwnd,
361 .pkts_acked = bictcp_acked, 355 .pkts_acked = bictcp_acked,
362 .owner = THIS_MODULE, 356 .owner = THIS_MODULE,
363 .name = "cubic", 357 .name = "cubic",
diff --git a/net/ipv4/tcp_highspeed.c b/net/ipv4/tcp_highspeed.c
index ba7c63ca5bb1..1120245b2373 100644
--- a/net/ipv4/tcp_highspeed.c
+++ b/net/ipv4/tcp_highspeed.c
@@ -98,6 +98,10 @@ struct hstcp {
98 u32 ai; 98 u32 ai;
99}; 99};
100 100
101static int max_ssthresh = 100;
102module_param(max_ssthresh, int, 0644);
103MODULE_PARM_DESC(max_ssthresh, "limited slow start threshold (RFC3742)");
104
101static void hstcp_init(struct sock *sk) 105static void hstcp_init(struct sock *sk)
102{ 106{
103 struct tcp_sock *tp = tcp_sk(sk); 107 struct tcp_sock *tp = tcp_sk(sk);
@@ -119,9 +123,23 @@ static void hstcp_cong_avoid(struct sock *sk, u32 adk, u32 rtt,
119 if (!tcp_is_cwnd_limited(sk, in_flight)) 123 if (!tcp_is_cwnd_limited(sk, in_flight))
120 return; 124 return;
121 125
122 if (tp->snd_cwnd <= tp->snd_ssthresh) 126 if (tp->snd_cwnd <= tp->snd_ssthresh) {
123 tcp_slow_start(tp); 127 /* RFC3742: limited slow start
124 else { 128 * the window is increased by 1/K MSS for each arriving ACK,
129 * for K = int(cwnd/(0.5 max_ssthresh))
130 */
131 if (max_ssthresh > 0 && tp->snd_cwnd > max_ssthresh) {
132 u32 k = max(tp->snd_cwnd / (max_ssthresh >> 1), 1U);
133 if (++tp->snd_cwnd_cnt >= k) {
134 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
135 tp->snd_cwnd++;
136 tp->snd_cwnd_cnt = 0;
137 }
138 } else {
139 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
140 tp->snd_cwnd++;
141 }
142 } else {
125 /* Update AIMD parameters */ 143 /* Update AIMD parameters */
126 if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) { 144 if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) {
127 while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd && 145 while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd &&
diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c
index 1b2ff53f98ed..3d92c1859267 100644
--- a/net/ipv4/tcp_htcp.c
+++ b/net/ipv4/tcp_htcp.c
@@ -246,14 +246,6 @@ static void htcp_cong_avoid(struct sock *sk, u32 ack, u32 rtt,
246 } 246 }
247} 247}
248 248
249/* Lower bound on congestion window. */
250static u32 htcp_min_cwnd(struct sock *sk)
251{
252 const struct tcp_sock *tp = tcp_sk(sk);
253 return tp->snd_ssthresh;
254}
255
256
257static void htcp_init(struct sock *sk) 249static void htcp_init(struct sock *sk)
258{ 250{
259 struct htcp *ca = inet_csk_ca(sk); 251 struct htcp *ca = inet_csk_ca(sk);
@@ -285,7 +277,6 @@ static void htcp_state(struct sock *sk, u8 new_state)
285static struct tcp_congestion_ops htcp = { 277static struct tcp_congestion_ops htcp = {
286 .init = htcp_init, 278 .init = htcp_init,
287 .ssthresh = htcp_recalc_ssthresh, 279 .ssthresh = htcp_recalc_ssthresh,
288 .min_cwnd = htcp_min_cwnd,
289 .cong_avoid = htcp_cong_avoid, 280 .cong_avoid = htcp_cong_avoid,
290 .set_state = htcp_state, 281 .set_state = htcp_state,
291 .undo_cwnd = htcp_cwnd_undo, 282 .undo_cwnd = htcp_cwnd_undo,
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 4a538bc1683d..e08245bdda3a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -71,6 +71,7 @@
71#include <net/inet_common.h> 71#include <net/inet_common.h>
72#include <linux/ipsec.h> 72#include <linux/ipsec.h>
73#include <asm/unaligned.h> 73#include <asm/unaligned.h>
74#include <net/netdma.h>
74 75
75int sysctl_tcp_timestamps = 1; 76int sysctl_tcp_timestamps = 1;
76int sysctl_tcp_window_scaling = 1; 77int sysctl_tcp_window_scaling = 1;
@@ -1649,7 +1650,7 @@ static void tcp_update_scoreboard(struct sock *sk, struct tcp_sock *tp)
1649 * Hence, we can detect timed out packets during fast 1650 * Hence, we can detect timed out packets during fast
1650 * retransmit without falling to slow start. 1651 * retransmit without falling to slow start.
1651 */ 1652 */
1652 if (tcp_head_timedout(sk, tp)) { 1653 if (!IsReno(tp) && tcp_head_timedout(sk, tp)) {
1653 struct sk_buff *skb; 1654 struct sk_buff *skb;
1654 1655
1655 skb = tp->scoreboard_skb_hint ? tp->scoreboard_skb_hint 1656 skb = tp->scoreboard_skb_hint ? tp->scoreboard_skb_hint
@@ -1662,8 +1663,6 @@ static void tcp_update_scoreboard(struct sock *sk, struct tcp_sock *tp)
1662 if (!(TCP_SKB_CB(skb)->sacked&TCPCB_TAGBITS)) { 1663 if (!(TCP_SKB_CB(skb)->sacked&TCPCB_TAGBITS)) {
1663 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; 1664 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
1664 tp->lost_out += tcp_skb_pcount(skb); 1665 tp->lost_out += tcp_skb_pcount(skb);
1665 if (IsReno(tp))
1666 tcp_remove_reno_sacks(sk, tp, tcp_skb_pcount(skb) + 1);
1667 1666
1668 /* clear xmit_retrans hint */ 1667 /* clear xmit_retrans hint */
1669 if (tp->retransmit_skb_hint && 1668 if (tp->retransmit_skb_hint &&
@@ -1690,17 +1689,26 @@ static inline void tcp_moderate_cwnd(struct tcp_sock *tp)
1690 tp->snd_cwnd_stamp = tcp_time_stamp; 1689 tp->snd_cwnd_stamp = tcp_time_stamp;
1691} 1690}
1692 1691
1692/* Lower bound on congestion window is slow start threshold
1693 * unless congestion avoidance choice decides to overide it.
1694 */
1695static inline u32 tcp_cwnd_min(const struct sock *sk)
1696{
1697 const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops;
1698
1699 return ca_ops->min_cwnd ? ca_ops->min_cwnd(sk) : tcp_sk(sk)->snd_ssthresh;
1700}
1701
1693/* Decrease cwnd each second ack. */ 1702/* Decrease cwnd each second ack. */
1694static void tcp_cwnd_down(struct sock *sk) 1703static void tcp_cwnd_down(struct sock *sk)
1695{ 1704{
1696 const struct inet_connection_sock *icsk = inet_csk(sk);
1697 struct tcp_sock *tp = tcp_sk(sk); 1705 struct tcp_sock *tp = tcp_sk(sk);
1698 int decr = tp->snd_cwnd_cnt + 1; 1706 int decr = tp->snd_cwnd_cnt + 1;
1699 1707
1700 tp->snd_cwnd_cnt = decr&1; 1708 tp->snd_cwnd_cnt = decr&1;
1701 decr >>= 1; 1709 decr >>= 1;
1702 1710
1703 if (decr && tp->snd_cwnd > icsk->icsk_ca_ops->min_cwnd(sk)) 1711 if (decr && tp->snd_cwnd > tcp_cwnd_min(sk))
1704 tp->snd_cwnd -= decr; 1712 tp->snd_cwnd -= decr;
1705 1713
1706 tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1); 1714 tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
@@ -3787,6 +3795,50 @@ static inline int tcp_checksum_complete_user(struct sock *sk, struct sk_buff *sk
3787 __tcp_checksum_complete_user(sk, skb); 3795 __tcp_checksum_complete_user(sk, skb);
3788} 3796}
3789 3797
3798#ifdef CONFIG_NET_DMA
3799static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb, int hlen)
3800{
3801 struct tcp_sock *tp = tcp_sk(sk);
3802 int chunk = skb->len - hlen;
3803 int dma_cookie;
3804 int copied_early = 0;
3805
3806 if (tp->ucopy.wakeup)
3807 return 0;
3808
3809 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
3810 tp->ucopy.dma_chan = get_softnet_dma();
3811
3812 if (tp->ucopy.dma_chan && skb->ip_summed == CHECKSUM_UNNECESSARY) {
3813
3814 dma_cookie = dma_skb_copy_datagram_iovec(tp->ucopy.dma_chan,
3815 skb, hlen, tp->ucopy.iov, chunk, tp->ucopy.pinned_list);
3816
3817 if (dma_cookie < 0)
3818 goto out;
3819
3820 tp->ucopy.dma_cookie = dma_cookie;
3821 copied_early = 1;
3822
3823 tp->ucopy.len -= chunk;
3824 tp->copied_seq += chunk;
3825 tcp_rcv_space_adjust(sk);
3826
3827 if ((tp->ucopy.len == 0) ||
3828 (tcp_flag_word(skb->h.th) & TCP_FLAG_PSH) ||
3829 (atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1))) {
3830 tp->ucopy.wakeup = 1;
3831 sk->sk_data_ready(sk, 0);
3832 }
3833 } else if (chunk > 0) {
3834 tp->ucopy.wakeup = 1;
3835 sk->sk_data_ready(sk, 0);
3836 }
3837out:
3838 return copied_early;
3839}
3840#endif /* CONFIG_NET_DMA */
3841
3790/* 3842/*
3791 * TCP receive function for the ESTABLISHED state. 3843 * TCP receive function for the ESTABLISHED state.
3792 * 3844 *
@@ -3888,8 +3940,6 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
3888 tp->rcv_nxt == tp->rcv_wup) 3940 tp->rcv_nxt == tp->rcv_wup)
3889 tcp_store_ts_recent(tp); 3941 tcp_store_ts_recent(tp);
3890 3942
3891 tcp_rcv_rtt_measure_ts(sk, skb);
3892
3893 /* We know that such packets are checksummed 3943 /* We know that such packets are checksummed
3894 * on entry. 3944 * on entry.
3895 */ 3945 */
@@ -3903,14 +3953,23 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
3903 } 3953 }
3904 } else { 3954 } else {
3905 int eaten = 0; 3955 int eaten = 0;
3956 int copied_early = 0;
3906 3957
3907 if (tp->ucopy.task == current && 3958 if (tp->copied_seq == tp->rcv_nxt &&
3908 tp->copied_seq == tp->rcv_nxt && 3959 len - tcp_header_len <= tp->ucopy.len) {
3909 len - tcp_header_len <= tp->ucopy.len && 3960#ifdef CONFIG_NET_DMA
3910 sock_owned_by_user(sk)) { 3961 if (tcp_dma_try_early_copy(sk, skb, tcp_header_len)) {
3911 __set_current_state(TASK_RUNNING); 3962 copied_early = 1;
3963 eaten = 1;
3964 }
3965#endif
3966 if (tp->ucopy.task == current && sock_owned_by_user(sk) && !copied_early) {
3967 __set_current_state(TASK_RUNNING);
3912 3968
3913 if (!tcp_copy_to_iovec(sk, skb, tcp_header_len)) { 3969 if (!tcp_copy_to_iovec(sk, skb, tcp_header_len))
3970 eaten = 1;
3971 }
3972 if (eaten) {
3914 /* Predicted packet is in window by definition. 3973 /* Predicted packet is in window by definition.
3915 * seq == rcv_nxt and rcv_wup <= rcv_nxt. 3974 * seq == rcv_nxt and rcv_wup <= rcv_nxt.
3916 * Hence, check seq<=rcv_wup reduces to: 3975 * Hence, check seq<=rcv_wup reduces to:
@@ -3926,8 +3985,9 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
3926 __skb_pull(skb, tcp_header_len); 3985 __skb_pull(skb, tcp_header_len);
3927 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 3986 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
3928 NET_INC_STATS_BH(LINUX_MIB_TCPHPHITSTOUSER); 3987 NET_INC_STATS_BH(LINUX_MIB_TCPHPHITSTOUSER);
3929 eaten = 1;
3930 } 3988 }
3989 if (copied_early)
3990 tcp_cleanup_rbuf(sk, skb->len);
3931 } 3991 }
3932 if (!eaten) { 3992 if (!eaten) {
3933 if (tcp_checksum_complete_user(sk, skb)) 3993 if (tcp_checksum_complete_user(sk, skb))
@@ -3968,6 +4028,11 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
3968 4028
3969 __tcp_ack_snd_check(sk, 0); 4029 __tcp_ack_snd_check(sk, 0);
3970no_ack: 4030no_ack:
4031#ifdef CONFIG_NET_DMA
4032 if (copied_early)
4033 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
4034 else
4035#endif
3971 if (eaten) 4036 if (eaten)
3972 __kfree_skb(skb); 4037 __kfree_skb(skb);
3973 else 4038 else
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 672950e54c49..25ecc6e2478b 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -71,6 +71,7 @@
71#include <net/inet_common.h> 71#include <net/inet_common.h>
72#include <net/timewait_sock.h> 72#include <net/timewait_sock.h>
73#include <net/xfrm.h> 73#include <net/xfrm.h>
74#include <net/netdma.h>
74 75
75#include <linux/inet.h> 76#include <linux/inet.h>
76#include <linux/ipv6.h> 77#include <linux/ipv6.h>
@@ -1091,8 +1092,18 @@ process:
1091 bh_lock_sock(sk); 1092 bh_lock_sock(sk);
1092 ret = 0; 1093 ret = 0;
1093 if (!sock_owned_by_user(sk)) { 1094 if (!sock_owned_by_user(sk)) {
1094 if (!tcp_prequeue(sk, skb)) 1095#ifdef CONFIG_NET_DMA
1096 struct tcp_sock *tp = tcp_sk(sk);
1097 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
1098 tp->ucopy.dma_chan = get_softnet_dma();
1099 if (tp->ucopy.dma_chan)
1095 ret = tcp_v4_do_rcv(sk, skb); 1100 ret = tcp_v4_do_rcv(sk, skb);
1101 else
1102#endif
1103 {
1104 if (!tcp_prequeue(sk, skb))
1105 ret = tcp_v4_do_rcv(sk, skb);
1106 }
1096 } else 1107 } else
1097 sk_add_backlog(sk, skb); 1108 sk_add_backlog(sk, skb);
1098 bh_unlock_sock(sk); 1109 bh_unlock_sock(sk);
@@ -1296,6 +1307,11 @@ int tcp_v4_destroy_sock(struct sock *sk)
1296 /* Cleans up our, hopefully empty, out_of_order_queue. */ 1307 /* Cleans up our, hopefully empty, out_of_order_queue. */
1297 __skb_queue_purge(&tp->out_of_order_queue); 1308 __skb_queue_purge(&tp->out_of_order_queue);
1298 1309
1310#ifdef CONFIG_NET_DMA
1311 /* Cleans up our sk_async_wait_queue */
1312 __skb_queue_purge(&sk->sk_async_wait_queue);
1313#endif
1314
1299 /* Clean prequeue, it must be empty really */ 1315 /* Clean prequeue, it must be empty really */
1300 __skb_queue_purge(&tp->ucopy.prequeue); 1316 __skb_queue_purge(&tp->ucopy.prequeue);
1301 1317
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
new file mode 100644
index 000000000000..1f977b6ee9a1
--- /dev/null
+++ b/net/ipv4/tcp_lp.c
@@ -0,0 +1,338 @@
1/*
2 * TCP Low Priority (TCP-LP)
3 *
4 * TCP Low Priority is a distributed algorithm whose goal is to utilize only
5 * the excess network bandwidth as compared to the ``fair share`` of
6 * bandwidth as targeted by TCP. Available from:
7 * http://www.ece.rice.edu/~akuzma/Doc/akuzma/TCP-LP.pdf
8 *
9 * Original Author:
10 * Aleksandar Kuzmanovic <akuzma@northwestern.edu>
11 *
12 * See http://www-ece.rice.edu/networks/TCP-LP/ for their implementation.
13 * As of 2.6.13, Linux supports pluggable congestion control algorithms.
14 * Due to the limitation of the API, we take the following changes from
15 * the original TCP-LP implementation:
16 * o We use newReno in most core CA handling. Only add some checking
17 * within cong_avoid.
18 * o Error correcting in remote HZ, therefore remote HZ will be keeped
19 * on checking and updating.
20 * o Handling calculation of One-Way-Delay (OWD) within rtt_sample, sicne
21 * OWD have a similar meaning as RTT. Also correct the buggy formular.
22 * o Handle reaction for Early Congestion Indication (ECI) within
23 * pkts_acked, as mentioned within pseudo code.
24 * o OWD is handled in relative format, where local time stamp will in
25 * tcp_time_stamp format.
26 *
27 * Port from 2.4.19 to 2.6.16 as module by:
28 * Wong Hoi Sing Edison <hswong3i@gmail.com>
29 * Hung Hing Lun <hlhung3i@gmail.com>
30 *
31 * Version: $Id: tcp_lp.c,v 1.22 2006-05-02 18:18:19 hswong3i Exp $
32 */
33
34#include <linux/config.h>
35#include <linux/module.h>
36#include <net/tcp.h>
37
38/* resolution of owd */
39#define LP_RESOL 1000
40
41/**
42 * enum tcp_lp_state
43 * @LP_VALID_RHZ: is remote HZ valid?
44 * @LP_VALID_OWD: is OWD valid?
45 * @LP_WITHIN_THR: are we within threshold?
46 * @LP_WITHIN_INF: are we within inference?
47 *
48 * TCP-LP's state flags.
49 * We create this set of state flag mainly for debugging.
50 */
51enum tcp_lp_state {
52 LP_VALID_RHZ = (1 << 0),
53 LP_VALID_OWD = (1 << 1),
54 LP_WITHIN_THR = (1 << 3),
55 LP_WITHIN_INF = (1 << 4),
56};
57
58/**
59 * struct lp
60 * @flag: TCP-LP state flag
61 * @sowd: smoothed OWD << 3
62 * @owd_min: min OWD
63 * @owd_max: max OWD
64 * @owd_max_rsv: resrved max owd
65 * @remote_hz: estimated remote HZ
66 * @remote_ref_time: remote reference time
67 * @local_ref_time: local reference time
68 * @last_drop: time for last active drop
69 * @inference: current inference
70 *
71 * TCP-LP's private struct.
72 * We get the idea from original TCP-LP implementation where only left those we
73 * found are really useful.
74 */
75struct lp {
76 u32 flag;
77 u32 sowd;
78 u32 owd_min;
79 u32 owd_max;
80 u32 owd_max_rsv;
81 u32 remote_hz;
82 u32 remote_ref_time;
83 u32 local_ref_time;
84 u32 last_drop;
85 u32 inference;
86};
87
88/**
89 * tcp_lp_init
90 *
91 * Init all required variables.
92 * Clone the handling from Vegas module implementation.
93 */
94static void tcp_lp_init(struct sock *sk)
95{
96 struct lp *lp = inet_csk_ca(sk);
97
98 lp->flag = 0;
99 lp->sowd = 0;
100 lp->owd_min = 0xffffffff;
101 lp->owd_max = 0;
102 lp->owd_max_rsv = 0;
103 lp->remote_hz = 0;
104 lp->remote_ref_time = 0;
105 lp->local_ref_time = 0;
106 lp->last_drop = 0;
107 lp->inference = 0;
108}
109
110/**
111 * tcp_lp_cong_avoid
112 *
113 * Implementation of cong_avoid.
114 * Will only call newReno CA when away from inference.
115 * From TCP-LP's paper, this will be handled in additive increasement.
116 */
117static void tcp_lp_cong_avoid(struct sock *sk, u32 ack, u32 rtt, u32 in_flight,
118 int flag)
119{
120 struct lp *lp = inet_csk_ca(sk);
121
122 if (!(lp->flag & LP_WITHIN_INF))
123 tcp_reno_cong_avoid(sk, ack, rtt, in_flight, flag);
124}
125
126/**
127 * tcp_lp_remote_hz_estimator
128 *
129 * Estimate remote HZ.
130 * We keep on updating the estimated value, where original TCP-LP
131 * implementation only guest it for once and use forever.
132 */
133static u32 tcp_lp_remote_hz_estimator(struct sock *sk)
134{
135 struct tcp_sock *tp = tcp_sk(sk);
136 struct lp *lp = inet_csk_ca(sk);
137 s64 rhz = lp->remote_hz << 6; /* remote HZ << 6 */
138 s64 m = 0;
139
140 /* not yet record reference time
141 * go away!! record it before come back!! */
142 if (lp->remote_ref_time == 0 || lp->local_ref_time == 0)
143 goto out;
144
145 /* we can't calc remote HZ with no different!! */
146 if (tp->rx_opt.rcv_tsval == lp->remote_ref_time
147 || tp->rx_opt.rcv_tsecr == lp->local_ref_time)
148 goto out;
149
150 m = HZ * (tp->rx_opt.rcv_tsval -
151 lp->remote_ref_time) / (tp->rx_opt.rcv_tsecr -
152 lp->local_ref_time);
153 if (m < 0)
154 m = -m;
155
156 if (rhz != 0) {
157 m -= rhz >> 6; /* m is now error in remote HZ est */
158 rhz += m; /* 63/64 old + 1/64 new */
159 } else
160 rhz = m << 6;
161
162 /* record time for successful remote HZ calc */
163 lp->flag |= LP_VALID_RHZ;
164
165 out:
166 /* record reference time stamp */
167 lp->remote_ref_time = tp->rx_opt.rcv_tsval;
168 lp->local_ref_time = tp->rx_opt.rcv_tsecr;
169
170 return rhz >> 6;
171}
172
173/**
174 * tcp_lp_owd_calculator
175 *
176 * Calculate one way delay (in relative format).
177 * Original implement OWD as minus of remote time difference to local time
178 * difference directly. As this time difference just simply equal to RTT, when
179 * the network status is stable, remote RTT will equal to local RTT, and result
180 * OWD into zero.
181 * It seems to be a bug and so we fixed it.
182 */
183static u32 tcp_lp_owd_calculator(struct sock *sk)
184{
185 struct tcp_sock *tp = tcp_sk(sk);
186 struct lp *lp = inet_csk_ca(sk);
187 s64 owd = 0;
188
189 lp->remote_hz = tcp_lp_remote_hz_estimator(sk);
190
191 if (lp->flag & LP_VALID_RHZ) {
192 owd =
193 tp->rx_opt.rcv_tsval * (LP_RESOL / lp->remote_hz) -
194 tp->rx_opt.rcv_tsecr * (LP_RESOL / HZ);
195 if (owd < 0)
196 owd = -owd;
197 }
198
199 if (owd > 0)
200 lp->flag |= LP_VALID_OWD;
201 else
202 lp->flag &= ~LP_VALID_OWD;
203
204 return owd;
205}
206
207/**
208 * tcp_lp_rtt_sample
209 *
210 * Implementation or rtt_sample.
211 * Will take the following action,
212 * 1. calc OWD,
213 * 2. record the min/max OWD,
214 * 3. calc smoothed OWD (SOWD).
215 * Most ideas come from the original TCP-LP implementation.
216 */
217static void tcp_lp_rtt_sample(struct sock *sk, u32 usrtt)
218{
219 struct lp *lp = inet_csk_ca(sk);
220 s64 mowd = tcp_lp_owd_calculator(sk);
221
222 /* sorry that we don't have valid data */
223 if (!(lp->flag & LP_VALID_RHZ) || !(lp->flag & LP_VALID_OWD))
224 return;
225
226 /* record the next min owd */
227 if (mowd < lp->owd_min)
228 lp->owd_min = mowd;
229
230 /* always forget the max of the max
231 * we just set owd_max as one below it */
232 if (mowd > lp->owd_max) {
233 if (mowd > lp->owd_max_rsv) {
234 if (lp->owd_max_rsv == 0)
235 lp->owd_max = mowd;
236 else
237 lp->owd_max = lp->owd_max_rsv;
238 lp->owd_max_rsv = mowd;
239 } else
240 lp->owd_max = mowd;
241 }
242
243 /* calc for smoothed owd */
244 if (lp->sowd != 0) {
245 mowd -= lp->sowd >> 3; /* m is now error in owd est */
246 lp->sowd += mowd; /* owd = 7/8 owd + 1/8 new */
247 } else
248 lp->sowd = mowd << 3; /* take the measured time be owd */
249}
250
251/**
252 * tcp_lp_pkts_acked
253 *
254 * Implementation of pkts_acked.
255 * Deal with active drop under Early Congestion Indication.
256 * Only drop to half and 1 will be handle, because we hope to use back
257 * newReno in increase case.
258 * We work it out by following the idea from TCP-LP's paper directly
259 */
260static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked)
261{
262 struct tcp_sock *tp = tcp_sk(sk);
263 struct lp *lp = inet_csk_ca(sk);
264
265 /* calc inference */
266 if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
267 lp->inference = 3 * (tcp_time_stamp - tp->rx_opt.rcv_tsecr);
268
269 /* test if within inference */
270 if (lp->last_drop && (tcp_time_stamp - lp->last_drop < lp->inference))
271 lp->flag |= LP_WITHIN_INF;
272 else
273 lp->flag &= ~LP_WITHIN_INF;
274
275 /* test if within threshold */
276 if (lp->sowd >> 3 <
277 lp->owd_min + 15 * (lp->owd_max - lp->owd_min) / 100)
278 lp->flag |= LP_WITHIN_THR;
279 else
280 lp->flag &= ~LP_WITHIN_THR;
281
282 pr_debug("TCP-LP: %05o|%5u|%5u|%15u|%15u|%15u\n", lp->flag,
283 tp->snd_cwnd, lp->remote_hz, lp->owd_min, lp->owd_max,
284 lp->sowd >> 3);
285
286 if (lp->flag & LP_WITHIN_THR)
287 return;
288
289 /* FIXME: try to reset owd_min and owd_max here
290 * so decrease the chance the min/max is no longer suitable
291 * and will usually within threshold when whithin inference */
292 lp->owd_min = lp->sowd >> 3;
293 lp->owd_max = lp->sowd >> 2;
294 lp->owd_max_rsv = lp->sowd >> 2;
295
296 /* happened within inference
297 * drop snd_cwnd into 1 */
298 if (lp->flag & LP_WITHIN_INF)
299 tp->snd_cwnd = 1U;
300
301 /* happened after inference
302 * cut snd_cwnd into half */
303 else
304 tp->snd_cwnd = max(tp->snd_cwnd >> 1U, 1U);
305
306 /* record this drop time */
307 lp->last_drop = tcp_time_stamp;
308}
309
310static struct tcp_congestion_ops tcp_lp = {
311 .init = tcp_lp_init,
312 .ssthresh = tcp_reno_ssthresh,
313 .cong_avoid = tcp_lp_cong_avoid,
314 .min_cwnd = tcp_reno_min_cwnd,
315 .rtt_sample = tcp_lp_rtt_sample,
316 .pkts_acked = tcp_lp_pkts_acked,
317
318 .owner = THIS_MODULE,
319 .name = "lp"
320};
321
322static int __init tcp_lp_register(void)
323{
324 BUG_ON(sizeof(struct lp) > ICSK_CA_PRIV_SIZE);
325 return tcp_register_congestion_control(&tcp_lp);
326}
327
328static void __exit tcp_lp_unregister(void)
329{
330 tcp_unregister_congestion_control(&tcp_lp);
331}
332
333module_init(tcp_lp_register);
334module_exit(tcp_lp_unregister);
335
336MODULE_AUTHOR("Wong Hoi Sing Edison, Hung Hing Lun");
337MODULE_LICENSE("GPL");
338MODULE_DESCRIPTION("TCP Low Priority");
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f33c9dddaa12..07bb5a2b375e 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -59,6 +59,9 @@ 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
62/* By default, RFC2861 behavior. */
63int sysctl_tcp_slow_start_after_idle = 1;
64
62static void update_send_head(struct sock *sk, struct tcp_sock *tp, 65static void update_send_head(struct sock *sk, struct tcp_sock *tp,
63 struct sk_buff *skb) 66 struct sk_buff *skb)
64{ 67{
@@ -138,7 +141,8 @@ static void tcp_event_data_sent(struct tcp_sock *tp,
138 struct inet_connection_sock *icsk = inet_csk(sk); 141 struct inet_connection_sock *icsk = inet_csk(sk);
139 const u32 now = tcp_time_stamp; 142 const u32 now = tcp_time_stamp;
140 143
141 if (!tp->packets_out && (s32)(now - tp->lsndtime) > icsk->icsk_rto) 144 if (sysctl_tcp_slow_start_after_idle &&
145 (!tp->packets_out && (s32)(now - tp->lsndtime) > icsk->icsk_rto))
142 tcp_cwnd_restart(sk, __sk_dst_get(sk)); 146 tcp_cwnd_restart(sk, __sk_dst_get(sk));
143 147
144 tp->lsndtime = now; 148 tp->lsndtime = now;
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
new file mode 100644
index 000000000000..d7d517a3a238
--- /dev/null
+++ b/net/ipv4/tcp_probe.c
@@ -0,0 +1,181 @@
1/*
2 * tcpprobe - Observe the TCP flow with kprobes.
3 *
4 * The idea for this came from Werner Almesberger's umlsim
5 * Copyright (C) 2004, Stephen Hemminger <shemminger@osdl.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#include <linux/kernel.h>
23#include <linux/kprobes.h>
24#include <linux/socket.h>
25#include <linux/tcp.h>
26#include <linux/proc_fs.h>
27#include <linux/module.h>
28#include <linux/kfifo.h>
29#include <linux/vmalloc.h>
30
31#include <net/tcp.h>
32
33MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>");
34MODULE_DESCRIPTION("TCP cwnd snooper");
35MODULE_LICENSE("GPL");
36
37static int port = 0;
38MODULE_PARM_DESC(port, "Port to match (0=all)");
39module_param(port, int, 0);
40
41static int bufsize = 64*1024;
42MODULE_PARM_DESC(bufsize, "Log buffer size (default 64k)");
43module_param(bufsize, int, 0);
44
45static const char procname[] = "tcpprobe";
46
47struct {
48 struct kfifo *fifo;
49 spinlock_t lock;
50 wait_queue_head_t wait;
51 struct timeval tstart;
52} tcpw;
53
54static void printl(const char *fmt, ...)
55{
56 va_list args;
57 int len;
58 struct timeval now;
59 char tbuf[256];
60
61 va_start(args, fmt);
62 do_gettimeofday(&now);
63
64 now.tv_sec -= tcpw.tstart.tv_sec;
65 now.tv_usec -= tcpw.tstart.tv_usec;
66 if (now.tv_usec < 0) {
67 --now.tv_sec;
68 now.tv_usec += 1000000;
69 }
70
71 len = sprintf(tbuf, "%lu.%06lu ",
72 (unsigned long) now.tv_sec,
73 (unsigned long) now.tv_usec);
74 len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args);
75 va_end(args);
76
77 kfifo_put(tcpw.fifo, tbuf, len);
78 wake_up(&tcpw.wait);
79}
80
81static int jtcp_sendmsg(struct kiocb *iocb, struct sock *sk,
82 struct msghdr *msg, size_t size)
83{
84 const struct tcp_sock *tp = tcp_sk(sk);
85 const struct inet_sock *inet = inet_sk(sk);
86
87 if (port == 0 || ntohs(inet->dport) == port ||
88 ntohs(inet->sport) == port) {
89 printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %#x %#x %u %u %u\n",
90 NIPQUAD(inet->saddr), ntohs(inet->sport),
91 NIPQUAD(inet->daddr), ntohs(inet->dport),
92 size, tp->snd_nxt, tp->snd_una,
93 tp->snd_cwnd, tcp_current_ssthresh(sk),
94 tp->snd_wnd);
95 }
96
97 jprobe_return();
98 return 0;
99}
100
101static struct jprobe tcp_send_probe = {
102 .kp = { .addr = (kprobe_opcode_t *) &tcp_sendmsg, },
103 .entry = (kprobe_opcode_t *) &jtcp_sendmsg,
104};
105
106
107static int tcpprobe_open(struct inode * inode, struct file * file)
108{
109 kfifo_reset(tcpw.fifo);
110 do_gettimeofday(&tcpw.tstart);
111 return 0;
112}
113
114static ssize_t tcpprobe_read(struct file *file, char __user *buf,
115 size_t len, loff_t *ppos)
116{
117 int error = 0, cnt;
118 unsigned char *tbuf;
119
120 if (!buf || len < 0)
121 return -EINVAL;
122
123 if (len == 0)
124 return 0;
125
126 tbuf = vmalloc(len);
127 if (!tbuf)
128 return -ENOMEM;
129
130 error = wait_event_interruptible(tcpw.wait,
131 __kfifo_len(tcpw.fifo) != 0);
132 if (error)
133 return error;
134
135 cnt = kfifo_get(tcpw.fifo, tbuf, len);
136 error = copy_to_user(buf, tbuf, cnt);
137
138 vfree(tbuf);
139
140 return error ? error : cnt;
141}
142
143static struct file_operations tcpprobe_fops = {
144 .owner = THIS_MODULE,
145 .open = tcpprobe_open,
146 .read = tcpprobe_read,
147};
148
149static __init int tcpprobe_init(void)
150{
151 int ret = -ENOMEM;
152
153 init_waitqueue_head(&tcpw.wait);
154 spin_lock_init(&tcpw.lock);
155 tcpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &tcpw.lock);
156
157 if (!proc_net_fops_create(procname, S_IRUSR, &tcpprobe_fops))
158 goto err0;
159
160 ret = register_jprobe(&tcp_send_probe);
161 if (ret)
162 goto err1;
163
164 pr_info("TCP watch registered (port=%d)\n", port);
165 return 0;
166 err1:
167 proc_net_remove(procname);
168 err0:
169 kfifo_free(tcpw.fifo);
170 return ret;
171}
172module_init(tcpprobe_init);
173
174static __exit void tcpprobe_exit(void)
175{
176 kfifo_free(tcpw.fifo);
177 proc_net_remove(procname);
178 unregister_jprobe(&tcp_send_probe);
179
180}
181module_exit(tcpprobe_exit);
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
new file mode 100644
index 000000000000..11b42a7135c1
--- /dev/null
+++ b/net/ipv4/tcp_veno.c
@@ -0,0 +1,231 @@
1/*
2 * TCP Veno congestion control
3 *
4 * This is based on the congestion detection/avoidance scheme described in
5 * C. P. Fu, S. C. Liew.
6 * "TCP Veno: TCP Enhancement for Transmission over Wireless Access Networks."
7 * IEEE Journal on Selected Areas in Communication,
8 * Feb. 2003.
9 * See http://www.ntu.edu.sg/home5/ZHOU0022/papers/CPFu03a.pdf
10 */
11
12#include <linux/config.h>
13#include <linux/mm.h>
14#include <linux/module.h>
15#include <linux/skbuff.h>
16#include <linux/inet_diag.h>
17
18#include <net/tcp.h>
19
20/* Default values of the Veno variables, in fixed-point representation
21 * with V_PARAM_SHIFT bits to the right of the binary point.
22 */
23#define V_PARAM_SHIFT 1
24static const int beta = 3 << V_PARAM_SHIFT;
25
26/* Veno variables */
27struct veno {
28 u8 doing_veno_now; /* if true, do veno for this rtt */
29 u16 cntrtt; /* # of rtts measured within last rtt */
30 u32 minrtt; /* min of rtts measured within last rtt (in usec) */
31 u32 basertt; /* the min of all Veno rtt measurements seen (in usec) */
32 u32 inc; /* decide whether to increase cwnd */
33 u32 diff; /* calculate the diff rate */
34};
35
36/* There are several situations when we must "re-start" Veno:
37 *
38 * o when a connection is established
39 * o after an RTO
40 * o after fast recovery
41 * o when we send a packet and there is no outstanding
42 * unacknowledged data (restarting an idle connection)
43 *
44 */
45static inline void veno_enable(struct sock *sk)
46{
47 struct veno *veno = inet_csk_ca(sk);
48
49 /* turn on Veno */
50 veno->doing_veno_now = 1;
51
52 veno->minrtt = 0x7fffffff;
53}
54
55static inline void veno_disable(struct sock *sk)
56{
57 struct veno *veno = inet_csk_ca(sk);
58
59 /* turn off Veno */
60 veno->doing_veno_now = 0;
61}
62
63static void tcp_veno_init(struct sock *sk)
64{
65 struct veno *veno = inet_csk_ca(sk);
66
67 veno->basertt = 0x7fffffff;
68 veno->inc = 1;
69 veno_enable(sk);
70}
71
72/* Do rtt sampling needed for Veno. */
73static void tcp_veno_rtt_calc(struct sock *sk, u32 usrtt)
74{
75 struct veno *veno = inet_csk_ca(sk);
76 u32 vrtt = usrtt + 1; /* Never allow zero rtt or basertt */
77
78 /* Filter to find propagation delay: */
79 if (vrtt < veno->basertt)
80 veno->basertt = vrtt;
81
82 /* Find the min rtt during the last rtt to find
83 * the current prop. delay + queuing delay:
84 */
85 veno->minrtt = min(veno->minrtt, vrtt);
86 veno->cntrtt++;
87}
88
89static void tcp_veno_state(struct sock *sk, u8 ca_state)
90{
91 if (ca_state == TCP_CA_Open)
92 veno_enable(sk);
93 else
94 veno_disable(sk);
95}
96
97/*
98 * If the connection is idle and we are restarting,
99 * then we don't want to do any Veno calculations
100 * until we get fresh rtt samples. So when we
101 * restart, we reset our Veno state to a clean
102 * state. After we get acks for this flight of
103 * packets, _then_ we can make Veno calculations
104 * again.
105 */
106static void tcp_veno_cwnd_event(struct sock *sk, enum tcp_ca_event event)
107{
108 if (event == CA_EVENT_CWND_RESTART || event == CA_EVENT_TX_START)
109 tcp_veno_init(sk);
110}
111
112static void tcp_veno_cong_avoid(struct sock *sk, u32 ack,
113 u32 seq_rtt, u32 in_flight, int flag)
114{
115 struct tcp_sock *tp = tcp_sk(sk);
116 struct veno *veno = inet_csk_ca(sk);
117
118 if (!veno->doing_veno_now)
119 return tcp_reno_cong_avoid(sk, ack, seq_rtt, in_flight, flag);
120
121 /* limited by applications */
122 if (!tcp_is_cwnd_limited(sk, in_flight))
123 return;
124
125 /* We do the Veno calculations only if we got enough rtt samples */
126 if (veno->cntrtt <= 2) {
127 /* We don't have enough rtt samples to do the Veno
128 * calculation, so we'll behave like Reno.
129 */
130 tcp_reno_cong_avoid(sk, ack, seq_rtt, in_flight, flag);
131 } else {
132 u32 rtt, target_cwnd;
133
134 /* We have enough rtt samples, so, using the Veno
135 * algorithm, we determine the state of the network.
136 */
137
138 rtt = veno->minrtt;
139
140 target_cwnd = ((tp->snd_cwnd * veno->basertt)
141 << V_PARAM_SHIFT) / rtt;
142
143 veno->diff = (tp->snd_cwnd << V_PARAM_SHIFT) - target_cwnd;
144
145 if (tp->snd_cwnd <= tp->snd_ssthresh) {
146 /* Slow start. */
147 tcp_slow_start(tp);
148 } else {
149 /* Congestion avoidance. */
150 if (veno->diff < beta) {
151 /* In the "non-congestive state", increase cwnd
152 * every rtt.
153 */
154 if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
155 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
156 tp->snd_cwnd++;
157 tp->snd_cwnd_cnt = 0;
158 } else
159 tp->snd_cwnd_cnt++;
160 } else {
161 /* In the "congestive state", increase cwnd
162 * every other rtt.
163 */
164 if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
165 if (veno->inc
166 && tp->snd_cwnd <
167 tp->snd_cwnd_clamp) {
168 tp->snd_cwnd++;
169 veno->inc = 0;
170 } else
171 veno->inc = 1;
172 tp->snd_cwnd_cnt = 0;
173 } else
174 tp->snd_cwnd_cnt++;
175 }
176
177 }
178 if (tp->snd_cwnd < 2)
179 tp->snd_cwnd = 2;
180 else if (tp->snd_cwnd > tp->snd_cwnd_clamp)
181 tp->snd_cwnd = tp->snd_cwnd_clamp;
182 }
183 /* Wipe the slate clean for the next rtt. */
184 /* veno->cntrtt = 0; */
185 veno->minrtt = 0x7fffffff;
186}
187
188/* Veno MD phase */
189static u32 tcp_veno_ssthresh(struct sock *sk)
190{
191 const struct tcp_sock *tp = tcp_sk(sk);
192 struct veno *veno = inet_csk_ca(sk);
193
194 if (veno->diff < beta)
195 /* in "non-congestive state", cut cwnd by 1/5 */
196 return max(tp->snd_cwnd * 4 / 5, 2U);
197 else
198 /* in "congestive state", cut cwnd by 1/2 */
199 return max(tp->snd_cwnd >> 1U, 2U);
200}
201
202static struct tcp_congestion_ops tcp_veno = {
203 .init = tcp_veno_init,
204 .ssthresh = tcp_veno_ssthresh,
205 .cong_avoid = tcp_veno_cong_avoid,
206 .rtt_sample = tcp_veno_rtt_calc,
207 .set_state = tcp_veno_state,
208 .cwnd_event = tcp_veno_cwnd_event,
209
210 .owner = THIS_MODULE,
211 .name = "veno",
212};
213
214static int __init tcp_veno_register(void)
215{
216 BUG_ON(sizeof(struct veno) > ICSK_CA_PRIV_SIZE);
217 tcp_register_congestion_control(&tcp_veno);
218 return 0;
219}
220
221static void __exit tcp_veno_unregister(void)
222{
223 tcp_unregister_congestion_control(&tcp_veno);
224}
225
226module_init(tcp_veno_register);
227module_exit(tcp_veno_unregister);
228
229MODULE_AUTHOR("Bin Zhou, Cheng Peng Fu");
230MODULE_LICENSE("GPL");
231MODULE_DESCRIPTION("TCP Veno");
diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c
index 0c340c3756c2..4247da1384bf 100644
--- a/net/ipv4/tcp_westwood.c
+++ b/net/ipv4/tcp_westwood.c
@@ -1,7 +1,24 @@
1/* 1/*
2 * TCP Westwood+ 2 * TCP Westwood+: end-to-end bandwidth estimation for TCP
3 * 3 *
4 * Angelo Dell'Aera: TCP Westwood+ support 4 * Angelo Dell'Aera: author of the first version of TCP Westwood+ in Linux 2.4
5 *
6 * Support at http://c3lab.poliba.it/index.php/Westwood
7 * Main references in literature:
8 *
9 * - Mascolo S, Casetti, M. Gerla et al.
10 * "TCP Westwood: bandwidth estimation for TCP" Proc. ACM Mobicom 2001
11 *
12 * - A. Grieco, s. Mascolo
13 * "Performance evaluation of New Reno, Vegas, Westwood+ TCP" ACM Computer
14 * Comm. Review, 2004
15 *
16 * - A. Dell'Aera, L. Grieco, S. Mascolo.
17 * "Linux 2.4 Implementation of Westwood+ TCP with Rate-Halving :
18 * A Performance Evaluation Over the Internet" (ICC 2004), Paris, June 2004
19 *
20 * Westwood+ employs end-to-end bandwidth measurement to set cwnd and
21 * ssthresh after packet loss. The probing phase is as the original Reno.
5 */ 22 */
6 23
7#include <linux/config.h> 24#include <linux/config.h>
@@ -22,6 +39,8 @@ struct westwood {
22 u32 accounted; 39 u32 accounted;
23 u32 rtt; 40 u32 rtt;
24 u32 rtt_min; /* minimum observed RTT */ 41 u32 rtt_min; /* minimum observed RTT */
42 u8 first_ack; /* flag which infers that this is the first ack */
43 u8 reset_rtt_min; /* Reset RTT min to next RTT sample*/
25}; 44};
26 45
27 46
@@ -49,9 +68,11 @@ static void tcp_westwood_init(struct sock *sk)
49 w->bw_est = 0; 68 w->bw_est = 0;
50 w->accounted = 0; 69 w->accounted = 0;
51 w->cumul_ack = 0; 70 w->cumul_ack = 0;
71 w->reset_rtt_min = 1;
52 w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT; 72 w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT;
53 w->rtt_win_sx = tcp_time_stamp; 73 w->rtt_win_sx = tcp_time_stamp;
54 w->snd_una = tcp_sk(sk)->snd_una; 74 w->snd_una = tcp_sk(sk)->snd_una;
75 w->first_ack = 1;
55} 76}
56 77
57/* 78/*
@@ -63,10 +84,16 @@ static inline u32 westwood_do_filter(u32 a, u32 b)
63 return (((7 * a) + b) >> 3); 84 return (((7 * a) + b) >> 3);
64} 85}
65 86
66static inline void westwood_filter(struct westwood *w, u32 delta) 87static void westwood_filter(struct westwood *w, u32 delta)
67{ 88{
68 w->bw_ns_est = westwood_do_filter(w->bw_ns_est, w->bk / delta); 89 /* If the filter is empty fill it with the first sample of bandwidth */
69 w->bw_est = westwood_do_filter(w->bw_est, w->bw_ns_est); 90 if (w->bw_ns_est == 0 && w->bw_est == 0) {
91 w->bw_ns_est = w->bk / delta;
92 w->bw_est = w->bw_ns_est;
93 } else {
94 w->bw_ns_est = westwood_do_filter(w->bw_ns_est, w->bk / delta);
95 w->bw_est = westwood_do_filter(w->bw_est, w->bw_ns_est);
96 }
70} 97}
71 98
72/* 99/*
@@ -91,6 +118,15 @@ static void westwood_update_window(struct sock *sk)
91 struct westwood *w = inet_csk_ca(sk); 118 struct westwood *w = inet_csk_ca(sk);
92 s32 delta = tcp_time_stamp - w->rtt_win_sx; 119 s32 delta = tcp_time_stamp - w->rtt_win_sx;
93 120
121 /* Initialize w->snd_una with the first acked sequence number in order
122 * to fix mismatch between tp->snd_una and w->snd_una for the first
123 * bandwidth sample
124 */
125 if (w->first_ack) {
126 w->snd_una = tcp_sk(sk)->snd_una;
127 w->first_ack = 0;
128 }
129
94 /* 130 /*
95 * See if a RTT-window has passed. 131 * See if a RTT-window has passed.
96 * Be careful since if RTT is less than 132 * Be careful since if RTT is less than
@@ -108,6 +144,16 @@ static void westwood_update_window(struct sock *sk)
108 } 144 }
109} 145}
110 146
147static inline void update_rtt_min(struct westwood *w)
148{
149 if (w->reset_rtt_min) {
150 w->rtt_min = w->rtt;
151 w->reset_rtt_min = 0;
152 } else
153 w->rtt_min = min(w->rtt, w->rtt_min);
154}
155
156
111/* 157/*
112 * @westwood_fast_bw 158 * @westwood_fast_bw
113 * It is called when we are in fast path. In particular it is called when 159 * It is called when we are in fast path. In particular it is called when
@@ -123,7 +169,7 @@ static inline void westwood_fast_bw(struct sock *sk)
123 169
124 w->bk += tp->snd_una - w->snd_una; 170 w->bk += tp->snd_una - w->snd_una;
125 w->snd_una = tp->snd_una; 171 w->snd_una = tp->snd_una;
126 w->rtt_min = min(w->rtt, w->rtt_min); 172 update_rtt_min(w);
127} 173}
128 174
129/* 175/*
@@ -162,12 +208,6 @@ static inline u32 westwood_acked_count(struct sock *sk)
162 return w->cumul_ack; 208 return w->cumul_ack;
163} 209}
164 210
165static inline u32 westwood_bw_rttmin(const struct sock *sk)
166{
167 const struct tcp_sock *tp = tcp_sk(sk);
168 const struct westwood *w = inet_csk_ca(sk);
169 return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2);
170}
171 211
172/* 212/*
173 * TCP Westwood 213 * TCP Westwood
@@ -175,9 +215,11 @@ static inline u32 westwood_bw_rttmin(const struct sock *sk)
175 * in packets we use mss_cache). Rttmin is guaranteed to be >= 2 215 * in packets we use mss_cache). Rttmin is guaranteed to be >= 2
176 * so avoids ever returning 0. 216 * so avoids ever returning 0.
177 */ 217 */
178static u32 tcp_westwood_cwnd_min(struct sock *sk) 218static u32 tcp_westwood_bw_rttmin(const struct sock *sk)
179{ 219{
180 return westwood_bw_rttmin(sk); 220 const struct tcp_sock *tp = tcp_sk(sk);
221 const struct westwood *w = inet_csk_ca(sk);
222 return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2);
181} 223}
182 224
183static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event) 225static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event)
@@ -191,17 +233,19 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event)
191 break; 233 break;
192 234
193 case CA_EVENT_COMPLETE_CWR: 235 case CA_EVENT_COMPLETE_CWR:
194 tp->snd_cwnd = tp->snd_ssthresh = westwood_bw_rttmin(sk); 236 tp->snd_cwnd = tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk);
195 break; 237 break;
196 238
197 case CA_EVENT_FRTO: 239 case CA_EVENT_FRTO:
198 tp->snd_ssthresh = westwood_bw_rttmin(sk); 240 tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk);
241 /* Update RTT_min when next ack arrives */
242 w->reset_rtt_min = 1;
199 break; 243 break;
200 244
201 case CA_EVENT_SLOW_ACK: 245 case CA_EVENT_SLOW_ACK:
202 westwood_update_window(sk); 246 westwood_update_window(sk);
203 w->bk += westwood_acked_count(sk); 247 w->bk += westwood_acked_count(sk);
204 w->rtt_min = min(w->rtt, w->rtt_min); 248 update_rtt_min(w);
205 break; 249 break;
206 250
207 default: 251 default:
@@ -235,7 +279,7 @@ static struct tcp_congestion_ops tcp_westwood = {
235 .init = tcp_westwood_init, 279 .init = tcp_westwood_init,
236 .ssthresh = tcp_reno_ssthresh, 280 .ssthresh = tcp_reno_ssthresh,
237 .cong_avoid = tcp_reno_cong_avoid, 281 .cong_avoid = tcp_reno_cong_avoid,
238 .min_cwnd = tcp_westwood_cwnd_min, 282 .min_cwnd = tcp_westwood_bw_rttmin,
239 .cwnd_event = tcp_westwood_event, 283 .cwnd_event = tcp_westwood_event,
240 .get_info = tcp_westwood_info, 284 .get_info = tcp_westwood_info,
241 .pkts_acked = tcp_westwood_pkts_acked, 285 .pkts_acked = tcp_westwood_pkts_acked,
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 3e174c83bfe7..817ed84511a6 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -13,7 +13,6 @@
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/netfilter.h> 14#include <linux/netfilter.h>
15#include <linux/netfilter_ipv4.h> 15#include <linux/netfilter_ipv4.h>
16#include <net/inet_ecn.h>
17#include <net/ip.h> 16#include <net/ip.h>
18#include <net/xfrm.h> 17#include <net/xfrm.h>
19 18
@@ -24,15 +23,6 @@ int xfrm4_rcv(struct sk_buff *skb)
24 23
25EXPORT_SYMBOL(xfrm4_rcv); 24EXPORT_SYMBOL(xfrm4_rcv);
26 25
27static inline void ipip_ecn_decapsulate(struct sk_buff *skb)
28{
29 struct iphdr *outer_iph = skb->nh.iph;
30 struct iphdr *inner_iph = skb->h.ipiph;
31
32 if (INET_ECN_is_ce(outer_iph->tos))
33 IP_ECN_set_ce(inner_iph);
34}
35
36static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq) 26static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
37{ 27{
38 switch (nexthdr) { 28 switch (nexthdr) {
@@ -113,24 +103,10 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
113 103
114 xfrm_vec[xfrm_nr++] = x; 104 xfrm_vec[xfrm_nr++] = x;
115 105
116 iph = skb->nh.iph; 106 if (x->mode->input(x, skb))
107 goto drop;
117 108
118 if (x->props.mode) { 109 if (x->props.mode) {
119 if (iph->protocol != IPPROTO_IPIP)
120 goto drop;
121 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
122 goto drop;
123 if (skb_cloned(skb) &&
124 pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
125 goto drop;
126 if (x->props.flags & XFRM_STATE_DECAP_DSCP)
127 ipv4_copy_dscp(iph, skb->h.ipiph);
128 if (!(x->props.flags & XFRM_STATE_NOECN))
129 ipip_ecn_decapsulate(skb);
130 skb->mac.raw = memmove(skb->data - skb->mac_len,
131 skb->mac.raw, skb->mac_len);
132 skb->nh.raw = skb->data;
133 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
134 decaps = 1; 110 decaps = 1;
135 break; 111 break;
136 } 112 }
diff --git a/net/ipv4/xfrm4_mode_transport.c b/net/ipv4/xfrm4_mode_transport.c
new file mode 100644
index 000000000000..a9e6b3dd19c9
--- /dev/null
+++ b/net/ipv4/xfrm4_mode_transport.c
@@ -0,0 +1,83 @@
1/*
2 * xfrm4_mode_transport.c - Transport mode encapsulation for IPv4.
3 *
4 * Copyright (c) 2004-2006 Herbert Xu <herbert@gondor.apana.org.au>
5 */
6
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/module.h>
10#include <linux/skbuff.h>
11#include <linux/stringify.h>
12#include <net/dst.h>
13#include <net/ip.h>
14#include <net/xfrm.h>
15
16/* Add encapsulation header.
17 *
18 * The IP header will be moved forward to make space for the encapsulation
19 * header.
20 *
21 * On exit, skb->h will be set to the start of the payload to be processed
22 * by x->type->output and skb->nh will be set to the top IP header.
23 */
24static int xfrm4_transport_output(struct sk_buff *skb)
25{
26 struct xfrm_state *x;
27 struct iphdr *iph;
28 int ihl;
29
30 iph = skb->nh.iph;
31 skb->h.ipiph = iph;
32
33 ihl = iph->ihl * 4;
34 skb->h.raw += ihl;
35
36 x = skb->dst->xfrm;
37 skb->nh.raw = memmove(skb_push(skb, x->props.header_len), iph, ihl);
38 return 0;
39}
40
41/* Remove encapsulation header.
42 *
43 * The IP header will be moved over the top of the encapsulation header.
44 *
45 * On entry, skb->h shall point to where the IP header should be and skb->nh
46 * shall be set to where the IP header currently is. skb->data shall point
47 * to the start of the payload.
48 */
49static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
50{
51 int ihl = skb->data - skb->h.raw;
52
53 if (skb->h.raw != skb->nh.raw)
54 skb->nh.raw = memmove(skb->h.raw, skb->nh.raw, ihl);
55 skb->nh.iph->tot_len = htons(skb->len + ihl);
56 skb->h.raw = skb->data;
57 return 0;
58}
59
60static struct xfrm_mode xfrm4_transport_mode = {
61 .input = xfrm4_transport_input,
62 .output = xfrm4_transport_output,
63 .owner = THIS_MODULE,
64 .encap = XFRM_MODE_TRANSPORT,
65};
66
67static int __init xfrm4_transport_init(void)
68{
69 return xfrm_register_mode(&xfrm4_transport_mode, AF_INET);
70}
71
72static void __exit xfrm4_transport_exit(void)
73{
74 int err;
75
76 err = xfrm_unregister_mode(&xfrm4_transport_mode, AF_INET);
77 BUG_ON(err);
78}
79
80module_init(xfrm4_transport_init);
81module_exit(xfrm4_transport_exit);
82MODULE_LICENSE("GPL");
83MODULE_ALIAS_XFRM_MODE(AF_INET, XFRM_MODE_TRANSPORT);
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
new file mode 100644
index 000000000000..f8d880beb12f
--- /dev/null
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -0,0 +1,125 @@
1/*
2 * xfrm4_mode_tunnel.c - Tunnel mode encapsulation for IPv4.
3 *
4 * Copyright (c) 2004-2006 Herbert Xu <herbert@gondor.apana.org.au>
5 */
6
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/module.h>
10#include <linux/skbuff.h>
11#include <linux/stringify.h>
12#include <net/dst.h>
13#include <net/inet_ecn.h>
14#include <net/ip.h>
15#include <net/xfrm.h>
16
17static inline void ipip_ecn_decapsulate(struct sk_buff *skb)
18{
19 struct iphdr *outer_iph = skb->nh.iph;
20 struct iphdr *inner_iph = skb->h.ipiph;
21
22 if (INET_ECN_is_ce(outer_iph->tos))
23 IP_ECN_set_ce(inner_iph);
24}
25
26/* Add encapsulation header.
27 *
28 * The top IP header will be constructed per RFC 2401. The following fields
29 * in it shall be filled in by x->type->output:
30 * tot_len
31 * check
32 *
33 * On exit, skb->h will be set to the start of the payload to be processed
34 * by x->type->output and skb->nh will be set to the top IP header.
35 */
36static int xfrm4_tunnel_output(struct sk_buff *skb)
37{
38 struct dst_entry *dst = skb->dst;
39 struct xfrm_state *x = dst->xfrm;
40 struct iphdr *iph, *top_iph;
41 int flags;
42
43 iph = skb->nh.iph;
44 skb->h.ipiph = iph;
45
46 skb->nh.raw = skb_push(skb, x->props.header_len);
47 top_iph = skb->nh.iph;
48
49 top_iph->ihl = 5;
50 top_iph->version = 4;
51
52 /* DS disclosed */
53 top_iph->tos = INET_ECN_encapsulate(iph->tos, iph->tos);
54
55 flags = x->props.flags;
56 if (flags & XFRM_STATE_NOECN)
57 IP_ECN_clear(top_iph);
58
59 top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ?
60 0 : (iph->frag_off & htons(IP_DF));
61 if (!top_iph->frag_off)
62 __ip_select_ident(top_iph, dst->child, 0);
63
64 top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT);
65
66 top_iph->saddr = x->props.saddr.a4;
67 top_iph->daddr = x->id.daddr.a4;
68 top_iph->protocol = IPPROTO_IPIP;
69
70 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
71 return 0;
72}
73
74static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
75{
76 struct iphdr *iph = skb->nh.iph;
77 int err = -EINVAL;
78
79 if (iph->protocol != IPPROTO_IPIP)
80 goto out;
81 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
82 goto out;
83
84 if (skb_cloned(skb) &&
85 (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
86 goto out;
87
88 if (x->props.flags & XFRM_STATE_DECAP_DSCP)
89 ipv4_copy_dscp(iph, skb->h.ipiph);
90 if (!(x->props.flags & XFRM_STATE_NOECN))
91 ipip_ecn_decapsulate(skb);
92 skb->mac.raw = memmove(skb->data - skb->mac_len,
93 skb->mac.raw, skb->mac_len);
94 skb->nh.raw = skb->data;
95 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
96 err = 0;
97
98out:
99 return err;
100}
101
102static struct xfrm_mode xfrm4_tunnel_mode = {
103 .input = xfrm4_tunnel_input,
104 .output = xfrm4_tunnel_output,
105 .owner = THIS_MODULE,
106 .encap = XFRM_MODE_TUNNEL,
107};
108
109static int __init xfrm4_tunnel_init(void)
110{
111 return xfrm_register_mode(&xfrm4_tunnel_mode, AF_INET);
112}
113
114static void __exit xfrm4_tunnel_exit(void)
115{
116 int err;
117
118 err = xfrm_unregister_mode(&xfrm4_tunnel_mode, AF_INET);
119 BUG_ON(err);
120}
121
122module_init(xfrm4_tunnel_init);
123module_exit(xfrm4_tunnel_exit);
124MODULE_LICENSE("GPL");
125MODULE_ALIAS_XFRM_MODE(AF_INET, XFRM_MODE_TUNNEL);
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index 4ef8efaf6a67..ac9d91d4bb05 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -12,67 +12,10 @@
12#include <linux/skbuff.h> 12#include <linux/skbuff.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/netfilter_ipv4.h> 14#include <linux/netfilter_ipv4.h>
15#include <net/inet_ecn.h>
16#include <net/ip.h> 15#include <net/ip.h>
17#include <net/xfrm.h> 16#include <net/xfrm.h>
18#include <net/icmp.h> 17#include <net/icmp.h>
19 18
20/* Add encapsulation header.
21 *
22 * In transport mode, the IP header will be moved forward to make space
23 * for the encapsulation header.
24 *
25 * In tunnel mode, the top IP header will be constructed per RFC 2401.
26 * The following fields in it shall be filled in by x->type->output:
27 * tot_len
28 * check
29 *
30 * On exit, skb->h will be set to the start of the payload to be processed
31 * by x->type->output and skb->nh will be set to the top IP header.
32 */
33static void xfrm4_encap(struct sk_buff *skb)
34{
35 struct dst_entry *dst = skb->dst;
36 struct xfrm_state *x = dst->xfrm;
37 struct iphdr *iph, *top_iph;
38 int flags;
39
40 iph = skb->nh.iph;
41 skb->h.ipiph = iph;
42
43 skb->nh.raw = skb_push(skb, x->props.header_len);
44 top_iph = skb->nh.iph;
45
46 if (!x->props.mode) {
47 skb->h.raw += iph->ihl*4;
48 memmove(top_iph, iph, iph->ihl*4);
49 return;
50 }
51
52 top_iph->ihl = 5;
53 top_iph->version = 4;
54
55 /* DS disclosed */
56 top_iph->tos = INET_ECN_encapsulate(iph->tos, iph->tos);
57
58 flags = x->props.flags;
59 if (flags & XFRM_STATE_NOECN)
60 IP_ECN_clear(top_iph);
61
62 top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ?
63 0 : (iph->frag_off & htons(IP_DF));
64 if (!top_iph->frag_off)
65 __ip_select_ident(top_iph, dst->child, 0);
66
67 top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT);
68
69 top_iph->saddr = x->props.saddr.a4;
70 top_iph->daddr = x->id.daddr.a4;
71 top_iph->protocol = IPPROTO_IPIP;
72
73 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
74}
75
76static int xfrm4_tunnel_check_size(struct sk_buff *skb) 19static int xfrm4_tunnel_check_size(struct sk_buff *skb)
77{ 20{
78 int mtu, ret = 0; 21 int mtu, ret = 0;
@@ -121,7 +64,9 @@ static int xfrm4_output_one(struct sk_buff *skb)
121 if (err) 64 if (err)
122 goto error; 65 goto error;
123 66
124 xfrm4_encap(skb); 67 err = x->mode->output(skb);
68 if (err)
69 goto error;
125 70
126 err = x->type->output(x, skb); 71 err = x->type->output(x, skb);
127 if (err) 72 if (err)
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 8604c747bca5..c0465284dfac 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -17,8 +17,6 @@
17static struct dst_ops xfrm4_dst_ops; 17static struct dst_ops xfrm4_dst_ops;
18static struct xfrm_policy_afinfo xfrm4_policy_afinfo; 18static struct xfrm_policy_afinfo xfrm4_policy_afinfo;
19 19
20static struct xfrm_type_map xfrm4_type_map = { .lock = RW_LOCK_UNLOCKED };
21
22static int xfrm4_dst_lookup(struct xfrm_dst **dst, struct flowi *fl) 20static int xfrm4_dst_lookup(struct xfrm_dst **dst, struct flowi *fl)
23{ 21{
24 return __ip_route_output_key((struct rtable**)dst, fl); 22 return __ip_route_output_key((struct rtable**)dst, fl);
@@ -237,9 +235,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
237 235
238static inline int xfrm4_garbage_collect(void) 236static inline int xfrm4_garbage_collect(void)
239{ 237{
240 read_lock(&xfrm4_policy_afinfo.lock);
241 xfrm4_policy_afinfo.garbage_collect(); 238 xfrm4_policy_afinfo.garbage_collect();
242 read_unlock(&xfrm4_policy_afinfo.lock);
243 return (atomic_read(&xfrm4_dst_ops.entries) > xfrm4_dst_ops.gc_thresh*2); 239 return (atomic_read(&xfrm4_dst_ops.entries) > xfrm4_dst_ops.gc_thresh*2);
244} 240}
245 241
@@ -299,8 +295,6 @@ static struct dst_ops xfrm4_dst_ops = {
299 295
300static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { 296static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
301 .family = AF_INET, 297 .family = AF_INET,
302 .lock = RW_LOCK_UNLOCKED,
303 .type_map = &xfrm4_type_map,
304 .dst_ops = &xfrm4_dst_ops, 298 .dst_ops = &xfrm4_dst_ops,
305 .dst_lookup = xfrm4_dst_lookup, 299 .dst_lookup = xfrm4_dst_lookup,
306 .find_bundle = __xfrm4_find_bundle, 300 .find_bundle = __xfrm4_find_bundle,
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c
index dbabf81a9b7b..81e1751c966e 100644
--- a/net/ipv4/xfrm4_state.c
+++ b/net/ipv4/xfrm4_state.c
@@ -131,7 +131,6 @@ __xfrm4_find_acq(u8 mode, u32 reqid, u8 proto,
131 131
132static struct xfrm_state_afinfo xfrm4_state_afinfo = { 132static struct xfrm_state_afinfo xfrm4_state_afinfo = {
133 .family = AF_INET, 133 .family = AF_INET,
134 .lock = RW_LOCK_UNLOCKED,
135 .init_flags = xfrm4_init_flags, 134 .init_flags = xfrm4_init_flags,
136 .init_tempsel = __xfrm4_init_tempsel, 135 .init_tempsel = __xfrm4_init_tempsel,
137 .state_lookup = __xfrm4_state_lookup, 136 .state_lookup = __xfrm4_state_lookup,
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index f8a107ab5592..e923d4dea418 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -106,6 +106,26 @@ config INET6_TUNNEL
106 tristate 106 tristate
107 default n 107 default n
108 108
109config INET6_XFRM_MODE_TRANSPORT
110 tristate "IPv6: IPsec transport mode"
111 depends on IPV6
112 default IPV6
113 select XFRM
114 ---help---
115 Support for IPsec transport mode.
116
117 If unsure, say Y.
118
119config INET6_XFRM_MODE_TUNNEL
120 tristate "IPv6: IPsec tunnel mode"
121 depends on IPV6
122 default IPV6
123 select XFRM
124 ---help---
125 Support for IPsec tunnel mode.
126
127 If unsure, say Y.
128
109config IPV6_TUNNEL 129config IPV6_TUNNEL
110 tristate "IPv6: IPv6-in-IPv6 tunnel" 130 tristate "IPv6: IPv6-in-IPv6 tunnel"
111 select INET6_TUNNEL 131 select INET6_TUNNEL
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile
index a760b0988fbb..386e0a626948 100644
--- a/net/ipv6/Makefile
+++ b/net/ipv6/Makefile
@@ -20,6 +20,8 @@ obj-$(CONFIG_INET6_ESP) += esp6.o
20obj-$(CONFIG_INET6_IPCOMP) += ipcomp6.o 20obj-$(CONFIG_INET6_IPCOMP) += ipcomp6.o
21obj-$(CONFIG_INET6_XFRM_TUNNEL) += xfrm6_tunnel.o 21obj-$(CONFIG_INET6_XFRM_TUNNEL) += xfrm6_tunnel.o
22obj-$(CONFIG_INET6_TUNNEL) += tunnel6.o 22obj-$(CONFIG_INET6_TUNNEL) += tunnel6.o
23obj-$(CONFIG_INET6_XFRM_MODE_TRANSPORT) += xfrm6_mode_transport.o
24obj-$(CONFIG_INET6_XFRM_MODE_TUNNEL) += xfrm6_mode_tunnel.o
23obj-$(CONFIG_NETFILTER) += netfilter/ 25obj-$(CONFIG_NETFILTER) += netfilter/
24 26
25obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o 27obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 445006ee4522..c2c26fa0943d 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2860,6 +2860,11 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
2860 return inet6_addr_add(ifm->ifa_index, pfx, ifm->ifa_prefixlen); 2860 return inet6_addr_add(ifm->ifa_index, pfx, ifm->ifa_prefixlen);
2861} 2861}
2862 2862
2863/* Maximum length of ifa_cacheinfo attributes */
2864#define INET6_IFADDR_RTA_SPACE \
2865 RTA_SPACE(16) /* IFA_ADDRESS */ + \
2866 RTA_SPACE(sizeof(struct ifa_cacheinfo)) /* CACHEINFO */
2867
2863static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, 2868static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
2864 u32 pid, u32 seq, int event, unsigned int flags) 2869 u32 pid, u32 seq, int event, unsigned int flags)
2865{ 2870{
@@ -3092,7 +3097,7 @@ static int inet6_dump_ifacaddr(struct sk_buff *skb, struct netlink_callback *cb)
3092static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) 3097static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
3093{ 3098{
3094 struct sk_buff *skb; 3099 struct sk_buff *skb;
3095 int size = NLMSG_SPACE(sizeof(struct ifaddrmsg)+128); 3100 int size = NLMSG_SPACE(sizeof(struct ifaddrmsg) + INET6_IFADDR_RTA_SPACE);
3096 3101
3097 skb = alloc_skb(size, GFP_ATOMIC); 3102 skb = alloc_skb(size, GFP_ATOMIC);
3098 if (!skb) { 3103 if (!skb) {
@@ -3142,6 +3147,17 @@ static void inline ipv6_store_devconf(struct ipv6_devconf *cnf,
3142#endif 3147#endif
3143} 3148}
3144 3149
3150/* Maximum length of ifinfomsg attributes */
3151#define INET6_IFINFO_RTA_SPACE \
3152 RTA_SPACE(IFNAMSIZ) /* IFNAME */ + \
3153 RTA_SPACE(MAX_ADDR_LEN) /* ADDRESS */ + \
3154 RTA_SPACE(sizeof(u32)) /* MTU */ + \
3155 RTA_SPACE(sizeof(int)) /* LINK */ + \
3156 RTA_SPACE(0) /* PROTINFO */ + \
3157 RTA_SPACE(sizeof(u32)) /* FLAGS */ + \
3158 RTA_SPACE(sizeof(struct ifla_cacheinfo)) /* CACHEINFO */ + \
3159 RTA_SPACE(sizeof(__s32[DEVCONF_MAX])) /* CONF */
3160
3145static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, 3161static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
3146 u32 pid, u32 seq, int event, unsigned int flags) 3162 u32 pid, u32 seq, int event, unsigned int flags)
3147{ 3163{
@@ -3235,8 +3251,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
3235void inet6_ifinfo_notify(int event, struct inet6_dev *idev) 3251void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
3236{ 3252{
3237 struct sk_buff *skb; 3253 struct sk_buff *skb;
3238 /* 128 bytes ?? */ 3254 int size = NLMSG_SPACE(sizeof(struct ifinfomsg) + INET6_IFINFO_RTA_SPACE);
3239 int size = NLMSG_SPACE(sizeof(struct ifinfomsg)+128);
3240 3255
3241 skb = alloc_skb(size, GFP_ATOMIC); 3256 skb = alloc_skb(size, GFP_ATOMIC);
3242 if (!skb) { 3257 if (!skb) {
@@ -3252,6 +3267,11 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
3252 netlink_broadcast(rtnl, skb, 0, RTNLGRP_IPV6_IFINFO, GFP_ATOMIC); 3267 netlink_broadcast(rtnl, skb, 0, RTNLGRP_IPV6_IFINFO, GFP_ATOMIC);
3253} 3268}
3254 3269
3270/* Maximum length of prefix_cacheinfo attributes */
3271#define INET6_PREFIX_RTA_SPACE \
3272 RTA_SPACE(sizeof(((struct prefix_info *)NULL)->prefix)) /* ADDRESS */ + \
3273 RTA_SPACE(sizeof(struct prefix_cacheinfo)) /* CACHEINFO */
3274
3255static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev, 3275static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
3256 struct prefix_info *pinfo, u32 pid, u32 seq, 3276 struct prefix_info *pinfo, u32 pid, u32 seq,
3257 int event, unsigned int flags) 3277 int event, unsigned int flags)
@@ -3296,7 +3316,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
3296 struct prefix_info *pinfo) 3316 struct prefix_info *pinfo)
3297{ 3317{
3298 struct sk_buff *skb; 3318 struct sk_buff *skb;
3299 int size = NLMSG_SPACE(sizeof(struct prefixmsg)+128); 3319 int size = NLMSG_SPACE(sizeof(struct prefixmsg) + INET6_PREFIX_RTA_SPACE);
3300 3320
3301 skb = alloc_skb(size, GFP_ATOMIC); 3321 skb = alloc_skb(size, GFP_ATOMIC);
3302 if (!skb) { 3322 if (!skb) {
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 6778173a3dda..d31c0d6c0448 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -292,7 +292,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
292 292
293 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); 293 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len);
294 memset(ah->auth_data, 0, ahp->icv_trunc_len); 294 memset(ah->auth_data, 0, ahp->icv_trunc_len);
295 skb_push(skb, skb->data - skb->nh.raw); 295 skb_push(skb, hdr_len);
296 ahp->icv(ahp, skb, ah->auth_data); 296 ahp->icv(ahp, skb, ah->auth_data);
297 if (memcmp(ah->auth_data, auth_data, ahp->icv_trunc_len)) { 297 if (memcmp(ah->auth_data, auth_data, ahp->icv_trunc_len)) {
298 LIMIT_NETDEBUG(KERN_WARNING "ipsec ah authentication error\n"); 298 LIMIT_NETDEBUG(KERN_WARNING "ipsec ah authentication error\n");
@@ -301,12 +301,8 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
301 } 301 }
302 } 302 }
303 303
304 skb->nh.raw = skb_pull(skb, ah_hlen); 304 skb->h.raw = memcpy(skb->nh.raw += ah_hlen, tmp_hdr, hdr_len);
305 memcpy(skb->nh.raw, tmp_hdr, hdr_len); 305 __skb_pull(skb, ah_hlen + hdr_len);
306 skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
307 skb_pull(skb, hdr_len);
308 skb->h.raw = skb->data;
309
310 306
311 kfree(tmp_hdr); 307 kfree(tmp_hdr);
312 308
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 22f046079037..a15a6f320f70 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -142,25 +142,17 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
142 142
143 int hdr_len = skb->h.raw - skb->nh.raw; 143 int hdr_len = skb->h.raw - skb->nh.raw;
144 int nfrags; 144 int nfrags;
145 unsigned char *tmp_hdr = NULL;
146 int ret = 0; 145 int ret = 0;
147 146
148 if (!pskb_may_pull(skb, sizeof(struct ipv6_esp_hdr))) { 147 if (!pskb_may_pull(skb, sizeof(struct ipv6_esp_hdr))) {
149 ret = -EINVAL; 148 ret = -EINVAL;
150 goto out_nofree; 149 goto out;
151 } 150 }
152 151
153 if (elen <= 0 || (elen & (blksize-1))) { 152 if (elen <= 0 || (elen & (blksize-1))) {
154 ret = -EINVAL; 153 ret = -EINVAL;
155 goto out_nofree; 154 goto out;
156 }
157
158 tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC);
159 if (!tmp_hdr) {
160 ret = -ENOMEM;
161 goto out_nofree;
162 } 155 }
163 memcpy(tmp_hdr, skb->nh.raw, hdr_len);
164 156
165 /* If integrity check is required, do this. */ 157 /* If integrity check is required, do this. */
166 if (esp->auth.icv_full_len) { 158 if (esp->auth.icv_full_len) {
@@ -222,16 +214,12 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
222 /* ... check padding bits here. Silly. :-) */ 214 /* ... check padding bits here. Silly. :-) */
223 215
224 pskb_trim(skb, skb->len - alen - padlen - 2); 216 pskb_trim(skb, skb->len - alen - padlen - 2);
225 skb->h.raw = skb_pull(skb, sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen);
226 skb->nh.raw += sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen;
227 memcpy(skb->nh.raw, tmp_hdr, hdr_len);
228 skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
229 ret = nexthdr[1]; 217 ret = nexthdr[1];
230 } 218 }
231 219
220 skb->h.raw = __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen) - hdr_len;
221
232out: 222out:
233 kfree(tmp_hdr);
234out_nofree:
235 return ret; 223 return ret;
236} 224}
237 225
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index e46048974f37..d29620f4910e 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -39,6 +39,7 @@
39#include <linux/in6.h> 39#include <linux/in6.h>
40#include <linux/tcp.h> 40#include <linux/tcp.h>
41#include <linux/route.h> 41#include <linux/route.h>
42#include <linux/module.h>
42 43
43#include <linux/netfilter.h> 44#include <linux/netfilter.h>
44#include <linux/netfilter_ipv6.h> 45#include <linux/netfilter_ipv6.h>
@@ -458,6 +459,7 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from)
458 nf_bridge_get(to->nf_bridge); 459 nf_bridge_get(to->nf_bridge);
459#endif 460#endif
460#endif 461#endif
462 skb_copy_secmark(to, from);
461} 463}
462 464
463int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) 465int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
@@ -488,6 +490,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
488 490
489 return offset; 491 return offset;
490} 492}
493EXPORT_SYMBOL_GPL(ip6_find_1stfragopt);
491 494
492static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) 495static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
493{ 496{
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 48636436028a..f28cd37feed3 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -65,38 +65,25 @@ static LIST_HEAD(ipcomp6_tfms_list);
65 65
66static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb) 66static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb)
67{ 67{
68 int err = 0; 68 int err = -ENOMEM;
69 u8 nexthdr = 0;
70 int hdr_len = skb->h.raw - skb->nh.raw;
71 unsigned char *tmp_hdr = NULL;
72 struct ipv6hdr *iph; 69 struct ipv6hdr *iph;
70 struct ipv6_comp_hdr *ipch;
73 int plen, dlen; 71 int plen, dlen;
74 struct ipcomp_data *ipcd = x->data; 72 struct ipcomp_data *ipcd = x->data;
75 u8 *start, *scratch; 73 u8 *start, *scratch;
76 struct crypto_tfm *tfm; 74 struct crypto_tfm *tfm;
77 int cpu; 75 int cpu;
78 76
79 if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && 77 if (skb_linearize_cow(skb))
80 skb_linearize(skb, GFP_ATOMIC) != 0) {
81 err = -ENOMEM;
82 goto out; 78 goto out;
83 }
84 79
85 skb->ip_summed = CHECKSUM_NONE; 80 skb->ip_summed = CHECKSUM_NONE;
86 81
87 /* Remove ipcomp header and decompress original payload */ 82 /* Remove ipcomp header and decompress original payload */
88 iph = skb->nh.ipv6h; 83 iph = skb->nh.ipv6h;
89 tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC); 84 ipch = (void *)skb->data;
90 if (!tmp_hdr) 85 skb->h.raw = skb->nh.raw + sizeof(*ipch);
91 goto out; 86 __skb_pull(skb, sizeof(*ipch));
92 memcpy(tmp_hdr, iph, hdr_len);
93 nexthdr = *(u8 *)skb->data;
94 skb_pull(skb, sizeof(struct ipv6_comp_hdr));
95 skb->nh.raw += sizeof(struct ipv6_comp_hdr);
96 memcpy(skb->nh.raw, tmp_hdr, hdr_len);
97 iph = skb->nh.ipv6h;
98 iph->payload_len = htons(ntohs(iph->payload_len) - sizeof(struct ipv6_comp_hdr));
99 skb->h.raw = skb->data;
100 87
101 /* decompression */ 88 /* decompression */
102 plen = skb->len; 89 plen = skb->len;
@@ -125,18 +112,11 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb)
125 112
126 skb_put(skb, dlen - plen); 113 skb_put(skb, dlen - plen);
127 memcpy(skb->data, scratch, dlen); 114 memcpy(skb->data, scratch, dlen);
115 err = ipch->nexthdr;
128 116
129 iph = skb->nh.ipv6h;
130 iph->payload_len = htons(skb->len);
131
132out_put_cpu: 117out_put_cpu:
133 put_cpu(); 118 put_cpu();
134out: 119out:
135 kfree(tmp_hdr);
136 if (err)
137 goto error_out;
138 return nexthdr;
139error_out:
140 return err; 120 return err;
141} 121}
142 122
@@ -159,10 +139,8 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb)
159 goto out_ok; 139 goto out_ok;
160 } 140 }
161 141
162 if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && 142 if (skb_linearize_cow(skb))
163 skb_linearize(skb, GFP_ATOMIC) != 0) {
164 goto out_ok; 143 goto out_ok;
165 }
166 144
167 /* compression */ 145 /* compression */
168 plen = skb->len - hdr_len; 146 plen = skb->len - hdr_len;
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 93bae36f2663..2a71c3b669f1 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -189,7 +189,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
189 189
190 /* This is where we call the helper: as the packet goes out. */ 190 /* This is where we call the helper: as the packet goes out. */
191 ct = nf_ct_get(*pskb, &ctinfo); 191 ct = nf_ct_get(*pskb, &ctinfo);
192 if (!ct) 192 if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)
193 goto out; 193 goto out;
194 194
195 help = nfct_help(ct); 195 help = nfct_help(ct);
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 86c6703265d0..ef18a7b7014b 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -233,7 +233,7 @@ 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 (nf_conntrack_checksum && hooknum == NF_IP6_PRE_ROUTING &&
237 nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) { 237 nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) {
238 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, 238 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
239 "nf_ct_icmpv6: ICMPv6 checksum failed\n"); 239 "nf_ct_icmpv6: ICMPv6 checksum failed\n");
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 3e319035f82d..c32a029e43f0 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -456,13 +456,9 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
456 DEBUGP("queue: message is too short.\n"); 456 DEBUGP("queue: message is too short.\n");
457 goto err; 457 goto err;
458 } 458 }
459 if (end-offset < skb->len) { 459 if (pskb_trim_rcsum(skb, end - offset)) {
460 if (pskb_trim(skb, end - offset)) { 460 DEBUGP("Can't trim\n");
461 DEBUGP("Can't trim\n"); 461 goto err;
462 goto err;
463 }
464 if (skb->ip_summed != CHECKSUM_UNNECESSARY)
465 skb->ip_summed = CHECKSUM_NONE;
466 } 462 }
467 463
468 /* Find out which fragments are in front and at the back of us 464 /* Find out which fragments are in front and at the back of us
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 301eee726b0f..a50eb306e9e2 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1218,8 +1218,16 @@ process:
1218 bh_lock_sock(sk); 1218 bh_lock_sock(sk);
1219 ret = 0; 1219 ret = 0;
1220 if (!sock_owned_by_user(sk)) { 1220 if (!sock_owned_by_user(sk)) {
1221 if (!tcp_prequeue(sk, skb)) 1221#ifdef CONFIG_NET_DMA
1222 ret = tcp_v6_do_rcv(sk, skb); 1222 struct tcp_sock *tp = tcp_sk(sk);
1223 if (tp->ucopy.dma_chan)
1224 ret = tcp_v6_do_rcv(sk, skb);
1225 else
1226#endif
1227 {
1228 if (!tcp_prequeue(sk, skb))
1229 ret = tcp_v6_do_rcv(sk, skb);
1230 }
1223 } else 1231 } else
1224 sk_add_backlog(sk, skb); 1232 sk_add_backlog(sk, skb);
1225 bh_unlock_sock(sk); 1233 bh_unlock_sock(sk);
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index 00cfdee18dca..0405d74ff910 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -13,21 +13,9 @@
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/netfilter.h> 14#include <linux/netfilter.h>
15#include <linux/netfilter_ipv6.h> 15#include <linux/netfilter_ipv6.h>
16#include <net/dsfield.h>
17#include <net/inet_ecn.h>
18#include <net/ip.h>
19#include <net/ipv6.h> 16#include <net/ipv6.h>
20#include <net/xfrm.h> 17#include <net/xfrm.h>
21 18
22static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
23{
24 struct ipv6hdr *outer_iph = skb->nh.ipv6h;
25 struct ipv6hdr *inner_iph = skb->h.ipv6h;
26
27 if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph)))
28 IP6_ECN_set_ce(inner_iph);
29}
30
31int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi) 19int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi)
32{ 20{
33 int err; 21 int err;
@@ -81,21 +69,10 @@ int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi)
81 69
82 xfrm_vec[xfrm_nr++] = x; 70 xfrm_vec[xfrm_nr++] = x;
83 71
72 if (x->mode->input(x, skb))
73 goto drop;
74
84 if (x->props.mode) { /* XXX */ 75 if (x->props.mode) { /* XXX */
85 if (nexthdr != IPPROTO_IPV6)
86 goto drop;
87 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
88 goto drop;
89 if (skb_cloned(skb) &&
90 pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
91 goto drop;
92 if (x->props.flags & XFRM_STATE_DECAP_DSCP)
93 ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h);
94 if (!(x->props.flags & XFRM_STATE_NOECN))
95 ipip6_ecn_decapsulate(skb);
96 skb->mac.raw = memmove(skb->data - skb->mac_len,
97 skb->mac.raw, skb->mac_len);
98 skb->nh.raw = skb->data;
99 decaps = 1; 76 decaps = 1;
100 break; 77 break;
101 } 78 }
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c
new file mode 100644
index 000000000000..711d713e36d8
--- /dev/null
+++ b/net/ipv6/xfrm6_mode_transport.c
@@ -0,0 +1,88 @@
1/*
2 * xfrm6_mode_transport.c - Transport mode encapsulation for IPv6.
3 *
4 * Copyright (C) 2002 USAGI/WIDE Project
5 * Copyright (c) 2004-2006 Herbert Xu <herbert@gondor.apana.org.au>
6 */
7
8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/skbuff.h>
12#include <linux/stringify.h>
13#include <net/dst.h>
14#include <net/ipv6.h>
15#include <net/xfrm.h>
16
17/* Add encapsulation header.
18 *
19 * The IP header and mutable extension headers will be moved forward to make
20 * space for the encapsulation header.
21 *
22 * On exit, skb->h will be set to the start of the encapsulation header to be
23 * filled in by x->type->output and skb->nh will be set to the nextheader field
24 * of the extension header directly preceding the encapsulation header, or in
25 * its absence, that of the top IP header. The value of skb->data will always
26 * point to the top IP header.
27 */
28static int xfrm6_transport_output(struct sk_buff *skb)
29{
30 struct xfrm_state *x = skb->dst->xfrm;
31 struct ipv6hdr *iph;
32 u8 *prevhdr;
33 int hdr_len;
34
35 skb_push(skb, x->props.header_len);
36 iph = skb->nh.ipv6h;
37
38 hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
39 skb->nh.raw = prevhdr - x->props.header_len;
40 skb->h.raw = skb->data + hdr_len;
41 memmove(skb->data, iph, hdr_len);
42 return 0;
43}
44
45/* Remove encapsulation header.
46 *
47 * The IP header will be moved over the top of the encapsulation header.
48 *
49 * On entry, skb->h shall point to where the IP header should be and skb->nh
50 * shall be set to where the IP header currently is. skb->data shall point
51 * to the start of the payload.
52 */
53static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
54{
55 int ihl = skb->data - skb->h.raw;
56
57 if (skb->h.raw != skb->nh.raw)
58 skb->nh.raw = memmove(skb->h.raw, skb->nh.raw, ihl);
59 skb->nh.ipv6h->payload_len = htons(skb->len + ihl -
60 sizeof(struct ipv6hdr));
61 skb->h.raw = skb->data;
62 return 0;
63}
64
65static struct xfrm_mode xfrm6_transport_mode = {
66 .input = xfrm6_transport_input,
67 .output = xfrm6_transport_output,
68 .owner = THIS_MODULE,
69 .encap = XFRM_MODE_TRANSPORT,
70};
71
72static int __init xfrm6_transport_init(void)
73{
74 return xfrm_register_mode(&xfrm6_transport_mode, AF_INET6);
75}
76
77static void __exit xfrm6_transport_exit(void)
78{
79 int err;
80
81 err = xfrm_unregister_mode(&xfrm6_transport_mode, AF_INET6);
82 BUG_ON(err);
83}
84
85module_init(xfrm6_transport_init);
86module_exit(xfrm6_transport_exit);
87MODULE_LICENSE("GPL");
88MODULE_ALIAS_XFRM_MODE(AF_INET6, XFRM_MODE_TRANSPORT);
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
new file mode 100644
index 000000000000..8af79be2edca
--- /dev/null
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -0,0 +1,121 @@
1/*
2 * xfrm6_mode_tunnel.c - Tunnel mode encapsulation for IPv6.
3 *
4 * Copyright (C) 2002 USAGI/WIDE Project
5 * Copyright (c) 2004-2006 Herbert Xu <herbert@gondor.apana.org.au>
6 */
7
8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/skbuff.h>
12#include <linux/stringify.h>
13#include <net/dsfield.h>
14#include <net/dst.h>
15#include <net/inet_ecn.h>
16#include <net/ipv6.h>
17#include <net/xfrm.h>
18
19static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
20{
21 struct ipv6hdr *outer_iph = skb->nh.ipv6h;
22 struct ipv6hdr *inner_iph = skb->h.ipv6h;
23
24 if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph)))
25 IP6_ECN_set_ce(inner_iph);
26}
27
28/* Add encapsulation header.
29 *
30 * The top IP header will be constructed per RFC 2401. The following fields
31 * in it shall be filled in by x->type->output:
32 * payload_len
33 *
34 * On exit, skb->h will be set to the start of the encapsulation header to be
35 * filled in by x->type->output and skb->nh will be set to the nextheader field
36 * of the extension header directly preceding the encapsulation header, or in
37 * its absence, that of the top IP header. The value of skb->data will always
38 * point to the top IP header.
39 */
40static int xfrm6_tunnel_output(struct sk_buff *skb)
41{
42 struct dst_entry *dst = skb->dst;
43 struct xfrm_state *x = dst->xfrm;
44 struct ipv6hdr *iph, *top_iph;
45 int dsfield;
46
47 skb_push(skb, x->props.header_len);
48 iph = skb->nh.ipv6h;
49
50 skb->nh.raw = skb->data;
51 top_iph = skb->nh.ipv6h;
52 skb->nh.raw = &top_iph->nexthdr;
53 skb->h.ipv6h = top_iph + 1;
54
55 top_iph->version = 6;
56 top_iph->priority = iph->priority;
57 top_iph->flow_lbl[0] = iph->flow_lbl[0];
58 top_iph->flow_lbl[1] = iph->flow_lbl[1];
59 top_iph->flow_lbl[2] = iph->flow_lbl[2];
60 dsfield = ipv6_get_dsfield(top_iph);
61 dsfield = INET_ECN_encapsulate(dsfield, dsfield);
62 if (x->props.flags & XFRM_STATE_NOECN)
63 dsfield &= ~INET_ECN_MASK;
64 ipv6_change_dsfield(top_iph, 0, dsfield);
65 top_iph->nexthdr = IPPROTO_IPV6;
66 top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT);
67 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);
68 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
69 return 0;
70}
71
72static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
73{
74 int err = -EINVAL;
75
76 if (skb->nh.raw[IP6CB(skb)->nhoff] != IPPROTO_IPV6)
77 goto out;
78 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
79 goto out;
80
81 if (skb_cloned(skb) &&
82 (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
83 goto out;
84
85 if (x->props.flags & XFRM_STATE_DECAP_DSCP)
86 ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h);
87 if (!(x->props.flags & XFRM_STATE_NOECN))
88 ipip6_ecn_decapsulate(skb);
89 skb->mac.raw = memmove(skb->data - skb->mac_len,
90 skb->mac.raw, skb->mac_len);
91 skb->nh.raw = skb->data;
92 err = 0;
93
94out:
95 return err;
96}
97
98static struct xfrm_mode xfrm6_tunnel_mode = {
99 .input = xfrm6_tunnel_input,
100 .output = xfrm6_tunnel_output,
101 .owner = THIS_MODULE,
102 .encap = XFRM_MODE_TUNNEL,
103};
104
105static int __init xfrm6_tunnel_init(void)
106{
107 return xfrm_register_mode(&xfrm6_tunnel_mode, AF_INET6);
108}
109
110static void __exit xfrm6_tunnel_exit(void)
111{
112 int err;
113
114 err = xfrm_unregister_mode(&xfrm6_tunnel_mode, AF_INET6);
115 BUG_ON(err);
116}
117
118module_init(xfrm6_tunnel_init);
119module_exit(xfrm6_tunnel_exit);
120MODULE_LICENSE("GPL");
121MODULE_ALIAS_XFRM_MODE(AF_INET6, XFRM_MODE_TUNNEL);
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index 80242172a5df..16e84254a252 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -14,68 +14,9 @@
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/icmpv6.h> 15#include <linux/icmpv6.h>
16#include <linux/netfilter_ipv6.h> 16#include <linux/netfilter_ipv6.h>
17#include <net/dsfield.h>
18#include <net/inet_ecn.h>
19#include <net/ipv6.h> 17#include <net/ipv6.h>
20#include <net/xfrm.h> 18#include <net/xfrm.h>
21 19
22/* Add encapsulation header.
23 *
24 * In transport mode, the IP header and mutable extension headers will be moved
25 * forward to make space for the encapsulation header.
26 *
27 * In tunnel mode, the top IP header will be constructed per RFC 2401.
28 * The following fields in it shall be filled in by x->type->output:
29 * payload_len
30 *
31 * On exit, skb->h will be set to the start of the encapsulation header to be
32 * filled in by x->type->output and skb->nh will be set to the nextheader field
33 * of the extension header directly preceding the encapsulation header, or in
34 * its absence, that of the top IP header. The value of skb->data will always
35 * point to the top IP header.
36 */
37static void xfrm6_encap(struct sk_buff *skb)
38{
39 struct dst_entry *dst = skb->dst;
40 struct xfrm_state *x = dst->xfrm;
41 struct ipv6hdr *iph, *top_iph;
42 int dsfield;
43
44 skb_push(skb, x->props.header_len);
45 iph = skb->nh.ipv6h;
46
47 if (!x->props.mode) {
48 u8 *prevhdr;
49 int hdr_len;
50
51 hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
52 skb->nh.raw = prevhdr - x->props.header_len;
53 skb->h.raw = skb->data + hdr_len;
54 memmove(skb->data, iph, hdr_len);
55 return;
56 }
57
58 skb->nh.raw = skb->data;
59 top_iph = skb->nh.ipv6h;
60 skb->nh.raw = &top_iph->nexthdr;
61 skb->h.ipv6h = top_iph + 1;
62
63 top_iph->version = 6;
64 top_iph->priority = iph->priority;
65 top_iph->flow_lbl[0] = iph->flow_lbl[0];
66 top_iph->flow_lbl[1] = iph->flow_lbl[1];
67 top_iph->flow_lbl[2] = iph->flow_lbl[2];
68 dsfield = ipv6_get_dsfield(top_iph);
69 dsfield = INET_ECN_encapsulate(dsfield, dsfield);
70 if (x->props.flags & XFRM_STATE_NOECN)
71 dsfield &= ~INET_ECN_MASK;
72 ipv6_change_dsfield(top_iph, 0, dsfield);
73 top_iph->nexthdr = IPPROTO_IPV6;
74 top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT);
75 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);
76 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
77}
78
79static int xfrm6_tunnel_check_size(struct sk_buff *skb) 20static int xfrm6_tunnel_check_size(struct sk_buff *skb)
80{ 21{
81 int mtu, ret = 0; 22 int mtu, ret = 0;
@@ -118,7 +59,9 @@ static int xfrm6_output_one(struct sk_buff *skb)
118 if (err) 59 if (err)
119 goto error; 60 goto error;
120 61
121 xfrm6_encap(skb); 62 err = x->mode->output(skb);
63 if (err)
64 goto error;
122 65
123 err = x->type->output(x, skb); 66 err = x->type->output(x, skb);
124 if (err) 67 if (err)
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 88c840f1beb6..ee715f2691e9 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -23,8 +23,6 @@
23static struct dst_ops xfrm6_dst_ops; 23static struct dst_ops xfrm6_dst_ops;
24static struct xfrm_policy_afinfo xfrm6_policy_afinfo; 24static struct xfrm_policy_afinfo xfrm6_policy_afinfo;
25 25
26static struct xfrm_type_map xfrm6_type_map = { .lock = RW_LOCK_UNLOCKED };
27
28static int xfrm6_dst_lookup(struct xfrm_dst **dst, struct flowi *fl) 26static int xfrm6_dst_lookup(struct xfrm_dst **dst, struct flowi *fl)
29{ 27{
30 int err = 0; 28 int err = 0;
@@ -249,9 +247,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl)
249 247
250static inline int xfrm6_garbage_collect(void) 248static inline int xfrm6_garbage_collect(void)
251{ 249{
252 read_lock(&xfrm6_policy_afinfo.lock);
253 xfrm6_policy_afinfo.garbage_collect(); 250 xfrm6_policy_afinfo.garbage_collect();
254 read_unlock(&xfrm6_policy_afinfo.lock);
255 return (atomic_read(&xfrm6_dst_ops.entries) > xfrm6_dst_ops.gc_thresh*2); 251 return (atomic_read(&xfrm6_dst_ops.entries) > xfrm6_dst_ops.gc_thresh*2);
256} 252}
257 253
@@ -311,8 +307,6 @@ static struct dst_ops xfrm6_dst_ops = {
311 307
312static struct xfrm_policy_afinfo xfrm6_policy_afinfo = { 308static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
313 .family = AF_INET6, 309 .family = AF_INET6,
314 .lock = RW_LOCK_UNLOCKED,
315 .type_map = &xfrm6_type_map,
316 .dst_ops = &xfrm6_dst_ops, 310 .dst_ops = &xfrm6_dst_ops,
317 .dst_lookup = xfrm6_dst_lookup, 311 .dst_lookup = xfrm6_dst_lookup,
318 .find_bundle = __xfrm6_find_bundle, 312 .find_bundle = __xfrm6_find_bundle,
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
index a5723024d3b3..b33296b3f6de 100644
--- a/net/ipv6/xfrm6_state.c
+++ b/net/ipv6/xfrm6_state.c
@@ -135,7 +135,6 @@ __xfrm6_find_acq(u8 mode, u32 reqid, u8 proto,
135 135
136static struct xfrm_state_afinfo xfrm6_state_afinfo = { 136static struct xfrm_state_afinfo xfrm6_state_afinfo = {
137 .family = AF_INET6, 137 .family = AF_INET6,
138 .lock = RW_LOCK_UNLOCKED,
139 .init_tempsel = __xfrm6_init_tempsel, 138 .init_tempsel = __xfrm6_init_tempsel,
140 .state_lookup = __xfrm6_state_lookup, 139 .state_lookup = __xfrm6_state_lookup,
141 .find_acq = __xfrm6_find_acq, 140 .find_acq = __xfrm6_find_acq,
diff --git a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c
index a394c6fe19a2..bba3431cd9a5 100644
--- a/net/ipx/ipx_route.c
+++ b/net/ipx/ipx_route.c
@@ -238,7 +238,7 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
238 } 238 }
239 239
240 /* Apply checksum. Not allowed on 802.3 links. */ 240 /* Apply checksum. Not allowed on 802.3 links. */
241 if (sk->sk_no_check || intrfc->if_dlink_type == IPX_FRAME_8023) 241 if (sk->sk_no_check || intrfc->if_dlink_type == htons(IPX_FRAME_8023))
242 ipx->ipx_checksum = 0xFFFF; 242 ipx->ipx_checksum = 0xFFFF;
243 else 243 else
244 ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr)); 244 ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr));
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index c19e9ce05a3a..57ea160f470b 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -44,6 +44,8 @@
44#include <net/irda/irlmp.h> 44#include <net/irda/irlmp.h>
45#include <net/irda/irlmp_frame.h> 45#include <net/irda/irlmp_frame.h>
46 46
47#include <asm/unaligned.h>
48
47static __u8 irlmp_find_free_slsap(void); 49static __u8 irlmp_find_free_slsap(void);
48static int irlmp_slsap_inuse(__u8 slsap_sel); 50static int irlmp_slsap_inuse(__u8 slsap_sel);
49 51
@@ -840,6 +842,7 @@ void irlmp_do_expiry(void)
840void irlmp_do_discovery(int nslots) 842void irlmp_do_discovery(int nslots)
841{ 843{
842 struct lap_cb *lap; 844 struct lap_cb *lap;
845 __u16 *data_hintsp;
843 846
844 /* Make sure the value is sane */ 847 /* Make sure the value is sane */
845 if ((nslots != 1) && (nslots != 6) && (nslots != 8) && (nslots != 16)){ 848 if ((nslots != 1) && (nslots != 6) && (nslots != 8) && (nslots != 16)){
@@ -849,7 +852,8 @@ void irlmp_do_discovery(int nslots)
849 } 852 }
850 853
851 /* Construct new discovery info to be used by IrLAP, */ 854 /* Construct new discovery info to be used by IrLAP, */
852 u16ho(irlmp->discovery_cmd.data.hints) = irlmp->hints.word; 855 data_hintsp = (__u16 *) irlmp->discovery_cmd.data.hints;
856 put_unaligned(irlmp->hints.word, data_hintsp);
853 857
854 /* 858 /*
855 * Set character set for device name (we use ASCII), and 859 * Set character set for device name (we use ASCII), and
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 859582275cab..d5e2121ea207 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1454,21 +1454,23 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1454 if (x == NULL) 1454 if (x == NULL)
1455 return -ESRCH; 1455 return -ESRCH;
1456 1456
1457 if ((err = security_xfrm_state_delete(x)))
1458 goto out;
1459
1457 if (xfrm_state_kern(x)) { 1460 if (xfrm_state_kern(x)) {
1458 xfrm_state_put(x); 1461 err = -EPERM;
1459 return -EPERM; 1462 goto out;
1460 } 1463 }
1461 1464
1462 err = xfrm_state_delete(x); 1465 err = xfrm_state_delete(x);
1463 if (err < 0) { 1466 if (err < 0)
1464 xfrm_state_put(x); 1467 goto out;
1465 return err;
1466 }
1467 1468
1468 c.seq = hdr->sadb_msg_seq; 1469 c.seq = hdr->sadb_msg_seq;
1469 c.pid = hdr->sadb_msg_pid; 1470 c.pid = hdr->sadb_msg_pid;
1470 c.event = XFRM_MSG_DELSA; 1471 c.event = XFRM_MSG_DELSA;
1471 km_state_notify(x, &c); 1472 km_state_notify(x, &c);
1473out:
1472 xfrm_state_put(x); 1474 xfrm_state_put(x);
1473 1475
1474 return err; 1476 return err;
@@ -2274,11 +2276,14 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
2274 2276
2275 err = 0; 2277 err = 0;
2276 2278
2279 if ((err = security_xfrm_policy_delete(xp)))
2280 goto out;
2277 c.seq = hdr->sadb_msg_seq; 2281 c.seq = hdr->sadb_msg_seq;
2278 c.pid = hdr->sadb_msg_pid; 2282 c.pid = hdr->sadb_msg_pid;
2279 c.event = XFRM_MSG_DELPOLICY; 2283 c.event = XFRM_MSG_DELPOLICY;
2280 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); 2284 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c);
2281 2285
2286out:
2282 xfrm_pol_put(xp); 2287 xfrm_pol_put(xp);
2283 return err; 2288 return err;
2284} 2289}
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 5a04db745c8d..75c9b1480801 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -674,7 +674,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
674 674
675 lock_sock(sk); 675 lock_sock(sk);
676 copied = -ENOTCONN; 676 copied = -ENOTCONN;
677 if (sk->sk_state == TCP_LISTEN) 677 if (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN))
678 goto out; 678 goto out;
679 679
680 timeo = sock_rcvtimeo(sk, nonblock); 680 timeo = sock_rcvtimeo(sk, nonblock);
@@ -733,7 +733,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
733 if (sk->sk_shutdown & RCV_SHUTDOWN) 733 if (sk->sk_shutdown & RCV_SHUTDOWN)
734 break; 734 break;
735 735
736 if (sk->sk_state == TCP_CLOSE) { 736 if (sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_CLOSE) {
737 if (!sock_flag(sk, SOCK_DONE)) { 737 if (!sock_flag(sk, SOCK_DONE)) {
738 /* 738 /*
739 * This occurs when user tries to read 739 * This occurs when user tries to read
@@ -789,7 +789,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
789 continue; 789 continue;
790 790
791 if (!(flags & MSG_PEEK)) { 791 if (!(flags & MSG_PEEK)) {
792 sk_eat_skb(sk, skb); 792 sk_eat_skb(sk, skb, 0);
793 *seq = 0; 793 *seq = 0;
794 } 794 }
795 } while (len > 0); 795 } while (len > 0);
diff --git a/net/llc/llc_if.c b/net/llc/llc_if.c
index ba90f7f0801a..5ae47be7dde0 100644
--- a/net/llc/llc_if.c
+++ b/net/llc/llc_if.c
@@ -26,8 +26,6 @@
26#include <net/llc_c_st.h> 26#include <net/llc_c_st.h>
27#include <net/tcp_states.h> 27#include <net/tcp_states.h>
28 28
29u8 llc_mac_null_var[IFHWADDRLEN];
30
31/** 29/**
32 * llc_build_and_send_pkt - Connection data sending for upper layers. 30 * llc_build_and_send_pkt - Connection data sending for upper layers.
33 * @sk: connection 31 * @sk: connection
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index d62e0f9b9da3..94d2368ade92 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -142,6 +142,8 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
142 struct llc_sap *sap; 142 struct llc_sap *sap;
143 struct llc_pdu_sn *pdu; 143 struct llc_pdu_sn *pdu;
144 int dest; 144 int dest;
145 int (*rcv)(struct sk_buff *, struct net_device *,
146 struct packet_type *, struct net_device *);
145 147
146 /* 148 /*
147 * When the interface is in promisc. mode, drop all the crap that it 149 * When the interface is in promisc. mode, drop all the crap that it
@@ -169,9 +171,11 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
169 * First the upper layer protocols that don't need the full 171 * First the upper layer protocols that don't need the full
170 * LLC functionality 172 * LLC functionality
171 */ 173 */
172 if (sap->rcv_func) { 174 rcv = rcu_dereference(sap->rcv_func);
173 sap->rcv_func(skb, dev, pt, orig_dev); 175 if (rcv) {
174 goto out_put; 176 struct sk_buff *cskb = skb_clone(skb, GFP_ATOMIC);
177 if (cskb)
178 rcv(cskb, dev, pt, orig_dev);
175 } 179 }
176 dest = llc_pdu_type(skb); 180 dest = llc_pdu_type(skb);
177 if (unlikely(!dest || !llc_type_handlers[dest - 1])) 181 if (unlikely(!dest || !llc_type_handlers[dest - 1]))
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 4029ceee9b91..20c4eb5c1ac6 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -282,7 +282,7 @@ static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb)
282 * mac, and local sap. Returns pointer for socket found, %NULL otherwise. 282 * mac, and local sap. Returns pointer for socket found, %NULL otherwise.
283 */ 283 */
284static struct sock *llc_lookup_dgram(struct llc_sap *sap, 284static struct sock *llc_lookup_dgram(struct llc_sap *sap,
285 struct llc_addr *laddr) 285 const struct llc_addr *laddr)
286{ 286{
287 struct sock *rc; 287 struct sock *rc;
288 struct hlist_node *node; 288 struct hlist_node *node;
@@ -304,19 +304,62 @@ found:
304 return rc; 304 return rc;
305} 305}
306 306
307/**
308 * llc_sap_mcast - Deliver multicast PDU's to all matching datagram sockets.
309 * @sap: SAP
310 * @laddr: address of local LLC (MAC + SAP)
311 *
312 * Search socket list of the SAP and finds connections with same sap.
313 * Deliver clone to each.
314 */
315static void llc_sap_mcast(struct llc_sap *sap,
316 const struct llc_addr *laddr,
317 struct sk_buff *skb)
318{
319 struct sock *sk;
320 struct hlist_node *node;
321
322 read_lock_bh(&sap->sk_list.lock);
323 sk_for_each(sk, node, &sap->sk_list.list) {
324 struct llc_sock *llc = llc_sk(sk);
325 struct sk_buff *skb1;
326
327 if (sk->sk_type != SOCK_DGRAM)
328 continue;
329
330 if (llc->laddr.lsap != laddr->lsap)
331 continue;
332
333 skb1 = skb_clone(skb, GFP_ATOMIC);
334 if (!skb1)
335 break;
336
337 sock_hold(sk);
338 skb_set_owner_r(skb1, sk);
339 llc_sap_rcv(sap, skb1);
340 sock_put(sk);
341 }
342 read_unlock_bh(&sap->sk_list.lock);
343}
344
345
307void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb) 346void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb)
308{ 347{
309 struct llc_addr laddr; 348 struct llc_addr laddr;
310 struct sock *sk;
311 349
312 llc_pdu_decode_da(skb, laddr.mac); 350 llc_pdu_decode_da(skb, laddr.mac);
313 llc_pdu_decode_dsap(skb, &laddr.lsap); 351 llc_pdu_decode_dsap(skb, &laddr.lsap);
314 352
315 sk = llc_lookup_dgram(sap, &laddr); 353 if (llc_mac_multicast(laddr.mac)) {
316 if (sk) { 354 llc_sap_mcast(sap, &laddr, skb);
317 skb_set_owner_r(skb, sk);
318 llc_sap_rcv(sap, skb);
319 sock_put(sk);
320 } else
321 kfree_skb(skb); 355 kfree_skb(skb);
356 } else {
357 struct sock *sk = llc_lookup_dgram(sap, &laddr);
358 if (sk) {
359 skb_set_owner_r(skb, sk);
360 llc_sap_rcv(sap, skb);
361 sock_put(sk);
362 } else
363 kfree_skb(skb);
364 }
322} 365}
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index e2893effdfaa..b1622b7de1cf 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -60,6 +60,18 @@ config NF_CONNTRACK_MARK
60 of packets, but this mark value is kept in the conntrack session 60 of packets, but this mark value is kept in the conntrack session
61 instead of the individual packets. 61 instead of the individual packets.
62 62
63config NF_CONNTRACK_SECMARK
64 bool 'Connection tracking security mark support'
65 depends on NF_CONNTRACK && NETWORK_SECMARK
66 help
67 This option enables security markings to be applied to
68 connections. Typically they are copied to connections from
69 packets using the CONNSECMARK target and copied back from
70 connections to packets with the same target, with the packets
71 being originally labeled via SECMARK.
72
73 If unsure, say 'N'.
74
63config NF_CONNTRACK_EVENTS 75config NF_CONNTRACK_EVENTS
64 bool "Connection tracking events (EXPERIMENTAL)" 76 bool "Connection tracking events (EXPERIMENTAL)"
65 depends on EXPERIMENTAL && NF_CONNTRACK 77 depends on EXPERIMENTAL && NF_CONNTRACK
@@ -174,6 +186,26 @@ config NETFILTER_XT_TARGET_NOTRACK
174 If you want to compile it as a module, say M here and read 186 If you want to compile it as a module, say M here and read
175 <file:Documentation/modules.txt>. If unsure, say `N'. 187 <file:Documentation/modules.txt>. If unsure, say `N'.
176 188
189config NETFILTER_XT_TARGET_SECMARK
190 tristate '"SECMARK" target support'
191 depends on NETFILTER_XTABLES && NETWORK_SECMARK
192 help
193 The SECMARK target allows security marking of network
194 packets, for use with security subsystems.
195
196 To compile it as a module, choose M here. If unsure, say N.
197
198config NETFILTER_XT_TARGET_CONNSECMARK
199 tristate '"CONNSECMARK" target support'
200 depends on NETFILTER_XTABLES && (NF_CONNTRACK_SECMARK || IP_NF_CONNTRACK_SECMARK)
201 help
202 The CONNSECMARK target copies security markings from packets
203 to connections, and restores security markings from connections
204 to packets (if the packets are not already marked). This would
205 normally be used in conjunction with the SECMARK target.
206
207 To compile it as a module, choose M here. If unsure, say N.
208
177config NETFILTER_XT_MATCH_COMMENT 209config NETFILTER_XT_MATCH_COMMENT
178 tristate '"comment" match support' 210 tristate '"comment" match support'
179 depends on NETFILTER_XTABLES 211 depends on NETFILTER_XTABLES
@@ -329,6 +361,16 @@ config NETFILTER_XT_MATCH_PKTTYPE
329 361
330 To compile it as a module, choose M here. If unsure, say N. 362 To compile it as a module, choose M here. If unsure, say N.
331 363
364config NETFILTER_XT_MATCH_QUOTA
365 tristate '"quota" match support'
366 depends on NETFILTER_XTABLES
367 help
368 This option adds a `quota' match, which allows to match on a
369 byte counter.
370
371 If you want to compile it as a module, say M here and read
372 <file:Documentation/modules.txt>. If unsure, say `N'.
373
332config NETFILTER_XT_MATCH_REALM 374config NETFILTER_XT_MATCH_REALM
333 tristate '"realm" match support' 375 tristate '"realm" match support'
334 depends on NETFILTER_XTABLES 376 depends on NETFILTER_XTABLES
@@ -365,6 +407,12 @@ config NETFILTER_XT_MATCH_STATE
365 407
366 To compile it as a module, choose M here. If unsure, say N. 408 To compile it as a module, choose M here. If unsure, say N.
367 409
410config NETFILTER_XT_MATCH_STATISTIC
411 tristate '"statistic" match support'
412 depends on NETFILTER_XTABLES
413 help
414 statistic module
415
368config NETFILTER_XT_MATCH_STRING 416config NETFILTER_XT_MATCH_STRING
369 tristate '"string" match support' 417 tristate '"string" match support'
370 depends on NETFILTER_XTABLES 418 depends on NETFILTER_XTABLES
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile
index 95b7e416512d..6fa4b7580458 100644
--- a/net/netfilter/Makefile
+++ b/net/netfilter/Makefile
@@ -28,6 +28,8 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o
28obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o 28obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o
29obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o 29obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o
30obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o 30obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o
31obj-$(CONFIG_NETFILTER_XT_TARGET_SECMARK) += xt_SECMARK.o
32obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o
31 33
32# matches 34# matches
33obj-$(CONFIG_NETFILTER_XT_MATCH_COMMENT) += xt_comment.o 35obj-$(CONFIG_NETFILTER_XT_MATCH_COMMENT) += xt_comment.o
@@ -44,9 +46,11 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_MARK) += xt_mark.o
44obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o 46obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o
45obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o 47obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o
46obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o 48obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o
49obj-$(CONFIG_NETFILTER_XT_MATCH_QUOTA) += xt_quota.o
47obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o 50obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o
48obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o 51obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o
49obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o 52obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o
53obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o
50obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o 54obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o
51obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o 55obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o
52obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o 56obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index f9b83f91371a..cd299f4b7db1 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -990,6 +990,9 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
990#ifdef CONFIG_NF_CONNTRACK_MARK 990#ifdef CONFIG_NF_CONNTRACK_MARK
991 conntrack->mark = exp->master->mark; 991 conntrack->mark = exp->master->mark;
992#endif 992#endif
993#ifdef CONFIG_NF_CONNTRACK_SECMARK
994 conntrack->secmark = exp->master->secmark;
995#endif
993 nf_conntrack_get(&conntrack->master->ct_general); 996 nf_conntrack_get(&conntrack->master->ct_general);
994 NF_CT_STAT_INC(expect_new); 997 NF_CT_STAT_INC(expect_new);
995 } else 998 } else
@@ -1396,6 +1399,12 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,
1396 1399
1397 write_lock_bh(&nf_conntrack_lock); 1400 write_lock_bh(&nf_conntrack_lock);
1398 1401
1402 /* Only update if this is not a fixed timeout */
1403 if (test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) {
1404 write_unlock_bh(&nf_conntrack_lock);
1405 return;
1406 }
1407
1399 /* If not in hash table, timer will not be active yet */ 1408 /* If not in hash table, timer will not be active yet */
1400 if (!nf_ct_is_confirmed(ct)) { 1409 if (!nf_ct_is_confirmed(ct)) {
1401 ct->timeout.expires = extra_jiffies; 1410 ct->timeout.expires = extra_jiffies;
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index e38a4b5a3089..11d3be243536 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -67,37 +67,48 @@ static int try_epsv_response(const char *, size_t, struct nf_conntrack_man *,
67 char); 67 char);
68 68
69static struct ftp_search { 69static struct ftp_search {
70 enum ip_conntrack_dir dir;
71 const char *pattern; 70 const char *pattern;
72 size_t plen; 71 size_t plen;
73 char skip; 72 char skip;
74 char term; 73 char term;
75 enum ip_ct_ftp_type ftptype; 74 enum ip_ct_ftp_type ftptype;
76 int (*getnum)(const char *, size_t, struct nf_conntrack_man *, char); 75 int (*getnum)(const char *, size_t, struct nf_conntrack_man *, char);
77} search[] = { 76} search[IP_CT_DIR_MAX][2] = {
78 { 77 [IP_CT_DIR_ORIGINAL] = {
79 IP_CT_DIR_ORIGINAL, 78 {
80 "PORT", sizeof("PORT") - 1, ' ', '\r', 79 .pattern = "PORT",
81 IP_CT_FTP_PORT, 80 .plen = sizeof("PORT") - 1,
82 try_rfc959, 81 .skip = ' ',
82 .term = '\r',
83 .ftptype = IP_CT_FTP_PORT,
84 .getnum = try_rfc959,
85 },
86 {
87 .pattern = "EPRT",
88 .plen = sizeof("EPRT") - 1,
89 .skip = ' ',
90 .term = '\r',
91 .ftptype = IP_CT_FTP_EPRT,
92 .getnum = try_eprt,
93 },
83 }, 94 },
84 { 95 [IP_CT_DIR_REPLY] = {
85 IP_CT_DIR_REPLY, 96 {
86 "227 ", sizeof("227 ") - 1, '(', ')', 97 .pattern = "227 ",
87 IP_CT_FTP_PASV, 98 .plen = sizeof("227 ") - 1,
88 try_rfc959, 99 .skip = '(',
89 }, 100 .term = ')',
90 { 101 .ftptype = IP_CT_FTP_PASV,
91 IP_CT_DIR_ORIGINAL, 102 .getnum = try_rfc959,
92 "EPRT", sizeof("EPRT") - 1, ' ', '\r', 103 },
93 IP_CT_FTP_EPRT, 104 {
94 try_eprt, 105 .pattern = "229 ",
95 }, 106 .plen = sizeof("229 ") - 1,
96 { 107 .skip = '(',
97 IP_CT_DIR_REPLY, 108 .term = ')',
98 "229 ", sizeof("229 ") - 1, '(', ')', 109 .ftptype = IP_CT_FTP_EPSV,
99 IP_CT_FTP_EPSV, 110 .getnum = try_epsv_response,
100 try_epsv_response, 111 },
101 }, 112 },
102}; 113};
103 114
@@ -492,17 +503,15 @@ static int help(struct sk_buff **pskb,
492 memcpy(cmd.u3.all, &ct->tuplehash[dir].tuple.src.u3.all, 503 memcpy(cmd.u3.all, &ct->tuplehash[dir].tuple.src.u3.all,
493 sizeof(cmd.u3.all)); 504 sizeof(cmd.u3.all));
494 505
495 for (i = 0; i < ARRAY_SIZE(search); i++) { 506 for (i = 0; i < ARRAY_SIZE(search[dir]); i++) {
496 if (search[i].dir != dir) continue;
497
498 found = find_pattern(fb_ptr, datalen, 507 found = find_pattern(fb_ptr, datalen,
499 search[i].pattern, 508 search[dir][i].pattern,
500 search[i].plen, 509 search[dir][i].plen,
501 search[i].skip, 510 search[dir][i].skip,
502 search[i].term, 511 search[dir][i].term,
503 &matchoff, &matchlen, 512 &matchoff, &matchlen,
504 &cmd, 513 &cmd,
505 search[i].getnum); 514 search[dir][i].getnum);
506 if (found) break; 515 if (found) break;
507 } 516 }
508 if (found == -1) { 517 if (found == -1) {
@@ -512,7 +521,7 @@ static int help(struct sk_buff **pskb,
512 this case. */ 521 this case. */
513 if (net_ratelimit()) 522 if (net_ratelimit())
514 printk("conntrack_ftp: partial %s %u+%u\n", 523 printk("conntrack_ftp: partial %s %u+%u\n",
515 search[i].pattern, 524 search[dir][i].pattern,
516 ntohl(th->seq), datalen); 525 ntohl(th->seq), datalen);
517 ret = NF_DROP; 526 ret = NF_DROP;
518 goto out; 527 goto out;
@@ -597,7 +606,7 @@ static int help(struct sk_buff **pskb,
597 /* Now, NAT might want to mangle the packet, and register the 606 /* Now, NAT might want to mangle the packet, and register the
598 * (possibly changed) expectation itself. */ 607 * (possibly changed) expectation itself. */
599 if (nf_nat_ftp_hook) 608 if (nf_nat_ftp_hook)
600 ret = nf_nat_ftp_hook(pskb, ctinfo, search[i].ftptype, 609 ret = nf_nat_ftp_hook(pskb, ctinfo, search[dir][i].ftptype,
601 matchoff, matchlen, exp, &seq); 610 matchoff, matchlen, exp, &seq);
602 else { 611 else {
603 /* Can't expect this? Best to drop packet now. */ 612 /* Can't expect this? Best to drop packet now. */
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index bd10eb944b65..b8c7c567c9df 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -407,6 +407,8 @@ nfattr_failure:
407 407
408static int ctnetlink_done(struct netlink_callback *cb) 408static int ctnetlink_done(struct netlink_callback *cb)
409{ 409{
410 if (cb->args[1])
411 nf_ct_put((struct nf_conn *)cb->args[1]);
410 DEBUGP("entered %s\n", __FUNCTION__); 412 DEBUGP("entered %s\n", __FUNCTION__);
411 return 0; 413 return 0;
412} 414}
@@ -416,10 +418,9 @@ static int ctnetlink_done(struct netlink_callback *cb)
416static int 418static int
417ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) 419ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
418{ 420{
419 struct nf_conn *ct = NULL; 421 struct nf_conn *ct, *last;
420 struct nf_conntrack_tuple_hash *h; 422 struct nf_conntrack_tuple_hash *h;
421 struct list_head *i; 423 struct list_head *i;
422 u_int32_t *id = (u_int32_t *) &cb->args[1];
423 struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh); 424 struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh);
424 u_int8_t l3proto = nfmsg->nfgen_family; 425 u_int8_t l3proto = nfmsg->nfgen_family;
425 426
@@ -427,7 +428,9 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
427 cb->args[0], *id); 428 cb->args[0], *id);
428 429
429 read_lock_bh(&nf_conntrack_lock); 430 read_lock_bh(&nf_conntrack_lock);
430 for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++, *id = 0) { 431 for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) {
432restart:
433 last = (struct nf_conn *)cb->args[1];
431 list_for_each_prev(i, &nf_conntrack_hash[cb->args[0]]) { 434 list_for_each_prev(i, &nf_conntrack_hash[cb->args[0]]) {
432 h = (struct nf_conntrack_tuple_hash *) i; 435 h = (struct nf_conntrack_tuple_hash *) i;
433 if (DIRECTION(h) != IP_CT_DIR_ORIGINAL) 436 if (DIRECTION(h) != IP_CT_DIR_ORIGINAL)
@@ -438,17 +441,30 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
438 * then dump everything. */ 441 * then dump everything. */
439 if (l3proto && L3PROTO(ct) != l3proto) 442 if (l3proto && L3PROTO(ct) != l3proto)
440 continue; 443 continue;
441 if (ct->id <= *id) 444 if (last != NULL) {
442 continue; 445 if (ct == last) {
446 nf_ct_put(last);
447 cb->args[1] = 0;
448 last = NULL;
449 } else
450 continue;
451 }
443 if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, 452 if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid,
444 cb->nlh->nlmsg_seq, 453 cb->nlh->nlmsg_seq,
445 IPCTNL_MSG_CT_NEW, 454 IPCTNL_MSG_CT_NEW,
446 1, ct) < 0) 455 1, ct) < 0) {
456 nf_conntrack_get(&ct->ct_general);
457 cb->args[1] = (unsigned long)ct;
447 goto out; 458 goto out;
448 *id = ct->id; 459 }
460 }
461 if (last != NULL) {
462 nf_ct_put(last);
463 cb->args[1] = 0;
464 goto restart;
449 } 465 }
450 } 466 }
451out: 467out:
452 read_unlock_bh(&nf_conntrack_lock); 468 read_unlock_bh(&nf_conntrack_lock);
453 469
454 DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id); 470 DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id);
@@ -641,7 +657,7 @@ static const size_t cta_min_nat[CTA_NAT_MAX] = {
641}; 657};
642 658
643static inline int 659static inline int
644ctnetlink_parse_nat(struct nfattr *cda[], 660ctnetlink_parse_nat(struct nfattr *nat,
645 const struct nf_conn *ct, struct ip_nat_range *range) 661 const struct nf_conn *ct, struct ip_nat_range *range)
646{ 662{
647 struct nfattr *tb[CTA_NAT_MAX]; 663 struct nfattr *tb[CTA_NAT_MAX];
@@ -651,7 +667,7 @@ ctnetlink_parse_nat(struct nfattr *cda[],
651 667
652 memset(range, 0, sizeof(*range)); 668 memset(range, 0, sizeof(*range));
653 669
654 nfattr_parse_nested(tb, CTA_NAT_MAX, cda[CTA_NAT-1]); 670 nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
655 671
656 if (nfattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat)) 672 if (nfattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat))
657 return -EINVAL; 673 return -EINVAL;
@@ -866,39 +882,30 @@ ctnetlink_change_status(struct nf_conn *ct, struct nfattr *cda[])
866 /* ASSURED bit can only be set */ 882 /* ASSURED bit can only be set */
867 return -EINVAL; 883 return -EINVAL;
868 884
869 if (cda[CTA_NAT-1]) { 885 if (cda[CTA_NAT_SRC-1] || cda[CTA_NAT_DST-1]) {
870#ifndef CONFIG_IP_NF_NAT_NEEDED 886#ifndef CONFIG_IP_NF_NAT_NEEDED
871 return -EINVAL; 887 return -EINVAL;
872#else 888#else
873 unsigned int hooknum;
874 struct ip_nat_range range; 889 struct ip_nat_range range;
875 890
876 if (ctnetlink_parse_nat(cda, ct, &range) < 0) 891 if (cda[CTA_NAT_DST-1]) {
877 return -EINVAL; 892 if (ctnetlink_parse_nat(cda[CTA_NAT_DST-1], ct,
878 893 &range) < 0)
879 DEBUGP("NAT: %u.%u.%u.%u-%u.%u.%u.%u:%u-%u\n", 894 return -EINVAL;
880 NIPQUAD(range.min_ip), NIPQUAD(range.max_ip), 895 if (ip_nat_initialized(ct,
881 htons(range.min.all), htons(range.max.all)); 896 HOOK2MANIP(NF_IP_PRE_ROUTING)))
882 897 return -EEXIST;
883 /* This is tricky but it works. ip_nat_setup_info needs the 898 ip_nat_setup_info(ct, &range, hooknum);
884 * hook number as parameter, so let's do the correct 899 }
885 * conversion and run away */ 900 if (cda[CTA_NAT_SRC-1]) {
886 if (status & IPS_SRC_NAT_DONE) 901 if (ctnetlink_parse_nat(cda[CTA_NAT_SRC-1], ct,
887 hooknum = NF_IP_POST_ROUTING; /* IP_NAT_MANIP_SRC */ 902 &range) < 0)
888 else if (status & IPS_DST_NAT_DONE) 903 return -EINVAL;
889 hooknum = NF_IP_PRE_ROUTING; /* IP_NAT_MANIP_DST */ 904 if (ip_nat_initialized(ct,
890 else 905 HOOK2MANIP(NF_IP_POST_ROUTING)))
891 return -EINVAL; /* Missing NAT flags */ 906 return -EEXIST;
892 907 ip_nat_setup_info(ct, &range, hooknum);
893 DEBUGP("NAT status: %lu\n", 908 }
894 status & (IPS_NAT_MASK | IPS_NAT_DONE_MASK));
895
896 if (ip_nat_initialized(ct, HOOK2MANIP(hooknum)))
897 return -EEXIST;
898 ip_nat_setup_info(ct, &range, hooknum);
899
900 DEBUGP("NAT status after setup_info: %lu\n",
901 ct->status & (IPS_NAT_MASK | IPS_NAT_DONE_MASK));
902#endif 909#endif
903 } 910 }
904 911
@@ -1122,7 +1129,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1122 /* implicit 'else' */ 1129 /* implicit 'else' */
1123 1130
1124 /* we only allow nat config for new conntracks */ 1131 /* we only allow nat config for new conntracks */
1125 if (cda[CTA_NAT-1]) { 1132 if (cda[CTA_NAT_SRC-1] || cda[CTA_NAT_DST-1]) {
1126 err = -EINVAL; 1133 err = -EINVAL;
1127 goto out_unlock; 1134 goto out_unlock;
1128 } 1135 }
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 69899f27d26a..12fb7c0a1509 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -828,8 +828,9 @@ static int tcp_error(struct sk_buff *skb,
828 * and moreover root might send raw packets. 828 * and moreover root might send raw packets.
829 */ 829 */
830 /* FIXME: Source route IP option packets --RR */ 830 /* FIXME: Source route IP option packets --RR */
831 if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) || 831 if (nf_conntrack_checksum &&
832 (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) && 832 ((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) ||
833 (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) &&
833 nf_checksum(skb, hooknum, dataoff, IPPROTO_TCP, pf)) { 834 nf_checksum(skb, hooknum, dataoff, IPPROTO_TCP, pf)) {
834 if (LOG_INVALID(IPPROTO_TCP)) 835 if (LOG_INVALID(IPPROTO_TCP))
835 nf_log_packet(pf, 0, skb, NULL, NULL, NULL, 836 nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index d93edbfde9e3..ae07ebe3ab37 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -134,7 +134,8 @@ static int udp_error(struct sk_buff *skb, unsigned int dataoff,
134 * because the semantic of CHECKSUM_HW is different there 134 * because the semantic of CHECKSUM_HW is different there
135 * and moreover root might send raw packets. 135 * and moreover root might send raw packets.
136 * FIXME: Source route IP option packets --RR */ 136 * FIXME: Source route IP option packets --RR */
137 if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) || 137 if (nf_conntrack_checksum &&
138 ((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) ||
138 (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) && 139 (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) &&
139 nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) { 140 nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) {
140 if (LOG_INVALID(IPPROTO_UDP)) 141 if (LOG_INVALID(IPPROTO_UDP))
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 408960c6a544..e34c574f0351 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -213,6 +213,11 @@ static int ct_seq_show(struct seq_file *s, void *v)
213 return -ENOSPC; 213 return -ENOSPC;
214#endif 214#endif
215 215
216#ifdef CONFIG_NF_CONNTRACK_SECMARK
217 if (seq_printf(s, "secmark=%u ", conntrack->secmark))
218 return -ENOSPC;
219#endif
220
216 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use))) 221 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use)))
217 return -ENOSPC; 222 return -ENOSPC;
218 223
@@ -455,6 +460,8 @@ extern unsigned int nf_ct_generic_timeout;
455static int log_invalid_proto_min = 0; 460static int log_invalid_proto_min = 0;
456static int log_invalid_proto_max = 255; 461static int log_invalid_proto_max = 255;
457 462
463int nf_conntrack_checksum = 1;
464
458static struct ctl_table_header *nf_ct_sysctl_header; 465static struct ctl_table_header *nf_ct_sysctl_header;
459 466
460static ctl_table nf_ct_sysctl_table[] = { 467static ctl_table nf_ct_sysctl_table[] = {
@@ -483,6 +490,14 @@ static ctl_table nf_ct_sysctl_table[] = {
483 .proc_handler = &proc_dointvec, 490 .proc_handler = &proc_dointvec,
484 }, 491 },
485 { 492 {
493 .ctl_name = NET_NF_CONNTRACK_CHECKSUM,
494 .procname = "nf_conntrack_checksum",
495 .data = &nf_conntrack_checksum,
496 .maxlen = sizeof(unsigned int),
497 .mode = 0644,
498 .proc_handler = &proc_dointvec,
499 },
500 {
486 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, 501 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,
487 .procname = "nf_conntrack_tcp_timeout_syn_sent", 502 .procname = "nf_conntrack_tcp_timeout_syn_sent",
488 .data = &nf_ct_tcp_timeout_syn_sent, 503 .data = &nf_ct_tcp_timeout_syn_sent,
@@ -851,6 +866,7 @@ EXPORT_SYMBOL(nf_ct_proto_put);
851EXPORT_SYMBOL(nf_ct_l3proto_find_get); 866EXPORT_SYMBOL(nf_ct_l3proto_find_get);
852EXPORT_SYMBOL(nf_ct_l3proto_put); 867EXPORT_SYMBOL(nf_ct_l3proto_put);
853EXPORT_SYMBOL(nf_ct_l3protos); 868EXPORT_SYMBOL(nf_ct_l3protos);
869EXPORT_SYMBOL_GPL(nf_conntrack_checksum);
854EXPORT_SYMBOL(nf_conntrack_expect_alloc); 870EXPORT_SYMBOL(nf_conntrack_expect_alloc);
855EXPORT_SYMBOL(nf_conntrack_expect_put); 871EXPORT_SYMBOL(nf_conntrack_expect_put);
856EXPORT_SYMBOL(nf_conntrack_expect_related); 872EXPORT_SYMBOL(nf_conntrack_expect_related);
diff --git a/net/netfilter/xt_CONNSECMARK.c b/net/netfilter/xt_CONNSECMARK.c
new file mode 100644
index 000000000000..8c011e020769
--- /dev/null
+++ b/net/netfilter/xt_CONNSECMARK.c
@@ -0,0 +1,155 @@
1/*
2 * This module is used to copy security markings from packets
3 * to connections, and restore security markings from connections
4 * back to packets. This would normally be performed in conjunction
5 * with the SECMARK target and state match.
6 *
7 * Based somewhat on CONNMARK:
8 * Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
9 * by Henrik Nordstrom <hno@marasystems.com>
10 *
11 * (C) 2006 Red Hat, Inc., James Morris <jmorris@redhat.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 *
17 */
18#include <linux/module.h>
19#include <linux/skbuff.h>
20#include <linux/netfilter/x_tables.h>
21#include <linux/netfilter/xt_CONNSECMARK.h>
22#include <net/netfilter/nf_conntrack_compat.h>
23
24#define PFX "CONNSECMARK: "
25
26MODULE_LICENSE("GPL");
27MODULE_AUTHOR("James Morris <jmorris@redhat.com>");
28MODULE_DESCRIPTION("ip[6]tables CONNSECMARK module");
29MODULE_ALIAS("ipt_CONNSECMARK");
30MODULE_ALIAS("ip6t_CONNSECMARK");
31
32/*
33 * If the packet has a security mark and the connection does not, copy
34 * the security mark from the packet to the connection.
35 */
36static void secmark_save(struct sk_buff *skb)
37{
38 if (skb->secmark) {
39 u32 *connsecmark;
40 enum ip_conntrack_info ctinfo;
41
42 connsecmark = nf_ct_get_secmark(skb, &ctinfo);
43 if (connsecmark && !*connsecmark)
44 if (*connsecmark != skb->secmark)
45 *connsecmark = skb->secmark;
46 }
47}
48
49/*
50 * If packet has no security mark, and the connection does, restore the
51 * security mark from the connection to the packet.
52 */
53static void secmark_restore(struct sk_buff *skb)
54{
55 if (!skb->secmark) {
56 u32 *connsecmark;
57 enum ip_conntrack_info ctinfo;
58
59 connsecmark = nf_ct_get_secmark(skb, &ctinfo);
60 if (connsecmark && *connsecmark)
61 if (skb->secmark != *connsecmark)
62 skb->secmark = *connsecmark;
63 }
64}
65
66static unsigned int target(struct sk_buff **pskb, const struct net_device *in,
67 const struct net_device *out, unsigned int hooknum,
68 const struct xt_target *target,
69 const void *targinfo, void *userinfo)
70{
71 struct sk_buff *skb = *pskb;
72 const struct xt_connsecmark_target_info *info = targinfo;
73
74 switch (info->mode) {
75 case CONNSECMARK_SAVE:
76 secmark_save(skb);
77 break;
78
79 case CONNSECMARK_RESTORE:
80 secmark_restore(skb);
81 break;
82
83 default:
84 BUG();
85 }
86
87 return XT_CONTINUE;
88}
89
90static int checkentry(const char *tablename, const void *entry,
91 const struct xt_target *target, void *targinfo,
92 unsigned int targinfosize, unsigned int hook_mask)
93{
94 struct xt_connsecmark_target_info *info = targinfo;
95
96 switch (info->mode) {
97 case CONNSECMARK_SAVE:
98 case CONNSECMARK_RESTORE:
99 break;
100
101 default:
102 printk(KERN_INFO PFX "invalid mode: %hu\n", info->mode);
103 return 0;
104 }
105
106 return 1;
107}
108
109static struct xt_target ipt_connsecmark_reg = {
110 .name = "CONNSECMARK",
111 .target = target,
112 .targetsize = sizeof(struct xt_connsecmark_target_info),
113 .table = "mangle",
114 .checkentry = checkentry,
115 .me = THIS_MODULE,
116 .family = AF_INET,
117 .revision = 0,
118};
119
120static struct xt_target ip6t_connsecmark_reg = {
121 .name = "CONNSECMARK",
122 .target = target,
123 .targetsize = sizeof(struct xt_connsecmark_target_info),
124 .table = "mangle",
125 .checkentry = checkentry,
126 .me = THIS_MODULE,
127 .family = AF_INET6,
128 .revision = 0,
129};
130
131static int __init xt_connsecmark_init(void)
132{
133 int err;
134
135 need_conntrack();
136
137 err = xt_register_target(&ipt_connsecmark_reg);
138 if (err)
139 return err;
140
141 err = xt_register_target(&ip6t_connsecmark_reg);
142 if (err)
143 xt_unregister_target(&ipt_connsecmark_reg);
144
145 return err;
146}
147
148static void __exit xt_connsecmark_fini(void)
149{
150 xt_unregister_target(&ip6t_connsecmark_reg);
151 xt_unregister_target(&ipt_connsecmark_reg);
152}
153
154module_init(xt_connsecmark_init);
155module_exit(xt_connsecmark_fini);
diff --git a/net/netfilter/xt_SECMARK.c b/net/netfilter/xt_SECMARK.c
new file mode 100644
index 000000000000..c2ce9c4011cc
--- /dev/null
+++ b/net/netfilter/xt_SECMARK.c
@@ -0,0 +1,156 @@
1/*
2 * Module for modifying the secmark field of the skb, for use by
3 * security subsystems.
4 *
5 * Based on the nfmark match by:
6 * (C) 1999-2001 Marc Boucher <marc@mbsi.ca>
7 *
8 * (C) 2006 Red Hat, Inc., James Morris <jmorris@redhat.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 */
15#include <linux/module.h>
16#include <linux/skbuff.h>
17#include <linux/selinux.h>
18#include <linux/netfilter/x_tables.h>
19#include <linux/netfilter/xt_SECMARK.h>
20
21MODULE_LICENSE("GPL");
22MODULE_AUTHOR("James Morris <jmorris@redhat.com>");
23MODULE_DESCRIPTION("ip[6]tables SECMARK modification module");
24MODULE_ALIAS("ipt_SECMARK");
25MODULE_ALIAS("ip6t_SECMARK");
26
27#define PFX "SECMARK: "
28
29static u8 mode;
30
31static unsigned int target(struct sk_buff **pskb, const struct net_device *in,
32 const struct net_device *out, unsigned int hooknum,
33 const struct xt_target *target,
34 const void *targinfo, void *userinfo)
35{
36 u32 secmark = 0;
37 const struct xt_secmark_target_info *info = targinfo;
38
39 BUG_ON(info->mode != mode);
40
41 switch (mode) {
42 case SECMARK_MODE_SEL:
43 secmark = info->u.sel.selsid;
44 break;
45
46 default:
47 BUG();
48 }
49
50 if ((*pskb)->secmark != secmark)
51 (*pskb)->secmark = secmark;
52
53 return XT_CONTINUE;
54}
55
56static int checkentry_selinux(struct xt_secmark_target_info *info)
57{
58 int err;
59 struct xt_secmark_target_selinux_info *sel = &info->u.sel;
60
61 err = selinux_string_to_sid(sel->selctx, &sel->selsid);
62 if (err) {
63 if (err == -EINVAL)
64 printk(KERN_INFO PFX "invalid SELinux context \'%s\'\n",
65 sel->selctx);
66 return 0;
67 }
68
69 if (!sel->selsid) {
70 printk(KERN_INFO PFX "unable to map SELinux context \'%s\'\n",
71 sel->selctx);
72 return 0;
73 }
74
75 err = selinux_relabel_packet_permission(sel->selsid);
76 if (err) {
77 printk(KERN_INFO PFX "unable to obtain relabeling permission\n");
78 return 0;
79 }
80
81 return 1;
82}
83
84static int checkentry(const char *tablename, const void *entry,
85 const struct xt_target *target, void *targinfo,
86 unsigned int targinfosize, unsigned int hook_mask)
87{
88 struct xt_secmark_target_info *info = targinfo;
89
90 if (mode && mode != info->mode) {
91 printk(KERN_INFO PFX "mode already set to %hu cannot mix with "
92 "rules for mode %hu\n", mode, info->mode);
93 return 0;
94 }
95
96 switch (info->mode) {
97 case SECMARK_MODE_SEL:
98 if (!checkentry_selinux(info))
99 return 0;
100 break;
101
102 default:
103 printk(KERN_INFO PFX "invalid mode: %hu\n", info->mode);
104 return 0;
105 }
106
107 if (!mode)
108 mode = info->mode;
109 return 1;
110}
111
112static struct xt_target ipt_secmark_reg = {
113 .name = "SECMARK",
114 .target = target,
115 .targetsize = sizeof(struct xt_secmark_target_info),
116 .table = "mangle",
117 .checkentry = checkentry,
118 .me = THIS_MODULE,
119 .family = AF_INET,
120 .revision = 0,
121};
122
123static struct xt_target ip6t_secmark_reg = {
124 .name = "SECMARK",
125 .target = target,
126 .targetsize = sizeof(struct xt_secmark_target_info),
127 .table = "mangle",
128 .checkentry = checkentry,
129 .me = THIS_MODULE,
130 .family = AF_INET6,
131 .revision = 0,
132};
133
134static int __init xt_secmark_init(void)
135{
136 int err;
137
138 err = xt_register_target(&ipt_secmark_reg);
139 if (err)
140 return err;
141
142 err = xt_register_target(&ip6t_secmark_reg);
143 if (err)
144 xt_unregister_target(&ipt_secmark_reg);
145
146 return err;
147}
148
149static void __exit xt_secmark_fini(void)
150{
151 xt_unregister_target(&ip6t_secmark_reg);
152 xt_unregister_target(&ipt_secmark_reg);
153}
154
155module_init(xt_secmark_init);
156module_exit(xt_secmark_fini);
diff --git a/net/netfilter/xt_connmark.c b/net/netfilter/xt_connmark.c
index dc26a27cbcaf..56324c8aff0a 100644
--- a/net/netfilter/xt_connmark.c
+++ b/net/netfilter/xt_connmark.c
@@ -58,7 +58,7 @@ checkentry(const char *tablename,
58 unsigned int matchsize, 58 unsigned int matchsize,
59 unsigned int hook_mask) 59 unsigned int hook_mask)
60{ 60{
61 struct xt_connmark_info *cm = (struct xt_connmark_info *)matchinfo; 61 struct xt_connmark_info *cm = matchinfo;
62 62
63 if (cm->mark > 0xffffffff || cm->mask > 0xffffffff) { 63 if (cm->mark > 0xffffffff || cm->mask > 0xffffffff) {
64 printk(KERN_WARNING "connmark: only support 32bit mark\n"); 64 printk(KERN_WARNING "connmark: only support 32bit mark\n");
diff --git a/net/netfilter/xt_dccp.c b/net/netfilter/xt_dccp.c
index dfb10b648e57..2e2f825dad4c 100644
--- a/net/netfilter/xt_dccp.c
+++ b/net/netfilter/xt_dccp.c
@@ -101,8 +101,7 @@ match(const struct sk_buff *skb,
101 unsigned int protoff, 101 unsigned int protoff,
102 int *hotdrop) 102 int *hotdrop)
103{ 103{
104 const struct xt_dccp_info *info = 104 const struct xt_dccp_info *info = matchinfo;
105 (const struct xt_dccp_info *)matchinfo;
106 struct dccp_hdr _dh, *dh; 105 struct dccp_hdr _dh, *dh;
107 106
108 if (offset) 107 if (offset)
diff --git a/net/netfilter/xt_mark.c b/net/netfilter/xt_mark.c
index 8b385a34886d..876bc5797738 100644
--- a/net/netfilter/xt_mark.c
+++ b/net/netfilter/xt_mark.c
@@ -42,7 +42,7 @@ checkentry(const char *tablename,
42 unsigned int matchsize, 42 unsigned int matchsize,
43 unsigned int hook_mask) 43 unsigned int hook_mask)
44{ 44{
45 struct xt_mark_info *minfo = (struct xt_mark_info *) matchinfo; 45 const struct xt_mark_info *minfo = matchinfo;
46 46
47 if (minfo->mark > 0xffffffff || minfo->mask > 0xffffffff) { 47 if (minfo->mark > 0xffffffff || minfo->mask > 0xffffffff) {
48 printk(KERN_WARNING "mark: only supports 32bit mark\n"); 48 printk(KERN_WARNING "mark: only supports 32bit mark\n");
diff --git a/net/netfilter/xt_multiport.c b/net/netfilter/xt_multiport.c
index b56cd2baaac2..1ff0a25396e7 100644
--- a/net/netfilter/xt_multiport.c
+++ b/net/netfilter/xt_multiport.c
@@ -1,4 +1,4 @@
1/* Kernel module to match one of a list of TCP/UDP ports: ports are in 1/* Kernel module to match one of a list of TCP/UDP/SCTP/DCCP ports: ports are in
2 the same place so we can treat them as equal. */ 2 the same place so we can treat them as equal. */
3 3
4/* (C) 1999-2001 Paul `Rusty' Russell 4/* (C) 1999-2001 Paul `Rusty' Russell
@@ -160,8 +160,9 @@ check(u_int16_t proto,
160 u_int8_t match_flags, 160 u_int8_t match_flags,
161 u_int8_t count) 161 u_int8_t count)
162{ 162{
163 /* Must specify proto == TCP/UDP, no unknown flags or bad count */ 163 /* Must specify supported protocol, no unknown flags or bad count */
164 return (proto == IPPROTO_TCP || proto == IPPROTO_UDP) 164 return (proto == IPPROTO_TCP || proto == IPPROTO_UDP
165 || proto == IPPROTO_SCTP || proto == IPPROTO_DCCP)
165 && !(ip_invflags & XT_INV_PROTO) 166 && !(ip_invflags & XT_INV_PROTO)
166 && (match_flags == XT_MULTIPORT_SOURCE 167 && (match_flags == XT_MULTIPORT_SOURCE
167 || match_flags == XT_MULTIPORT_DESTINATION 168 || match_flags == XT_MULTIPORT_DESTINATION
diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
new file mode 100644
index 000000000000..4cdba7469dc4
--- /dev/null
+++ b/net/netfilter/xt_quota.c
@@ -0,0 +1,96 @@
1/*
2 * netfilter module to enforce network quotas
3 *
4 * Sam Johnston <samj@samj.net>
5 */
6#include <linux/skbuff.h>
7#include <linux/spinlock.h>
8
9#include <linux/netfilter/x_tables.h>
10#include <linux/netfilter/xt_quota.h>
11
12MODULE_LICENSE("GPL");
13MODULE_AUTHOR("Sam Johnston <samj@samj.net>");
14
15static DEFINE_SPINLOCK(quota_lock);
16
17static int
18match(const struct sk_buff *skb,
19 const struct net_device *in, const struct net_device *out,
20 const struct xt_match *match, const void *matchinfo,
21 int offset, unsigned int protoff, int *hotdrop)
22{
23 struct xt_quota_info *q = ((struct xt_quota_info *)matchinfo)->master;
24 int ret = q->flags & XT_QUOTA_INVERT ? 1 : 0;
25
26 spin_lock_bh(&quota_lock);
27 if (q->quota >= skb->len) {
28 q->quota -= skb->len;
29 ret ^= 1;
30 } else {
31 /* we do not allow even small packets from now on */
32 q->quota = 0;
33 }
34 spin_unlock_bh(&quota_lock);
35
36 return ret;
37}
38
39static int
40checkentry(const char *tablename, const void *entry,
41 const struct xt_match *match, void *matchinfo,
42 unsigned int matchsize, unsigned int hook_mask)
43{
44 struct xt_quota_info *q = (struct xt_quota_info *)matchinfo;
45
46 if (q->flags & ~XT_QUOTA_MASK)
47 return 0;
48 /* For SMP, we only want to use one set of counters. */
49 q->master = q;
50 return 1;
51}
52
53static struct xt_match quota_match = {
54 .name = "quota",
55 .family = AF_INET,
56 .match = match,
57 .matchsize = sizeof(struct xt_quota_info),
58 .checkentry = checkentry,
59 .me = THIS_MODULE
60};
61
62static struct xt_match quota_match6 = {
63 .name = "quota",
64 .family = AF_INET6,
65 .match = match,
66 .matchsize = sizeof(struct xt_quota_info),
67 .checkentry = checkentry,
68 .me = THIS_MODULE
69};
70
71static int __init xt_quota_init(void)
72{
73 int ret;
74
75 ret = xt_register_match(&quota_match);
76 if (ret)
77 goto err1;
78 ret = xt_register_match(&quota_match6);
79 if (ret)
80 goto err2;
81 return ret;
82
83err2:
84 xt_unregister_match(&quota_match);
85err1:
86 return ret;
87}
88
89static void __exit xt_quota_fini(void)
90{
91 xt_unregister_match(&quota_match6);
92 xt_unregister_match(&quota_match);
93}
94
95module_init(xt_quota_init);
96module_exit(xt_quota_fini);
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c
index 34bd87259a09..b5110e5b54b0 100644
--- a/net/netfilter/xt_sctp.c
+++ b/net/netfilter/xt_sctp.c
@@ -129,11 +129,9 @@ match(const struct sk_buff *skb,
129 unsigned int protoff, 129 unsigned int protoff,
130 int *hotdrop) 130 int *hotdrop)
131{ 131{
132 const struct xt_sctp_info *info; 132 const struct xt_sctp_info *info = matchinfo;
133 sctp_sctphdr_t _sh, *sh; 133 sctp_sctphdr_t _sh, *sh;
134 134
135 info = (const struct xt_sctp_info *)matchinfo;
136
137 if (offset) { 135 if (offset) {
138 duprintf("Dropping non-first fragment.. FIXME\n"); 136 duprintf("Dropping non-first fragment.. FIXME\n");
139 return 0; 137 return 0;
diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c
new file mode 100644
index 000000000000..de1037f58596
--- /dev/null
+++ b/net/netfilter/xt_statistic.c
@@ -0,0 +1,112 @@
1/*
2 * Copyright (c) 2006 Patrick McHardy <kaber@trash.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Based on ipt_random and ipt_nth by Fabrice MARIE <fabrice@netfilter.org>.
9 */
10
11#include <linux/init.h>
12#include <linux/spinlock.h>
13#include <linux/skbuff.h>
14#include <linux/net.h>
15
16#include <linux/netfilter/xt_statistic.h>
17#include <linux/netfilter/x_tables.h>
18
19MODULE_LICENSE("GPL");
20MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
21MODULE_DESCRIPTION("xtables statistical match module");
22MODULE_ALIAS("ipt_statistic");
23MODULE_ALIAS("ip6t_statistic");
24
25static DEFINE_SPINLOCK(nth_lock);
26
27static int
28match(const struct sk_buff *skb,
29 const struct net_device *in, const struct net_device *out,
30 const struct xt_match *match, const void *matchinfo,
31 int offset, unsigned int protoff, int *hotdrop)
32{
33 struct xt_statistic_info *info = (struct xt_statistic_info *)matchinfo;
34 int ret = info->flags & XT_STATISTIC_INVERT ? 1 : 0;
35
36 switch (info->mode) {
37 case XT_STATISTIC_MODE_RANDOM:
38 if ((net_random() & 0x7FFFFFFF) < info->u.random.probability)
39 ret ^= 1;
40 break;
41 case XT_STATISTIC_MODE_NTH:
42 info = info->master;
43 spin_lock_bh(&nth_lock);
44 if (info->u.nth.count++ == info->u.nth.every) {
45 info->u.nth.count = 0;
46 ret ^= 1;
47 }
48 spin_unlock_bh(&nth_lock);
49 break;
50 }
51
52 return ret;
53}
54
55static int
56checkentry(const char *tablename, const void *entry,
57 const struct xt_match *match, void *matchinfo,
58 unsigned int matchsize, unsigned int hook_mask)
59{
60 struct xt_statistic_info *info = (struct xt_statistic_info *)matchinfo;
61
62 if (info->mode > XT_STATISTIC_MODE_MAX ||
63 info->flags & ~XT_STATISTIC_MASK)
64 return 0;
65 info->master = info;
66 return 1;
67}
68
69static struct xt_match statistic_match = {
70 .name = "statistic",
71 .match = match,
72 .matchsize = sizeof(struct xt_statistic_info),
73 .checkentry = checkentry,
74 .family = AF_INET,
75 .me = THIS_MODULE,
76};
77
78static struct xt_match statistic_match6 = {
79 .name = "statistic",
80 .match = match,
81 .matchsize = sizeof(struct xt_statistic_info),
82 .checkentry = checkentry,
83 .family = AF_INET6,
84 .me = THIS_MODULE,
85};
86
87static int __init xt_statistic_init(void)
88{
89 int ret;
90
91 ret = xt_register_match(&statistic_match);
92 if (ret)
93 goto err1;
94
95 ret = xt_register_match(&statistic_match6);
96 if (ret)
97 goto err2;
98 return ret;
99err2:
100 xt_unregister_match(&statistic_match);
101err1:
102 return ret;
103}
104
105static void __exit xt_statistic_fini(void)
106{
107 xt_unregister_match(&statistic_match6);
108 xt_unregister_match(&statistic_match);
109}
110
111module_init(xt_statistic_init);
112module_exit(xt_statistic_fini);
diff --git a/net/netfilter/xt_string.c b/net/netfilter/xt_string.c
index 79d9ea6964ba..0ebb6ac2c8c7 100644
--- a/net/netfilter/xt_string.c
+++ b/net/netfilter/xt_string.c
@@ -30,8 +30,8 @@ static int match(const struct sk_buff *skb,
30 unsigned int protoff, 30 unsigned int protoff,
31 int *hotdrop) 31 int *hotdrop)
32{ 32{
33 const struct xt_string_info *conf = matchinfo;
33 struct ts_state state; 34 struct ts_state state;
34 struct xt_string_info *conf = (struct xt_string_info *) matchinfo;
35 35
36 memset(&state, 0, sizeof(struct ts_state)); 36 memset(&state, 0, sizeof(struct ts_state));
37 37
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 138ea92ed268..b1e4c5e20ac7 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -72,9 +72,9 @@ void qdisc_unlock_tree(struct net_device *dev)
72 dev->queue_lock serializes queue accesses for this device 72 dev->queue_lock serializes queue accesses for this device
73 AND dev->qdisc pointer itself. 73 AND dev->qdisc pointer itself.
74 74
75 dev->xmit_lock serializes accesses to device driver. 75 netif_tx_lock serializes accesses to device driver.
76 76
77 dev->queue_lock and dev->xmit_lock are mutually exclusive, 77 dev->queue_lock and netif_tx_lock are mutually exclusive,
78 if one is grabbed, another must be free. 78 if one is grabbed, another must be free.
79 */ 79 */
80 80
@@ -108,7 +108,7 @@ int qdisc_restart(struct net_device *dev)
108 * will be requeued. 108 * will be requeued.
109 */ 109 */
110 if (!nolock) { 110 if (!nolock) {
111 if (!spin_trylock(&dev->xmit_lock)) { 111 if (!netif_tx_trylock(dev)) {
112 collision: 112 collision:
113 /* So, someone grabbed the driver. */ 113 /* So, someone grabbed the driver. */
114 114
@@ -126,8 +126,6 @@ int qdisc_restart(struct net_device *dev)
126 __get_cpu_var(netdev_rx_stat).cpu_collision++; 126 __get_cpu_var(netdev_rx_stat).cpu_collision++;
127 goto requeue; 127 goto requeue;
128 } 128 }
129 /* Remember that the driver is grabbed by us. */
130 dev->xmit_lock_owner = smp_processor_id();
131 } 129 }
132 130
133 { 131 {
@@ -142,8 +140,7 @@ int qdisc_restart(struct net_device *dev)
142 ret = dev->hard_start_xmit(skb, dev); 140 ret = dev->hard_start_xmit(skb, dev);
143 if (ret == NETDEV_TX_OK) { 141 if (ret == NETDEV_TX_OK) {
144 if (!nolock) { 142 if (!nolock) {
145 dev->xmit_lock_owner = -1; 143 netif_tx_unlock(dev);
146 spin_unlock(&dev->xmit_lock);
147 } 144 }
148 spin_lock(&dev->queue_lock); 145 spin_lock(&dev->queue_lock);
149 return -1; 146 return -1;
@@ -157,8 +154,7 @@ int qdisc_restart(struct net_device *dev)
157 /* NETDEV_TX_BUSY - we need to requeue */ 154 /* NETDEV_TX_BUSY - we need to requeue */
158 /* Release the driver */ 155 /* Release the driver */
159 if (!nolock) { 156 if (!nolock) {
160 dev->xmit_lock_owner = -1; 157 netif_tx_unlock(dev);
161 spin_unlock(&dev->xmit_lock);
162 } 158 }
163 spin_lock(&dev->queue_lock); 159 spin_lock(&dev->queue_lock);
164 q = dev->qdisc; 160 q = dev->qdisc;
@@ -187,7 +183,7 @@ static void dev_watchdog(unsigned long arg)
187{ 183{
188 struct net_device *dev = (struct net_device *)arg; 184 struct net_device *dev = (struct net_device *)arg;
189 185
190 spin_lock(&dev->xmit_lock); 186 netif_tx_lock(dev);
191 if (dev->qdisc != &noop_qdisc) { 187 if (dev->qdisc != &noop_qdisc) {
192 if (netif_device_present(dev) && 188 if (netif_device_present(dev) &&
193 netif_running(dev) && 189 netif_running(dev) &&
@@ -203,7 +199,7 @@ static void dev_watchdog(unsigned long arg)
203 dev_hold(dev); 199 dev_hold(dev);
204 } 200 }
205 } 201 }
206 spin_unlock(&dev->xmit_lock); 202 netif_tx_unlock(dev);
207 203
208 dev_put(dev); 204 dev_put(dev);
209} 205}
@@ -227,17 +223,17 @@ void __netdev_watchdog_up(struct net_device *dev)
227 223
228static void dev_watchdog_up(struct net_device *dev) 224static void dev_watchdog_up(struct net_device *dev)
229{ 225{
230 spin_lock_bh(&dev->xmit_lock); 226 netif_tx_lock_bh(dev);
231 __netdev_watchdog_up(dev); 227 __netdev_watchdog_up(dev);
232 spin_unlock_bh(&dev->xmit_lock); 228 netif_tx_unlock_bh(dev);
233} 229}
234 230
235static void dev_watchdog_down(struct net_device *dev) 231static void dev_watchdog_down(struct net_device *dev)
236{ 232{
237 spin_lock_bh(&dev->xmit_lock); 233 netif_tx_lock_bh(dev);
238 if (del_timer(&dev->watchdog_timer)) 234 if (del_timer(&dev->watchdog_timer))
239 dev_put(dev); 235 dev_put(dev);
240 spin_unlock_bh(&dev->xmit_lock); 236 netif_tx_unlock_bh(dev);
241} 237}
242 238
243void netif_carrier_on(struct net_device *dev) 239void netif_carrier_on(struct net_device *dev)
@@ -582,7 +578,7 @@ void dev_deactivate(struct net_device *dev)
582 while (test_bit(__LINK_STATE_SCHED, &dev->state)) 578 while (test_bit(__LINK_STATE_SCHED, &dev->state))
583 yield(); 579 yield();
584 580
585 spin_unlock_wait(&dev->xmit_lock); 581 spin_unlock_wait(&dev->_xmit_lock);
586} 582}
587 583
588void dev_init_scheduler(struct net_device *dev) 584void dev_init_scheduler(struct net_device *dev)
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 79b8ef34c6e4..4c16ad57a3e4 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -302,20 +302,17 @@ restart:
302 302
303 switch (teql_resolve(skb, skb_res, slave)) { 303 switch (teql_resolve(skb, skb_res, slave)) {
304 case 0: 304 case 0:
305 if (spin_trylock(&slave->xmit_lock)) { 305 if (netif_tx_trylock(slave)) {
306 slave->xmit_lock_owner = smp_processor_id();
307 if (!netif_queue_stopped(slave) && 306 if (!netif_queue_stopped(slave) &&
308 slave->hard_start_xmit(skb, slave) == 0) { 307 slave->hard_start_xmit(skb, slave) == 0) {
309 slave->xmit_lock_owner = -1; 308 netif_tx_unlock(slave);
310 spin_unlock(&slave->xmit_lock);
311 master->slaves = NEXT_SLAVE(q); 309 master->slaves = NEXT_SLAVE(q);
312 netif_wake_queue(dev); 310 netif_wake_queue(dev);
313 master->stats.tx_packets++; 311 master->stats.tx_packets++;
314 master->stats.tx_bytes += len; 312 master->stats.tx_bytes += len;
315 return 0; 313 return 0;
316 } 314 }
317 slave->xmit_lock_owner = -1; 315 netif_tx_unlock(slave);
318 spin_unlock(&slave->xmit_lock);
319 } 316 }
320 if (netif_queue_stopped(dev)) 317 if (netif_queue_stopped(dev))
321 busy = 1; 318 busy = 1;
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 1662f9cc869e..42b66e74bbb5 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -141,7 +141,8 @@ int sctp_rcv(struct sk_buff *skb)
141 __skb_pull(skb, skb->h.raw - skb->data); 141 __skb_pull(skb, skb->h.raw - skb->data);
142 if (skb->len < sizeof(struct sctphdr)) 142 if (skb->len < sizeof(struct sctphdr))
143 goto discard_it; 143 goto discard_it;
144 if (sctp_rcv_checksum(skb) < 0) 144 if ((skb->ip_summed != CHECKSUM_UNNECESSARY) &&
145 (sctp_rcv_checksum(skb) < 0))
145 goto discard_it; 146 goto discard_it;
146 147
147 skb_pull(skb, sizeof(struct sctphdr)); 148 skb_pull(skb, sizeof(struct sctphdr));
@@ -170,7 +171,8 @@ int sctp_rcv(struct sk_buff *skb)
170 * IP broadcast addresses cannot be used in an SCTP transport 171 * IP broadcast addresses cannot be used in an SCTP transport
171 * address." 172 * address."
172 */ 173 */
173 if (!af->addr_valid(&src, NULL) || !af->addr_valid(&dest, NULL)) 174 if (!af->addr_valid(&src, NULL, skb) ||
175 !af->addr_valid(&dest, NULL, skb))
174 goto discard_it; 176 goto discard_it;
175 177
176 asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport); 178 asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport);
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index c20d282fac06..8ef08070c8b6 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -523,7 +523,9 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp)
523 * Return 0 - If the address is a non-unicast or an illegal address. 523 * Return 0 - If the address is a non-unicast or an illegal address.
524 * Return 1 - If the address is a unicast. 524 * Return 1 - If the address is a unicast.
525 */ 525 */
526static int sctp_v6_addr_valid(union sctp_addr *addr, struct sctp_sock *sp) 526static int sctp_v6_addr_valid(union sctp_addr *addr,
527 struct sctp_sock *sp,
528 const struct sk_buff *skb)
527{ 529{
528 int ret = ipv6_addr_type(&addr->v6.sin6_addr); 530 int ret = ipv6_addr_type(&addr->v6.sin6_addr);
529 531
@@ -537,7 +539,7 @@ static int sctp_v6_addr_valid(union sctp_addr *addr, struct sctp_sock *sp)
537 if (sp && ipv6_only_sock(sctp_opt2sk(sp))) 539 if (sp && ipv6_only_sock(sctp_opt2sk(sp)))
538 return 0; 540 return 0;
539 sctp_v6_map_v4(addr); 541 sctp_v6_map_v4(addr);
540 return sctp_get_af_specific(AF_INET)->addr_valid(addr, sp); 542 return sctp_get_af_specific(AF_INET)->addr_valid(addr, sp, skb);
541 } 543 }
542 544
543 /* Is this a non-unicast address */ 545 /* Is this a non-unicast address */
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 437cba7260a4..cdc5a3936766 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -295,14 +295,14 @@ int sctp_packet_transmit(struct sctp_packet *packet)
295 struct sctp_transport *tp = packet->transport; 295 struct sctp_transport *tp = packet->transport;
296 struct sctp_association *asoc = tp->asoc; 296 struct sctp_association *asoc = tp->asoc;
297 struct sctphdr *sh; 297 struct sctphdr *sh;
298 __u32 crc32; 298 __u32 crc32 = 0;
299 struct sk_buff *nskb; 299 struct sk_buff *nskb;
300 struct sctp_chunk *chunk, *tmp; 300 struct sctp_chunk *chunk, *tmp;
301 struct sock *sk; 301 struct sock *sk;
302 int err = 0; 302 int err = 0;
303 int padding; /* How much padding do we need? */ 303 int padding; /* How much padding do we need? */
304 __u8 has_data = 0; 304 __u8 has_data = 0;
305 struct dst_entry *dst; 305 struct dst_entry *dst = tp->dst;
306 306
307 SCTP_DEBUG_PRINTK("%s: packet:%p\n", __FUNCTION__, packet); 307 SCTP_DEBUG_PRINTK("%s: packet:%p\n", __FUNCTION__, packet);
308 308
@@ -327,6 +327,19 @@ int sctp_packet_transmit(struct sctp_packet *packet)
327 */ 327 */
328 skb_set_owner_w(nskb, sk); 328 skb_set_owner_w(nskb, sk);
329 329
330 /* The 'obsolete' field of dst is set to 2 when a dst is freed. */
331 if (!dst || (dst->obsolete > 1)) {
332 dst_release(dst);
333 sctp_transport_route(tp, NULL, sctp_sk(sk));
334 if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) {
335 sctp_assoc_sync_pmtu(asoc);
336 }
337 }
338 nskb->dst = dst_clone(tp->dst);
339 if (!nskb->dst)
340 goto no_route;
341 dst = nskb->dst;
342
330 /* Build the SCTP header. */ 343 /* Build the SCTP header. */
331 sh = (struct sctphdr *)skb_push(nskb, sizeof(struct sctphdr)); 344 sh = (struct sctphdr *)skb_push(nskb, sizeof(struct sctphdr));
332 sh->source = htons(packet->source_port); 345 sh->source = htons(packet->source_port);
@@ -350,7 +363,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)
350 * Note: Adler-32 is no longer applicable, as has been replaced 363 * Note: Adler-32 is no longer applicable, as has been replaced
351 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. 364 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>.
352 */ 365 */
353 crc32 = sctp_start_cksum((__u8 *)sh, sizeof(struct sctphdr)); 366 if (!(dst->dev->features & NETIF_F_NO_CSUM))
367 crc32 = sctp_start_cksum((__u8 *)sh, sizeof(struct sctphdr));
354 368
355 /** 369 /**
356 * 6.10 Bundling 370 * 6.10 Bundling
@@ -402,9 +416,14 @@ int sctp_packet_transmit(struct sctp_packet *packet)
402 if (padding) 416 if (padding)
403 memset(skb_put(chunk->skb, padding), 0, padding); 417 memset(skb_put(chunk->skb, padding), 0, padding);
404 418
405 crc32 = sctp_update_copy_cksum(skb_put(nskb, chunk->skb->len), 419 if (dst->dev->features & NETIF_F_NO_CSUM)
406 chunk->skb->data, 420 memcpy(skb_put(nskb, chunk->skb->len),
407 chunk->skb->len, crc32); 421 chunk->skb->data, chunk->skb->len);
422 else
423 crc32 = sctp_update_copy_cksum(skb_put(nskb,
424 chunk->skb->len),
425 chunk->skb->data,
426 chunk->skb->len, crc32);
408 427
409 SCTP_DEBUG_PRINTK("%s %p[%s] %s 0x%x, %s %d, %s %d, %s %d\n", 428 SCTP_DEBUG_PRINTK("%s %p[%s] %s 0x%x, %s %d, %s %d, %s %d\n",
410 "*** Chunk", chunk, 429 "*** Chunk", chunk,
@@ -427,7 +446,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)
427 } 446 }
428 447
429 /* Perform final transformation on checksum. */ 448 /* Perform final transformation on checksum. */
430 crc32 = sctp_end_cksum(crc32); 449 if (!(dst->dev->features & NETIF_F_NO_CSUM))
450 crc32 = sctp_end_cksum(crc32);
431 451
432 /* 3) Put the resultant value into the checksum field in the 452 /* 3) Put the resultant value into the checksum field in the
433 * common header, and leave the rest of the bits unchanged. 453 * common header, and leave the rest of the bits unchanged.
@@ -477,20 +497,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
477 } 497 }
478 } 498 }
479 499
480 dst = tp->dst;
481 /* The 'obsolete' field of dst is set to 2 when a dst is freed. */
482 if (!dst || (dst->obsolete > 1)) {
483 dst_release(dst);
484 sctp_transport_route(tp, NULL, sctp_sk(sk));
485 if (asoc->param_flags & SPP_PMTUD_ENABLE) {
486 sctp_assoc_sync_pmtu(asoc);
487 }
488 }
489
490 nskb->dst = dst_clone(tp->dst);
491 if (!nskb->dst)
492 goto no_route;
493
494 SCTP_DEBUG_PRINTK("***sctp_transmit_packet*** skb len %d\n", 500 SCTP_DEBUG_PRINTK("***sctp_transmit_packet*** skb len %d\n",
495 nskb->len); 501 nskb->len);
496 502
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index f148f9576dd2..e5faa351aaad 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -1262,6 +1262,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1262 if (!tchunk->tsn_gap_acked && 1262 if (!tchunk->tsn_gap_acked &&
1263 !tchunk->resent && 1263 !tchunk->resent &&
1264 tchunk->rtt_in_progress) { 1264 tchunk->rtt_in_progress) {
1265 tchunk->rtt_in_progress = 0;
1265 rtt = jiffies - tchunk->sent_at; 1266 rtt = jiffies - tchunk->sent_at;
1266 sctp_transport_update_rto(transport, 1267 sctp_transport_update_rto(transport,
1267 rtt); 1268 rtt);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 2088aa992b7a..816c033d7886 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -365,12 +365,18 @@ static int sctp_v4_is_any(const union sctp_addr *addr)
365 * Return 0 - If the address is a non-unicast or an illegal address. 365 * Return 0 - If the address is a non-unicast or an illegal address.
366 * Return 1 - If the address is a unicast. 366 * Return 1 - If the address is a unicast.
367 */ 367 */
368static int sctp_v4_addr_valid(union sctp_addr *addr, struct sctp_sock *sp) 368static int sctp_v4_addr_valid(union sctp_addr *addr,
369 struct sctp_sock *sp,
370 const struct sk_buff *skb)
369{ 371{
370 /* Is this a non-unicast address or a unusable SCTP address? */ 372 /* Is this a non-unicast address or a unusable SCTP address? */
371 if (IS_IPV4_UNUSABLE_ADDRESS(&addr->v4.sin_addr.s_addr)) 373 if (IS_IPV4_UNUSABLE_ADDRESS(&addr->v4.sin_addr.s_addr))
372 return 0; 374 return 0;
373 375
376 /* Is this a broadcast address? */
377 if (skb && ((struct rtable *)skb->dst)->rt_flags & RTCF_BROADCAST)
378 return 0;
379
374 return 1; 380 return 1;
375} 381}
376 382
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 8bc279219a72..9e58144f4851 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -5293,10 +5293,18 @@ static int sctp_eat_data(const struct sctp_association *asoc,
5293 * seems a bit troublesome in that frag_point varies based on 5293 * seems a bit troublesome in that frag_point varies based on
5294 * PMTU. In cases, such as loopback, this might be a rather 5294 * PMTU. In cases, such as loopback, this might be a rather
5295 * large spill over. 5295 * large spill over.
5296 * NOTE: If we have a full receive buffer here, we only renege if
5297 * our receiver can still make progress without the tsn being
5298 * received. We do this because in the event that the associations
5299 * receive queue is empty we are filling a leading gap, and since
5300 * reneging moves the gap to the end of the tsn stream, we are likely
5301 * to stall again very shortly. Avoiding the renege when we fill a
5302 * leading gap is a good heuristic for avoiding such steady state
5303 * stalls.
5296 */ 5304 */
5297 if (!asoc->rwnd || asoc->rwnd_over || 5305 if (!asoc->rwnd || asoc->rwnd_over ||
5298 (datalen > asoc->rwnd + asoc->frag_point) || 5306 (datalen > asoc->rwnd + asoc->frag_point) ||
5299 rcvbuf_over) { 5307 (rcvbuf_over && (!skb_queue_len(&sk->sk_receive_queue)))) {
5300 5308
5301 /* If this is the next TSN, consider reneging to make 5309 /* If this is the next TSN, consider reneging to make
5302 * room. Note: Playing nice with a confused sender. A 5310 * room. Note: Playing nice with a confused sender. A
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 174d4d35e951..b811691c35bf 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -172,7 +172,7 @@ static inline int sctp_verify_addr(struct sock *sk, union sctp_addr *addr,
172 return -EINVAL; 172 return -EINVAL;
173 173
174 /* Is this a valid SCTP address? */ 174 /* Is this a valid SCTP address? */
175 if (!af->addr_valid(addr, sctp_sk(sk))) 175 if (!af->addr_valid(addr, sctp_sk(sk), NULL))
176 return -EINVAL; 176 return -EINVAL;
177 177
178 if (!sctp_sk(sk)->pf->send_verify(sctp_sk(sk), (addr))) 178 if (!sctp_sk(sk)->pf->send_verify(sctp_sk(sk), (addr)))
@@ -2530,8 +2530,32 @@ static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, int o
2530 2530
2531 /* Set the values to the specific association */ 2531 /* Set the values to the specific association */
2532 if (asoc) { 2532 if (asoc) {
2533 if (assocparams.sasoc_asocmaxrxt != 0) 2533 if (assocparams.sasoc_asocmaxrxt != 0) {
2534 __u32 path_sum = 0;
2535 int paths = 0;
2536 struct list_head *pos;
2537 struct sctp_transport *peer_addr;
2538
2539 list_for_each(pos, &asoc->peer.transport_addr_list) {
2540 peer_addr = list_entry(pos,
2541 struct sctp_transport,
2542 transports);
2543 path_sum += peer_addr->pathmaxrxt;
2544 paths++;
2545 }
2546
2547 /* Only validate asocmaxrxt if we have more then
2548 * one path/transport. We do this because path
2549 * retransmissions are only counted when we have more
2550 * then one path.
2551 */
2552 if (paths > 1 &&
2553 assocparams.sasoc_asocmaxrxt > path_sum)
2554 return -EINVAL;
2555
2534 asoc->max_retrans = assocparams.sasoc_asocmaxrxt; 2556 asoc->max_retrans = assocparams.sasoc_asocmaxrxt;
2557 }
2558
2535 if (assocparams.sasoc_cookie_life != 0) { 2559 if (assocparams.sasoc_cookie_life != 0) {
2536 asoc->cookie_life.tv_sec = 2560 asoc->cookie_life.tv_sec =
2537 assocparams.sasoc_cookie_life / 1000; 2561 assocparams.sasoc_cookie_life / 1000;
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index ba97f974f57c..ee236784a6bb 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -51,6 +51,8 @@
51static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event, 51static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event,
52 struct sctp_association *asoc); 52 struct sctp_association *asoc);
53static void sctp_ulpevent_release_data(struct sctp_ulpevent *event); 53static void sctp_ulpevent_release_data(struct sctp_ulpevent *event);
54static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event);
55
54 56
55/* Initialize an ULP event from an given skb. */ 57/* Initialize an ULP event from an given skb. */
56SCTP_STATIC void sctp_ulpevent_init(struct sctp_ulpevent *event, int msg_flags) 58SCTP_STATIC void sctp_ulpevent_init(struct sctp_ulpevent *event, int msg_flags)
@@ -883,6 +885,7 @@ static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event,
883static void sctp_ulpevent_release_data(struct sctp_ulpevent *event) 885static void sctp_ulpevent_release_data(struct sctp_ulpevent *event)
884{ 886{
885 struct sk_buff *skb, *frag; 887 struct sk_buff *skb, *frag;
888 unsigned int len;
886 889
887 /* Current stack structures assume that the rcv buffer is 890 /* Current stack structures assume that the rcv buffer is
888 * per socket. For UDP style sockets this is not true as 891 * per socket. For UDP style sockets this is not true as
@@ -892,7 +895,30 @@ static void sctp_ulpevent_release_data(struct sctp_ulpevent *event)
892 */ 895 */
893 896
894 skb = sctp_event2skb(event); 897 skb = sctp_event2skb(event);
895 sctp_assoc_rwnd_increase(event->asoc, skb_headlen(skb)); 898 len = skb->len;
899
900 if (!skb->data_len)
901 goto done;
902
903 /* Don't forget the fragments. */
904 for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next) {
905 /* NOTE: skb_shinfos are recursive. Although IP returns
906 * skb's with only 1 level of fragments, SCTP reassembly can
907 * increase the levels.
908 */
909 sctp_ulpevent_release_frag_data(sctp_skb2event(frag));
910 }
911
912done:
913 sctp_assoc_rwnd_increase(event->asoc, len);
914 sctp_ulpevent_release_owner(event);
915}
916
917static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event)
918{
919 struct sk_buff *skb, *frag;
920
921 skb = sctp_event2skb(event);
896 922
897 if (!skb->data_len) 923 if (!skb->data_len)
898 goto done; 924 goto done;
@@ -903,7 +929,7 @@ static void sctp_ulpevent_release_data(struct sctp_ulpevent *event)
903 * skb's with only 1 level of fragments, SCTP reassembly can 929 * skb's with only 1 level of fragments, SCTP reassembly can
904 * increase the levels. 930 * increase the levels.
905 */ 931 */
906 sctp_ulpevent_release_data(sctp_skb2event(frag)); 932 sctp_ulpevent_release_frag_data(sctp_skb2event(frag));
907 } 933 }
908 934
909done: 935done:
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b469c8b54613..b8936926c24b 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -46,45 +46,43 @@ static DEFINE_SPINLOCK(xfrm_policy_gc_lock);
46 46
47static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family); 47static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family);
48static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo); 48static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo);
49static struct xfrm_policy_afinfo *xfrm_policy_lock_afinfo(unsigned int family);
50static void xfrm_policy_unlock_afinfo(struct xfrm_policy_afinfo *afinfo);
49 51
50int xfrm_register_type(struct xfrm_type *type, unsigned short family) 52int xfrm_register_type(struct xfrm_type *type, unsigned short family)
51{ 53{
52 struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family); 54 struct xfrm_policy_afinfo *afinfo = xfrm_policy_lock_afinfo(family);
53 struct xfrm_type_map *typemap; 55 struct xfrm_type **typemap;
54 int err = 0; 56 int err = 0;
55 57
56 if (unlikely(afinfo == NULL)) 58 if (unlikely(afinfo == NULL))
57 return -EAFNOSUPPORT; 59 return -EAFNOSUPPORT;
58 typemap = afinfo->type_map; 60 typemap = afinfo->type_map;
59 61
60 write_lock_bh(&typemap->lock); 62 if (likely(typemap[type->proto] == NULL))
61 if (likely(typemap->map[type->proto] == NULL)) 63 typemap[type->proto] = type;
62 typemap->map[type->proto] = type;
63 else 64 else
64 err = -EEXIST; 65 err = -EEXIST;
65 write_unlock_bh(&typemap->lock); 66 xfrm_policy_unlock_afinfo(afinfo);
66 xfrm_policy_put_afinfo(afinfo);
67 return err; 67 return err;
68} 68}
69EXPORT_SYMBOL(xfrm_register_type); 69EXPORT_SYMBOL(xfrm_register_type);
70 70
71int xfrm_unregister_type(struct xfrm_type *type, unsigned short family) 71int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
72{ 72{
73 struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family); 73 struct xfrm_policy_afinfo *afinfo = xfrm_policy_lock_afinfo(family);
74 struct xfrm_type_map *typemap; 74 struct xfrm_type **typemap;
75 int err = 0; 75 int err = 0;
76 76
77 if (unlikely(afinfo == NULL)) 77 if (unlikely(afinfo == NULL))
78 return -EAFNOSUPPORT; 78 return -EAFNOSUPPORT;
79 typemap = afinfo->type_map; 79 typemap = afinfo->type_map;
80 80
81 write_lock_bh(&typemap->lock); 81 if (unlikely(typemap[type->proto] != type))
82 if (unlikely(typemap->map[type->proto] != type))
83 err = -ENOENT; 82 err = -ENOENT;
84 else 83 else
85 typemap->map[type->proto] = NULL; 84 typemap[type->proto] = NULL;
86 write_unlock_bh(&typemap->lock); 85 xfrm_policy_unlock_afinfo(afinfo);
87 xfrm_policy_put_afinfo(afinfo);
88 return err; 86 return err;
89} 87}
90EXPORT_SYMBOL(xfrm_unregister_type); 88EXPORT_SYMBOL(xfrm_unregister_type);
@@ -92,7 +90,7 @@ EXPORT_SYMBOL(xfrm_unregister_type);
92struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family) 90struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family)
93{ 91{
94 struct xfrm_policy_afinfo *afinfo; 92 struct xfrm_policy_afinfo *afinfo;
95 struct xfrm_type_map *typemap; 93 struct xfrm_type **typemap;
96 struct xfrm_type *type; 94 struct xfrm_type *type;
97 int modload_attempted = 0; 95 int modload_attempted = 0;
98 96
@@ -102,11 +100,9 @@ retry:
102 return NULL; 100 return NULL;
103 typemap = afinfo->type_map; 101 typemap = afinfo->type_map;
104 102
105 read_lock(&typemap->lock); 103 type = typemap[proto];
106 type = typemap->map[proto];
107 if (unlikely(type && !try_module_get(type->owner))) 104 if (unlikely(type && !try_module_get(type->owner)))
108 type = NULL; 105 type = NULL;
109 read_unlock(&typemap->lock);
110 if (!type && !modload_attempted) { 106 if (!type && !modload_attempted) {
111 xfrm_policy_put_afinfo(afinfo); 107 xfrm_policy_put_afinfo(afinfo);
112 request_module("xfrm-type-%d-%d", 108 request_module("xfrm-type-%d-%d",
@@ -142,6 +138,89 @@ void xfrm_put_type(struct xfrm_type *type)
142 module_put(type->owner); 138 module_put(type->owner);
143} 139}
144 140
141int xfrm_register_mode(struct xfrm_mode *mode, int family)
142{
143 struct xfrm_policy_afinfo *afinfo;
144 struct xfrm_mode **modemap;
145 int err;
146
147 if (unlikely(mode->encap >= XFRM_MODE_MAX))
148 return -EINVAL;
149
150 afinfo = xfrm_policy_lock_afinfo(family);
151 if (unlikely(afinfo == NULL))
152 return -EAFNOSUPPORT;
153
154 err = -EEXIST;
155 modemap = afinfo->mode_map;
156 if (likely(modemap[mode->encap] == NULL)) {
157 modemap[mode->encap] = mode;
158 err = 0;
159 }
160
161 xfrm_policy_unlock_afinfo(afinfo);
162 return err;
163}
164EXPORT_SYMBOL(xfrm_register_mode);
165
166int xfrm_unregister_mode(struct xfrm_mode *mode, int family)
167{
168 struct xfrm_policy_afinfo *afinfo;
169 struct xfrm_mode **modemap;
170 int err;
171
172 if (unlikely(mode->encap >= XFRM_MODE_MAX))
173 return -EINVAL;
174
175 afinfo = xfrm_policy_lock_afinfo(family);
176 if (unlikely(afinfo == NULL))
177 return -EAFNOSUPPORT;
178
179 err = -ENOENT;
180 modemap = afinfo->mode_map;
181 if (likely(modemap[mode->encap] == mode)) {
182 modemap[mode->encap] = NULL;
183 err = 0;
184 }
185
186 xfrm_policy_unlock_afinfo(afinfo);
187 return err;
188}
189EXPORT_SYMBOL(xfrm_unregister_mode);
190
191struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family)
192{
193 struct xfrm_policy_afinfo *afinfo;
194 struct xfrm_mode *mode;
195 int modload_attempted = 0;
196
197 if (unlikely(encap >= XFRM_MODE_MAX))
198 return NULL;
199
200retry:
201 afinfo = xfrm_policy_get_afinfo(family);
202 if (unlikely(afinfo == NULL))
203 return NULL;
204
205 mode = afinfo->mode_map[encap];
206 if (unlikely(mode && !try_module_get(mode->owner)))
207 mode = NULL;
208 if (!mode && !modload_attempted) {
209 xfrm_policy_put_afinfo(afinfo);
210 request_module("xfrm-mode-%d-%d", family, encap);
211 modload_attempted = 1;
212 goto retry;
213 }
214
215 xfrm_policy_put_afinfo(afinfo);
216 return mode;
217}
218
219void xfrm_put_mode(struct xfrm_mode *mode)
220{
221 module_put(mode->owner);
222}
223
145static inline unsigned long make_jiffies(long secs) 224static inline unsigned long make_jiffies(long secs)
146{ 225{
147 if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ) 226 if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ)
@@ -1306,17 +1385,31 @@ static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family)
1306 return NULL; 1385 return NULL;
1307 read_lock(&xfrm_policy_afinfo_lock); 1386 read_lock(&xfrm_policy_afinfo_lock);
1308 afinfo = xfrm_policy_afinfo[family]; 1387 afinfo = xfrm_policy_afinfo[family];
1309 if (likely(afinfo != NULL)) 1388 if (unlikely(!afinfo))
1310 read_lock(&afinfo->lock); 1389 read_unlock(&xfrm_policy_afinfo_lock);
1311 read_unlock(&xfrm_policy_afinfo_lock);
1312 return afinfo; 1390 return afinfo;
1313} 1391}
1314 1392
1315static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo) 1393static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo)
1316{ 1394{
1317 if (unlikely(afinfo == NULL)) 1395 read_unlock(&xfrm_policy_afinfo_lock);
1318 return; 1396}
1319 read_unlock(&afinfo->lock); 1397
1398static struct xfrm_policy_afinfo *xfrm_policy_lock_afinfo(unsigned int family)
1399{
1400 struct xfrm_policy_afinfo *afinfo;
1401 if (unlikely(family >= NPROTO))
1402 return NULL;
1403 write_lock_bh(&xfrm_policy_afinfo_lock);
1404 afinfo = xfrm_policy_afinfo[family];
1405 if (unlikely(!afinfo))
1406 write_unlock_bh(&xfrm_policy_afinfo_lock);
1407 return afinfo;
1408}
1409
1410static void xfrm_policy_unlock_afinfo(struct xfrm_policy_afinfo *afinfo)
1411{
1412 write_unlock_bh(&xfrm_policy_afinfo_lock);
1320} 1413}
1321 1414
1322static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr) 1415static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr)
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 93a2f36ad3db..17b29ec3c417 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -77,6 +77,8 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x)
77 kfree(x->ealg); 77 kfree(x->ealg);
78 kfree(x->calg); 78 kfree(x->calg);
79 kfree(x->encap); 79 kfree(x->encap);
80 if (x->mode)
81 xfrm_put_mode(x->mode);
80 if (x->type) { 82 if (x->type) {
81 x->type->destructor(x); 83 x->type->destructor(x);
82 xfrm_put_type(x->type); 84 xfrm_put_type(x->type);
@@ -1103,17 +1105,14 @@ static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned short family)
1103 return NULL; 1105 return NULL;
1104 read_lock(&xfrm_state_afinfo_lock); 1106 read_lock(&xfrm_state_afinfo_lock);
1105 afinfo = xfrm_state_afinfo[family]; 1107 afinfo = xfrm_state_afinfo[family];
1106 if (likely(afinfo != NULL)) 1108 if (unlikely(!afinfo))
1107 read_lock(&afinfo->lock); 1109 read_unlock(&xfrm_state_afinfo_lock);
1108 read_unlock(&xfrm_state_afinfo_lock);
1109 return afinfo; 1110 return afinfo;
1110} 1111}
1111 1112
1112static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo) 1113static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo)
1113{ 1114{
1114 if (unlikely(afinfo == NULL)) 1115 read_unlock(&xfrm_state_afinfo_lock);
1115 return;
1116 read_unlock(&afinfo->lock);
1117} 1116}
1118 1117
1119/* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */ 1118/* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */
@@ -1196,6 +1195,10 @@ int xfrm_init_state(struct xfrm_state *x)
1196 if (err) 1195 if (err)
1197 goto error; 1196 goto error;
1198 1197
1198 x->mode = xfrm_get_mode(x->props.mode, family);
1199 if (x->mode == NULL)
1200 goto error;
1201
1199 x->km.state = XFRM_STATE_VALID; 1202 x->km.state = XFRM_STATE_VALID;
1200 1203
1201error: 1204error:
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 81d1005830f4..c21dc26141ea 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -427,23 +427,25 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfrma)
427 if (x == NULL) 427 if (x == NULL)
428 return -ESRCH; 428 return -ESRCH;
429 429
430 if ((err = security_xfrm_state_delete(x)) != 0)
431 goto out;
432
430 if (xfrm_state_kern(x)) { 433 if (xfrm_state_kern(x)) {
431 xfrm_state_put(x); 434 err = -EPERM;
432 return -EPERM; 435 goto out;
433 } 436 }
434 437
435 err = xfrm_state_delete(x); 438 err = xfrm_state_delete(x);
436 if (err < 0) { 439 if (err < 0)
437 xfrm_state_put(x); 440 goto out;
438 return err;
439 }
440 441
441 c.seq = nlh->nlmsg_seq; 442 c.seq = nlh->nlmsg_seq;
442 c.pid = nlh->nlmsg_pid; 443 c.pid = nlh->nlmsg_pid;
443 c.event = nlh->nlmsg_type; 444 c.event = nlh->nlmsg_type;
444 km_state_notify(x, &c); 445 km_state_notify(x, &c);
445 xfrm_state_put(x);
446 446
447out:
448 xfrm_state_put(x);
447 return err; 449 return err;
448} 450}
449 451
@@ -1055,6 +1057,8 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr
1055 MSG_DONTWAIT); 1057 MSG_DONTWAIT);
1056 } 1058 }
1057 } else { 1059 } else {
1060 if ((err = security_xfrm_policy_delete(xp)) != 0)
1061 goto out;
1058 c.data.byid = p->index; 1062 c.data.byid = p->index;
1059 c.event = nlh->nlmsg_type; 1063 c.event = nlh->nlmsg_type;
1060 c.seq = nlh->nlmsg_seq; 1064 c.seq = nlh->nlmsg_seq;
@@ -1064,6 +1068,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr
1064 1068
1065 xfrm_pol_put(xp); 1069 xfrm_pol_put(xp);
1066 1070
1071out:
1067 return err; 1072 return err;
1068} 1073}
1069 1074
diff --git a/security/dummy.c b/security/dummy.c
index 8ccccccc12ac..64f6da0f422e 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -810,6 +810,11 @@ static void dummy_xfrm_policy_free_security(struct xfrm_policy *xp)
810{ 810{
811} 811}
812 812
813static int dummy_xfrm_policy_delete_security(struct xfrm_policy *xp)
814{
815 return 0;
816}
817
813static int dummy_xfrm_state_alloc_security(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 818static int dummy_xfrm_state_alloc_security(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
814{ 819{
815 return 0; 820 return 0;
@@ -819,6 +824,11 @@ static void dummy_xfrm_state_free_security(struct xfrm_state *x)
819{ 824{
820} 825}
821 826
827static int dummy_xfrm_state_delete_security(struct xfrm_state *x)
828{
829 return 0;
830}
831
822static int dummy_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) 832static int dummy_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
823{ 833{
824 return 0; 834 return 0;
@@ -1024,8 +1034,10 @@ void security_fixup_ops (struct security_operations *ops)
1024 set_to_dummy_if_null(ops, xfrm_policy_alloc_security); 1034 set_to_dummy_if_null(ops, xfrm_policy_alloc_security);
1025 set_to_dummy_if_null(ops, xfrm_policy_clone_security); 1035 set_to_dummy_if_null(ops, xfrm_policy_clone_security);
1026 set_to_dummy_if_null(ops, xfrm_policy_free_security); 1036 set_to_dummy_if_null(ops, xfrm_policy_free_security);
1037 set_to_dummy_if_null(ops, xfrm_policy_delete_security);
1027 set_to_dummy_if_null(ops, xfrm_state_alloc_security); 1038 set_to_dummy_if_null(ops, xfrm_state_alloc_security);
1028 set_to_dummy_if_null(ops, xfrm_state_free_security); 1039 set_to_dummy_if_null(ops, xfrm_state_free_security);
1040 set_to_dummy_if_null(ops, xfrm_state_delete_security);
1029 set_to_dummy_if_null(ops, xfrm_policy_lookup); 1041 set_to_dummy_if_null(ops, xfrm_policy_lookup);
1030#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1042#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1031#ifdef CONFIG_KEYS 1043#ifdef CONFIG_KEYS
diff --git a/security/selinux/Kconfig b/security/selinux/Kconfig
index f636f53ca544..814ddc42f1f4 100644
--- a/security/selinux/Kconfig
+++ b/security/selinux/Kconfig
@@ -1,6 +1,7 @@
1config SECURITY_SELINUX 1config SECURITY_SELINUX
2 bool "NSA SELinux Support" 2 bool "NSA SELinux Support"
3 depends on SECURITY_NETWORK && AUDIT && NET && INET 3 depends on SECURITY_NETWORK && AUDIT && NET && INET
4 select NETWORK_SECMARK
4 default n 5 default n
5 help 6 help
6 This selects NSA Security-Enhanced Linux (SELinux). 7 This selects NSA Security-Enhanced Linux (SELinux).
@@ -95,3 +96,31 @@ config SECURITY_SELINUX_CHECKREQPROT_VALUE
95 via /selinux/checkreqprot if authorized by policy. 96 via /selinux/checkreqprot if authorized by policy.
96 97
97 If you are unsure how to answer this question, answer 1. 98 If you are unsure how to answer this question, answer 1.
99
100config SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT
101 bool "NSA SELinux enable new secmark network controls by default"
102 depends on SECURITY_SELINUX
103 default n
104 help
105 This option determines whether the new secmark-based network
106 controls will be enabled by default. If not, the old internal
107 per-packet controls will be enabled by default, preserving
108 old behavior.
109
110 If you enable the new controls, you will need updated
111 SELinux userspace libraries, tools and policy. Typically,
112 your distribution will provide these and enable the new controls
113 in the kernel they also distribute.
114
115 Note that this option can be overriden at boot with the
116 selinux_compat_net parameter, and after boot via
117 /selinux/compat_net. See Documentation/kernel-parameters.txt
118 for details on this parameter.
119
120 If you enable the new network controls, you will likely
121 also require the SECMARK and CONNSECMARK targets, as
122 well as any conntrack helpers for protocols which you
123 wish to control.
124
125 If you are unsure what do do here, select N.
126
diff --git a/security/selinux/exports.c b/security/selinux/exports.c
index ae4c73eb3085..9d7737db5e51 100644
--- a/security/selinux/exports.c
+++ b/security/selinux/exports.c
@@ -72,3 +72,25 @@ void selinux_get_task_sid(struct task_struct *tsk, u32 *sid)
72 *sid = 0; 72 *sid = 0;
73} 73}
74 74
75int selinux_string_to_sid(char *str, u32 *sid)
76{
77 if (selinux_enabled)
78 return security_context_to_sid(str, strlen(str), sid);
79 else {
80 *sid = 0;
81 return 0;
82 }
83}
84EXPORT_SYMBOL_GPL(selinux_string_to_sid);
85
86int selinux_relabel_packet_permission(u32 sid)
87{
88 if (selinux_enabled) {
89 struct task_security_struct *tsec = current->security;
90
91 return avc_has_perm(tsec->sid, sid, SECCLASS_PACKET,
92 PACKET__RELABELTO, NULL);
93 }
94 return 0;
95}
96EXPORT_SYMBOL_GPL(selinux_relabel_packet_permission);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 90b4cdc0c948..54adc9d31e92 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -80,6 +80,7 @@
80 80
81extern unsigned int policydb_loaded_version; 81extern unsigned int policydb_loaded_version;
82extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); 82extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
83extern int selinux_compat_net;
83 84
84#ifdef CONFIG_SECURITY_SELINUX_DEVELOP 85#ifdef CONFIG_SECURITY_SELINUX_DEVELOP
85int selinux_enforcing = 0; 86int selinux_enforcing = 0;
@@ -696,6 +697,8 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
696 return SECCLASS_PACKET_SOCKET; 697 return SECCLASS_PACKET_SOCKET;
697 case PF_KEY: 698 case PF_KEY:
698 return SECCLASS_KEY_SOCKET; 699 return SECCLASS_KEY_SOCKET;
700 case PF_APPLETALK:
701 return SECCLASS_APPLETALK_SOCKET;
699 } 702 }
700 703
701 return SECCLASS_SOCKET; 704 return SECCLASS_SOCKET;
@@ -3214,47 +3217,17 @@ static int selinux_socket_unix_may_send(struct socket *sock,
3214 return 0; 3217 return 0;
3215} 3218}
3216 3219
3217static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) 3220static int selinux_sock_rcv_skb_compat(struct sock *sk, struct sk_buff *skb,
3221 struct avc_audit_data *ad, u32 sock_sid, u16 sock_class,
3222 u16 family, char *addrp, int len)
3218{ 3223{
3219 u16 family; 3224 int err = 0;
3220 char *addrp;
3221 int len, err = 0;
3222 u32 netif_perm, node_perm, node_sid, if_sid, recv_perm = 0; 3225 u32 netif_perm, node_perm, node_sid, if_sid, recv_perm = 0;
3223 u32 sock_sid = 0;
3224 u16 sock_class = 0;
3225 struct socket *sock;
3226 struct net_device *dev;
3227 struct avc_audit_data ad;
3228
3229 family = sk->sk_family;
3230 if (family != PF_INET && family != PF_INET6)
3231 goto out;
3232
3233 /* Handle mapped IPv4 packets arriving via IPv6 sockets */
3234 if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP))
3235 family = PF_INET;
3236
3237 read_lock_bh(&sk->sk_callback_lock);
3238 sock = sk->sk_socket;
3239 if (sock) {
3240 struct inode *inode;
3241 inode = SOCK_INODE(sock);
3242 if (inode) {
3243 struct inode_security_struct *isec;
3244 isec = inode->i_security;
3245 sock_sid = isec->sid;
3246 sock_class = isec->sclass;
3247 }
3248 }
3249 read_unlock_bh(&sk->sk_callback_lock);
3250 if (!sock_sid)
3251 goto out;
3252 3226
3253 dev = skb->dev; 3227 if (!skb->dev)
3254 if (!dev)
3255 goto out; 3228 goto out;
3256 3229
3257 err = sel_netif_sids(dev, &if_sid, NULL); 3230 err = sel_netif_sids(skb->dev, &if_sid, NULL);
3258 if (err) 3231 if (err)
3259 goto out; 3232 goto out;
3260 3233
@@ -3277,44 +3250,88 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
3277 break; 3250 break;
3278 } 3251 }
3279 3252
3280 AVC_AUDIT_DATA_INIT(&ad, NET); 3253 err = avc_has_perm(sock_sid, if_sid, SECCLASS_NETIF, netif_perm, ad);
3281 ad.u.net.netif = dev->name;
3282 ad.u.net.family = family;
3283
3284 err = selinux_parse_skb(skb, &ad, &addrp, &len, 1);
3285 if (err)
3286 goto out;
3287
3288 err = avc_has_perm(sock_sid, if_sid, SECCLASS_NETIF, netif_perm, &ad);
3289 if (err) 3254 if (err)
3290 goto out; 3255 goto out;
3291 3256
3292 /* Fixme: this lookup is inefficient */
3293 err = security_node_sid(family, addrp, len, &node_sid); 3257 err = security_node_sid(family, addrp, len, &node_sid);
3294 if (err) 3258 if (err)
3295 goto out; 3259 goto out;
3296 3260
3297 err = avc_has_perm(sock_sid, node_sid, SECCLASS_NODE, node_perm, &ad); 3261 err = avc_has_perm(sock_sid, node_sid, SECCLASS_NODE, node_perm, ad);
3298 if (err) 3262 if (err)
3299 goto out; 3263 goto out;
3300 3264
3301 if (recv_perm) { 3265 if (recv_perm) {
3302 u32 port_sid; 3266 u32 port_sid;
3303 3267
3304 /* Fixme: make this more efficient */
3305 err = security_port_sid(sk->sk_family, sk->sk_type, 3268 err = security_port_sid(sk->sk_family, sk->sk_type,
3306 sk->sk_protocol, ntohs(ad.u.net.sport), 3269 sk->sk_protocol, ntohs(ad->u.net.sport),
3307 &port_sid); 3270 &port_sid);
3308 if (err) 3271 if (err)
3309 goto out; 3272 goto out;
3310 3273
3311 err = avc_has_perm(sock_sid, port_sid, 3274 err = avc_has_perm(sock_sid, port_sid,
3312 sock_class, recv_perm, &ad); 3275 sock_class, recv_perm, ad);
3313 } 3276 }
3314 3277
3315 if (!err) 3278out:
3316 err = selinux_xfrm_sock_rcv_skb(sock_sid, skb); 3279 return err;
3280}
3281
3282static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
3283{
3284 u16 family;
3285 u16 sock_class = 0;
3286 char *addrp;
3287 int len, err = 0;
3288 u32 sock_sid = 0;
3289 struct socket *sock;
3290 struct avc_audit_data ad;
3291
3292 family = sk->sk_family;
3293 if (family != PF_INET && family != PF_INET6)
3294 goto out;
3295
3296 /* Handle mapped IPv4 packets arriving via IPv6 sockets */
3297 if (family == PF_INET6 && skb->protocol == ntohs(ETH_P_IP))
3298 family = PF_INET;
3299
3300 read_lock_bh(&sk->sk_callback_lock);
3301 sock = sk->sk_socket;
3302 if (sock) {
3303 struct inode *inode;
3304 inode = SOCK_INODE(sock);
3305 if (inode) {
3306 struct inode_security_struct *isec;
3307 isec = inode->i_security;
3308 sock_sid = isec->sid;
3309 sock_class = isec->sclass;
3310 }
3311 }
3312 read_unlock_bh(&sk->sk_callback_lock);
3313 if (!sock_sid)
3314 goto out;
3315
3316 AVC_AUDIT_DATA_INIT(&ad, NET);
3317 ad.u.net.netif = skb->dev ? skb->dev->name : "[unknown]";
3318 ad.u.net.family = family;
3319
3320 err = selinux_parse_skb(skb, &ad, &addrp, &len, 1);
3321 if (err)
3322 goto out;
3323
3324 if (selinux_compat_net)
3325 err = selinux_sock_rcv_skb_compat(sk, skb, &ad, sock_sid,
3326 sock_class, family,
3327 addrp, len);
3328 else
3329 err = avc_has_perm(sock_sid, skb->secmark, SECCLASS_PACKET,
3330 PACKET__RECV, &ad);
3331 if (err)
3332 goto out;
3317 3333
3334 err = selinux_xfrm_sock_rcv_skb(sock_sid, skb);
3318out: 3335out:
3319 return err; 3336 return err;
3320} 3337}
@@ -3454,42 +3471,18 @@ out:
3454 3471
3455#ifdef CONFIG_NETFILTER 3472#ifdef CONFIG_NETFILTER
3456 3473
3457static unsigned int selinux_ip_postroute_last(unsigned int hooknum, 3474static int selinux_ip_postroute_last_compat(struct sock *sk, struct net_device *dev,
3458 struct sk_buff **pskb, 3475 struct inode_security_struct *isec,
3459 const struct net_device *in, 3476 struct avc_audit_data *ad,
3460 const struct net_device *out, 3477 u16 family, char *addrp, int len)
3461 int (*okfn)(struct sk_buff *),
3462 u16 family)
3463{ 3478{
3464 char *addrp; 3479 int err;
3465 int len, err = NF_ACCEPT;
3466 u32 netif_perm, node_perm, node_sid, if_sid, send_perm = 0; 3480 u32 netif_perm, node_perm, node_sid, if_sid, send_perm = 0;
3467 struct sock *sk;
3468 struct socket *sock;
3469 struct inode *inode;
3470 struct sk_buff *skb = *pskb;
3471 struct inode_security_struct *isec;
3472 struct avc_audit_data ad;
3473 struct net_device *dev = (struct net_device *)out;
3474 3481
3475 sk = skb->sk;
3476 if (!sk)
3477 goto out;
3478
3479 sock = sk->sk_socket;
3480 if (!sock)
3481 goto out;
3482
3483 inode = SOCK_INODE(sock);
3484 if (!inode)
3485 goto out;
3486
3487 err = sel_netif_sids(dev, &if_sid, NULL); 3482 err = sel_netif_sids(dev, &if_sid, NULL);
3488 if (err) 3483 if (err)
3489 goto out; 3484 goto out;
3490 3485
3491 isec = inode->i_security;
3492
3493 switch (isec->sclass) { 3486 switch (isec->sclass) {
3494 case SECCLASS_UDP_SOCKET: 3487 case SECCLASS_UDP_SOCKET:
3495 netif_perm = NETIF__UDP_SEND; 3488 netif_perm = NETIF__UDP_SEND;
@@ -3509,55 +3502,88 @@ static unsigned int selinux_ip_postroute_last(unsigned int hooknum,
3509 break; 3502 break;
3510 } 3503 }
3511 3504
3512 3505 err = avc_has_perm(isec->sid, if_sid, SECCLASS_NETIF, netif_perm, ad);
3513 AVC_AUDIT_DATA_INIT(&ad, NET); 3506 if (err)
3514 ad.u.net.netif = dev->name;
3515 ad.u.net.family = family;
3516
3517 err = selinux_parse_skb(skb, &ad, &addrp,
3518 &len, 0) ? NF_DROP : NF_ACCEPT;
3519 if (err != NF_ACCEPT)
3520 goto out;
3521
3522 err = avc_has_perm(isec->sid, if_sid, SECCLASS_NETIF,
3523 netif_perm, &ad) ? NF_DROP : NF_ACCEPT;
3524 if (err != NF_ACCEPT)
3525 goto out; 3507 goto out;
3526 3508
3527 /* Fixme: this lookup is inefficient */ 3509 err = security_node_sid(family, addrp, len, &node_sid);
3528 err = security_node_sid(family, addrp, len, 3510 if (err)
3529 &node_sid) ? NF_DROP : NF_ACCEPT;
3530 if (err != NF_ACCEPT)
3531 goto out; 3511 goto out;
3532 3512
3533 err = avc_has_perm(isec->sid, node_sid, SECCLASS_NODE, 3513 err = avc_has_perm(isec->sid, node_sid, SECCLASS_NODE, node_perm, ad);
3534 node_perm, &ad) ? NF_DROP : NF_ACCEPT; 3514 if (err)
3535 if (err != NF_ACCEPT)
3536 goto out; 3515 goto out;
3537 3516
3538 if (send_perm) { 3517 if (send_perm) {
3539 u32 port_sid; 3518 u32 port_sid;
3540 3519
3541 /* Fixme: make this more efficient */
3542 err = security_port_sid(sk->sk_family, 3520 err = security_port_sid(sk->sk_family,
3543 sk->sk_type, 3521 sk->sk_type,
3544 sk->sk_protocol, 3522 sk->sk_protocol,
3545 ntohs(ad.u.net.dport), 3523 ntohs(ad->u.net.dport),
3546 &port_sid) ? NF_DROP : NF_ACCEPT; 3524 &port_sid);
3547 if (err != NF_ACCEPT) 3525 if (err)
3548 goto out; 3526 goto out;
3549 3527
3550 err = avc_has_perm(isec->sid, port_sid, isec->sclass, 3528 err = avc_has_perm(isec->sid, port_sid, isec->sclass,
3551 send_perm, &ad) ? NF_DROP : NF_ACCEPT; 3529 send_perm, ad);
3552 } 3530 }
3531out:
3532 return err;
3533}
3534
3535static unsigned int selinux_ip_postroute_last(unsigned int hooknum,
3536 struct sk_buff **pskb,
3537 const struct net_device *in,
3538 const struct net_device *out,
3539 int (*okfn)(struct sk_buff *),
3540 u16 family)
3541{
3542 char *addrp;
3543 int len, err = 0;
3544 struct sock *sk;
3545 struct socket *sock;
3546 struct inode *inode;
3547 struct sk_buff *skb = *pskb;
3548 struct inode_security_struct *isec;
3549 struct avc_audit_data ad;
3550 struct net_device *dev = (struct net_device *)out;
3553 3551
3554 if (err != NF_ACCEPT) 3552 sk = skb->sk;
3553 if (!sk)
3555 goto out; 3554 goto out;
3556 3555
3557 err = selinux_xfrm_postroute_last(isec->sid, skb); 3556 sock = sk->sk_socket;
3557 if (!sock)
3558 goto out;
3559
3560 inode = SOCK_INODE(sock);
3561 if (!inode)
3562 goto out;
3563
3564 isec = inode->i_security;
3565
3566 AVC_AUDIT_DATA_INIT(&ad, NET);
3567 ad.u.net.netif = dev->name;
3568 ad.u.net.family = family;
3569
3570 err = selinux_parse_skb(skb, &ad, &addrp, &len, 0);
3571 if (err)
3572 goto out;
3573
3574 if (selinux_compat_net)
3575 err = selinux_ip_postroute_last_compat(sk, dev, isec, &ad,
3576 family, addrp, len);
3577 else
3578 err = avc_has_perm(isec->sid, skb->secmark, SECCLASS_PACKET,
3579 PACKET__SEND, &ad);
3558 3580
3581 if (err)
3582 goto out;
3583
3584 err = selinux_xfrm_postroute_last(isec->sid, skb);
3559out: 3585out:
3560 return err; 3586 return err ? NF_DROP : NF_ACCEPT;
3561} 3587}
3562 3588
3563static unsigned int selinux_ipv4_postroute_last(unsigned int hooknum, 3589static unsigned int selinux_ipv4_postroute_last(unsigned int hooknum,
@@ -4374,8 +4400,10 @@ static struct security_operations selinux_ops = {
4374 .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc, 4400 .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc,
4375 .xfrm_policy_clone_security = selinux_xfrm_policy_clone, 4401 .xfrm_policy_clone_security = selinux_xfrm_policy_clone,
4376 .xfrm_policy_free_security = selinux_xfrm_policy_free, 4402 .xfrm_policy_free_security = selinux_xfrm_policy_free,
4403 .xfrm_policy_delete_security = selinux_xfrm_policy_delete,
4377 .xfrm_state_alloc_security = selinux_xfrm_state_alloc, 4404 .xfrm_state_alloc_security = selinux_xfrm_state_alloc,
4378 .xfrm_state_free_security = selinux_xfrm_state_free, 4405 .xfrm_state_free_security = selinux_xfrm_state_free,
4406 .xfrm_state_delete_security = selinux_xfrm_state_delete,
4379 .xfrm_policy_lookup = selinux_xfrm_policy_lookup, 4407 .xfrm_policy_lookup = selinux_xfrm_policy_lookup,
4380#endif 4408#endif
4381}; 4409};
diff --git a/security/selinux/include/av_inherit.h b/security/selinux/include/av_inherit.h
index b0e6b12931c9..a68fdd55597f 100644
--- a/security/selinux/include/av_inherit.h
+++ b/security/selinux/include/av_inherit.h
@@ -29,3 +29,4 @@
29 S_(SECCLASS_NETLINK_IP6FW_SOCKET, socket, 0x00400000UL) 29 S_(SECCLASS_NETLINK_IP6FW_SOCKET, socket, 0x00400000UL)
30 S_(SECCLASS_NETLINK_DNRT_SOCKET, socket, 0x00400000UL) 30 S_(SECCLASS_NETLINK_DNRT_SOCKET, socket, 0x00400000UL)
31 S_(SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET, socket, 0x00400000UL) 31 S_(SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET, socket, 0x00400000UL)
32 S_(SECCLASS_APPLETALK_SOCKET, socket, 0x00400000UL)
diff --git a/security/selinux/include/av_perm_to_string.h b/security/selinux/include/av_perm_to_string.h
index 591e98d9315a..70ee65a58817 100644
--- a/security/selinux/include/av_perm_to_string.h
+++ b/security/selinux/include/av_perm_to_string.h
@@ -239,3 +239,6 @@
239 S_(SECCLASS_ASSOCIATION, ASSOCIATION__SENDTO, "sendto") 239 S_(SECCLASS_ASSOCIATION, ASSOCIATION__SENDTO, "sendto")
240 S_(SECCLASS_ASSOCIATION, ASSOCIATION__RECVFROM, "recvfrom") 240 S_(SECCLASS_ASSOCIATION, ASSOCIATION__RECVFROM, "recvfrom")
241 S_(SECCLASS_ASSOCIATION, ASSOCIATION__SETCONTEXT, "setcontext") 241 S_(SECCLASS_ASSOCIATION, ASSOCIATION__SETCONTEXT, "setcontext")
242 S_(SECCLASS_PACKET, PACKET__SEND, "send")
243 S_(SECCLASS_PACKET, PACKET__RECV, "recv")
244 S_(SECCLASS_PACKET, PACKET__RELABELTO, "relabelto")
diff --git a/security/selinux/include/av_permissions.h b/security/selinux/include/av_permissions.h
index d7f02edf3930..1d9cf3d306bc 100644
--- a/security/selinux/include/av_permissions.h
+++ b/security/selinux/include/av_permissions.h
@@ -933,3 +933,29 @@
933#define NETLINK_KOBJECT_UEVENT_SOCKET__SEND_MSG 0x00100000UL 933#define NETLINK_KOBJECT_UEVENT_SOCKET__SEND_MSG 0x00100000UL
934#define NETLINK_KOBJECT_UEVENT_SOCKET__NAME_BIND 0x00200000UL 934#define NETLINK_KOBJECT_UEVENT_SOCKET__NAME_BIND 0x00200000UL
935 935
936#define APPLETALK_SOCKET__IOCTL 0x00000001UL
937#define APPLETALK_SOCKET__READ 0x00000002UL
938#define APPLETALK_SOCKET__WRITE 0x00000004UL
939#define APPLETALK_SOCKET__CREATE 0x00000008UL
940#define APPLETALK_SOCKET__GETATTR 0x00000010UL
941#define APPLETALK_SOCKET__SETATTR 0x00000020UL
942#define APPLETALK_SOCKET__LOCK 0x00000040UL
943#define APPLETALK_SOCKET__RELABELFROM 0x00000080UL
944#define APPLETALK_SOCKET__RELABELTO 0x00000100UL
945#define APPLETALK_SOCKET__APPEND 0x00000200UL
946#define APPLETALK_SOCKET__BIND 0x00000400UL
947#define APPLETALK_SOCKET__CONNECT 0x00000800UL
948#define APPLETALK_SOCKET__LISTEN 0x00001000UL
949#define APPLETALK_SOCKET__ACCEPT 0x00002000UL
950#define APPLETALK_SOCKET__GETOPT 0x00004000UL
951#define APPLETALK_SOCKET__SETOPT 0x00008000UL
952#define APPLETALK_SOCKET__SHUTDOWN 0x00010000UL
953#define APPLETALK_SOCKET__RECVFROM 0x00020000UL
954#define APPLETALK_SOCKET__SENDTO 0x00040000UL
955#define APPLETALK_SOCKET__RECV_MSG 0x00080000UL
956#define APPLETALK_SOCKET__SEND_MSG 0x00100000UL
957#define APPLETALK_SOCKET__NAME_BIND 0x00200000UL
958
959#define PACKET__SEND 0x00000001UL
960#define PACKET__RECV 0x00000002UL
961#define PACKET__RELABELTO 0x00000004UL
diff --git a/security/selinux/include/class_to_string.h b/security/selinux/include/class_to_string.h
index 77b2c5996f35..3aec75fee4f7 100644
--- a/security/selinux/include/class_to_string.h
+++ b/security/selinux/include/class_to_string.h
@@ -58,3 +58,5 @@
58 S_("nscd") 58 S_("nscd")
59 S_("association") 59 S_("association")
60 S_("netlink_kobject_uevent_socket") 60 S_("netlink_kobject_uevent_socket")
61 S_("appletalk_socket")
62 S_("packet")
diff --git a/security/selinux/include/flask.h b/security/selinux/include/flask.h
index eb9f50823f6e..a0eb9e281d18 100644
--- a/security/selinux/include/flask.h
+++ b/security/selinux/include/flask.h
@@ -60,6 +60,8 @@
60#define SECCLASS_NSCD 53 60#define SECCLASS_NSCD 53
61#define SECCLASS_ASSOCIATION 54 61#define SECCLASS_ASSOCIATION 54
62#define SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET 55 62#define SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET 55
63#define SECCLASS_APPLETALK_SOCKET 56
64#define SECCLASS_PACKET 57
63 65
64/* 66/*
65 * Security identifier indices for initial entities 67 * Security identifier indices for initial entities
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h
index c10f1fc41502..c96498a10eb8 100644
--- a/security/selinux/include/xfrm.h
+++ b/security/selinux/include/xfrm.h
@@ -9,8 +9,10 @@
9int selinux_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); 9int selinux_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
10int selinux_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new); 10int selinux_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new);
11void selinux_xfrm_policy_free(struct xfrm_policy *xp); 11void selinux_xfrm_policy_free(struct xfrm_policy *xp);
12int selinux_xfrm_policy_delete(struct xfrm_policy *xp);
12int selinux_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); 13int selinux_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
13void selinux_xfrm_state_free(struct xfrm_state *x); 14void selinux_xfrm_state_free(struct xfrm_state *x);
15int selinux_xfrm_state_delete(struct xfrm_state *x);
14int selinux_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir); 16int selinux_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
15 17
16/* 18/*
@@ -49,7 +51,7 @@ static inline int selinux_xfrm_sock_rcv_skb(u32 isec_sid, struct sk_buff *skb)
49 51
50static inline int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb) 52static inline int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb)
51{ 53{
52 return NF_ACCEPT; 54 return 0;
53} 55}
54 56
55static inline int selinux_socket_getpeer_stream(struct sock *sk) 57static inline int selinux_socket_getpeer_stream(struct sock *sk)
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index a4efc966f065..2e73d3279f2d 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -38,6 +38,14 @@
38 38
39unsigned int selinux_checkreqprot = CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE; 39unsigned int selinux_checkreqprot = CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE;
40 40
41#ifdef CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT
42#define SELINUX_COMPAT_NET_VALUE 0
43#else
44#define SELINUX_COMPAT_NET_VALUE 1
45#endif
46
47int selinux_compat_net = SELINUX_COMPAT_NET_VALUE;
48
41static int __init checkreqprot_setup(char *str) 49static int __init checkreqprot_setup(char *str)
42{ 50{
43 selinux_checkreqprot = simple_strtoul(str,NULL,0) ? 1 : 0; 51 selinux_checkreqprot = simple_strtoul(str,NULL,0) ? 1 : 0;
@@ -45,6 +53,13 @@ static int __init checkreqprot_setup(char *str)
45} 53}
46__setup("checkreqprot=", checkreqprot_setup); 54__setup("checkreqprot=", checkreqprot_setup);
47 55
56static int __init selinux_compat_net_setup(char *str)
57{
58 selinux_compat_net = simple_strtoul(str,NULL,0) ? 1 : 0;
59 return 1;
60}
61__setup("selinux_compat_net=", selinux_compat_net_setup);
62
48 63
49static DEFINE_MUTEX(sel_mutex); 64static DEFINE_MUTEX(sel_mutex);
50 65
@@ -85,6 +100,7 @@ enum sel_inos {
85 SEL_AVC, /* AVC management directory */ 100 SEL_AVC, /* AVC management directory */
86 SEL_MEMBER, /* compute polyinstantiation membership decision */ 101 SEL_MEMBER, /* compute polyinstantiation membership decision */
87 SEL_CHECKREQPROT, /* check requested protection, not kernel-applied one */ 102 SEL_CHECKREQPROT, /* check requested protection, not kernel-applied one */
103 SEL_COMPAT_NET, /* whether to use old compat network packet controls */
88}; 104};
89 105
90#define TMPBUFLEN 12 106#define TMPBUFLEN 12
@@ -364,6 +380,55 @@ static struct file_operations sel_checkreqprot_ops = {
364 .write = sel_write_checkreqprot, 380 .write = sel_write_checkreqprot,
365}; 381};
366 382
383static ssize_t sel_read_compat_net(struct file *filp, char __user *buf,
384 size_t count, loff_t *ppos)
385{
386 char tmpbuf[TMPBUFLEN];
387 ssize_t length;
388
389 length = scnprintf(tmpbuf, TMPBUFLEN, "%d", selinux_compat_net);
390 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
391}
392
393static ssize_t sel_write_compat_net(struct file * file, const char __user * buf,
394 size_t count, loff_t *ppos)
395{
396 char *page;
397 ssize_t length;
398 int new_value;
399
400 length = task_has_security(current, SECURITY__LOAD_POLICY);
401 if (length)
402 return length;
403
404 if (count >= PAGE_SIZE)
405 return -ENOMEM;
406 if (*ppos != 0) {
407 /* No partial writes. */
408 return -EINVAL;
409 }
410 page = (char*)get_zeroed_page(GFP_KERNEL);
411 if (!page)
412 return -ENOMEM;
413 length = -EFAULT;
414 if (copy_from_user(page, buf, count))
415 goto out;
416
417 length = -EINVAL;
418 if (sscanf(page, "%d", &new_value) != 1)
419 goto out;
420
421 selinux_compat_net = new_value ? 1 : 0;
422 length = count;
423out:
424 free_page((unsigned long) page);
425 return length;
426}
427static struct file_operations sel_compat_net_ops = {
428 .read = sel_read_compat_net,
429 .write = sel_write_compat_net,
430};
431
367/* 432/*
368 * Remaining nodes use transaction based IO methods like nfsd/nfsctl.c 433 * Remaining nodes use transaction based IO methods like nfsd/nfsctl.c
369 */ 434 */
@@ -1219,6 +1284,7 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent)
1219 [SEL_DISABLE] = {"disable", &sel_disable_ops, S_IWUSR}, 1284 [SEL_DISABLE] = {"disable", &sel_disable_ops, S_IWUSR},
1220 [SEL_MEMBER] = {"member", &transaction_ops, S_IRUGO|S_IWUGO}, 1285 [SEL_MEMBER] = {"member", &transaction_ops, S_IRUGO|S_IWUGO},
1221 [SEL_CHECKREQPROT] = {"checkreqprot", &sel_checkreqprot_ops, S_IRUGO|S_IWUSR}, 1286 [SEL_CHECKREQPROT] = {"checkreqprot", &sel_checkreqprot_ops, S_IRUGO|S_IWUSR},
1287 [SEL_COMPAT_NET] = {"compat_net", &sel_compat_net_ops, S_IRUGO|S_IWUSR},
1222 /* last one */ {""} 1288 /* last one */ {""}
1223 }; 1289 };
1224 ret = simple_fill_super(sb, SELINUX_MAGIC, selinux_files); 1290 ret = simple_fill_super(sb, SELINUX_MAGIC, selinux_files);
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index abe99d881376..6633fb059313 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -132,10 +132,7 @@ static int selinux_xfrm_sec_ctx_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_us
132 goto out; 132 goto out;
133 133
134 /* 134 /*
135 * Does the subject have permission to set security or permission to 135 * Does the subject have permission to set security context?
136 * do the relabel?
137 * Must be permitted to relabel from default socket type (process type)
138 * to specified context
139 */ 136 */
140 rc = avc_has_perm(tsec->sid, ctx->ctx_sid, 137 rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
141 SECCLASS_ASSOCIATION, 138 SECCLASS_ASSOCIATION,
@@ -201,6 +198,23 @@ void selinux_xfrm_policy_free(struct xfrm_policy *xp)
201} 198}
202 199
203/* 200/*
201 * LSM hook implementation that authorizes deletion of labeled policies.
202 */
203int selinux_xfrm_policy_delete(struct xfrm_policy *xp)
204{
205 struct task_security_struct *tsec = current->security;
206 struct xfrm_sec_ctx *ctx = xp->security;
207 int rc = 0;
208
209 if (ctx)
210 rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
211 SECCLASS_ASSOCIATION,
212 ASSOCIATION__SETCONTEXT, NULL);
213
214 return rc;
215}
216
217/*
204 * LSM hook implementation that allocs and transfers sec_ctx spec to 218 * LSM hook implementation that allocs and transfers sec_ctx spec to
205 * xfrm_state. 219 * xfrm_state.
206 */ 220 */
@@ -292,6 +306,23 @@ u32 selinux_socket_getpeer_dgram(struct sk_buff *skb)
292 return SECSID_NULL; 306 return SECSID_NULL;
293} 307}
294 308
309 /*
310 * LSM hook implementation that authorizes deletion of labeled SAs.
311 */
312int selinux_xfrm_state_delete(struct xfrm_state *x)
313{
314 struct task_security_struct *tsec = current->security;
315 struct xfrm_sec_ctx *ctx = x->security;
316 int rc = 0;
317
318 if (ctx)
319 rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
320 SECCLASS_ASSOCIATION,
321 ASSOCIATION__SETCONTEXT, NULL);
322
323 return rc;
324}
325
295/* 326/*
296 * LSM hook that controls access to unlabelled packets. If 327 * LSM hook that controls access to unlabelled packets. If
297 * a xfrm_state is authorizable (defined by macro) then it was 328 * a xfrm_state is authorizable (defined by macro) then it was
@@ -356,18 +387,12 @@ int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb)
356 struct xfrm_state *x = dst_test->xfrm; 387 struct xfrm_state *x = dst_test->xfrm;
357 388
358 if (x && selinux_authorizable_xfrm(x)) 389 if (x && selinux_authorizable_xfrm(x))
359 goto accept; 390 goto out;
360 } 391 }
361 } 392 }
362 393
363 rc = avc_has_perm(isec_sid, SECINITSID_UNLABELED, SECCLASS_ASSOCIATION, 394 rc = avc_has_perm(isec_sid, SECINITSID_UNLABELED, SECCLASS_ASSOCIATION,
364 ASSOCIATION__SENDTO, NULL); 395 ASSOCIATION__SENDTO, NULL);
365 if (rc) 396out:
366 goto drop; 397 return rc;
367
368accept:
369 return NF_ACCEPT;
370
371drop:
372 return NF_DROP;
373} 398}
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index 558c6ed443be..080ab036b67a 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -98,8 +98,8 @@ config SOUND_HAL2
98 tristate "SGI HAL2 sound (EXPERIMENTAL)" 98 tristate "SGI HAL2 sound (EXPERIMENTAL)"
99 depends on SOUND_PRIME && SGI_IP22 && EXPERIMENTAL 99 depends on SOUND_PRIME && SGI_IP22 && EXPERIMENTAL
100 help 100 help
101 Say Y or M if you have an SGI Indy system and want to be able to 101 Say Y or M if you have an SGI Indy or Indigo2 system and want to be able to
102 use it's on-board A2 audio system. 102 use its on-board A2 audio system.
103 103
104config SOUND_IT8172 104config SOUND_IT8172
105 tristate "IT8172G Sound" 105 tristate "IT8172G Sound"